Skip to content

Commit

Permalink
Merge pull request #3267 from BsAtHome/fix_deprecated-copy
Browse files Browse the repository at this point in the history
Fix implicitly-declared 'constexpr...' warnings
  • Loading branch information
andypugh authored Jan 11, 2025
2 parents a9ec62b + 0f49ca5 commit 4747e59
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/emc/nml_intf/emc_nml.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1342,10 +1342,11 @@ class EMC_TOOL_STAT_MSG:public RCS_STAT_MSG {
class EMC_TOOL_STAT:public EMC_TOOL_STAT_MSG {
public:
EMC_TOOL_STAT();
EMC_TOOL_STAT(const EMC_TOOL_STAT &) = delete; // No copy constructor

// For internal NML/CMS use only.
void update(CMS * cms);
EMC_TOOL_STAT operator =(EMC_TOOL_STAT s); // need this for [] members
EMC_TOOL_STAT& operator =(const EMC_TOOL_STAT &s); // need this for [] members

int pocketPrepped; // idx ready for loading from
int toolInSpindle; // tool loaded, 0 is no tool
Expand Down
4 changes: 2 additions & 2 deletions src/emc/nml_intf/emcops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ EMC_COOLANT_STAT::EMC_COOLANT_STAT():EMC_COOLANT_STAT_MSG(EMC_COOLANT_STAT_TYPE,
}

// overload = , since class has array elements
EMC_TOOL_STAT EMC_TOOL_STAT::operator =(EMC_TOOL_STAT s)
EMC_TOOL_STAT& EMC_TOOL_STAT::operator =(const EMC_TOOL_STAT& s)
{
pocketPrepped = s.pocketPrepped; // idx
toolInSpindle = s.toolInSpindle; // toolno
Expand All @@ -221,7 +221,7 @@ EMC_TOOL_STAT EMC_TOOL_STAT::operator =(EMC_TOOL_STAT s)
toolTableCurrent = tdata;
#endif //}

return s;
return *this;
}

EMC_STAT::EMC_STAT():EMC_STAT_MSG(EMC_STAT_TYPE, sizeof(EMC_STAT))
Expand Down
10 changes: 10 additions & 0 deletions src/libnml/posemath/posemath.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,17 @@
#define PM_REF
#endif

#if __cplusplus < 201103L
/*
* Not required in C++11 and beyond. It will generate a warning:
* "implicitly-declared 'constexpr ...' is deprecated [-Wdeprecated-copy]"
* If, somehow, somewhere, it is required, then you probably must implement
* both copy-constructor, destructor and operator= override (rule of three).
* Otherwise, if you do not have anything special in the members, then the
* compiler will do a good job at doing the right thing for you.
*/
#define INCLUDE_POSEMATH_COPY_CONSTRUCTORS
#endif

/* forward declarations-- conversion ctors will need these */

Expand Down

0 comments on commit 4747e59

Please sign in to comment.