From 0f49ca577045bdfdc61445f77c8e9dc2e3a83b8e Mon Sep 17 00:00:00 2001 From: Bertho Stultiens Date: Fri, 10 Jan 2025 21:38:29 +0100 Subject: [PATCH] Fix implicitly-declared 'constexpr...' warnings. --- src/emc/nml_intf/emc_nml.hh | 3 ++- src/emc/nml_intf/emcops.cc | 4 ++-- src/libnml/posemath/posemath.h | 10 ++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/emc/nml_intf/emc_nml.hh b/src/emc/nml_intf/emc_nml.hh index 14d1ea4a0b8..3d64827795a 100644 --- a/src/emc/nml_intf/emc_nml.hh +++ b/src/emc/nml_intf/emc_nml.hh @@ -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 diff --git a/src/emc/nml_intf/emcops.cc b/src/emc/nml_intf/emcops.cc index 8cb77d04a41..5f008a918c4 100644 --- a/src/emc/nml_intf/emcops.cc +++ b/src/emc/nml_intf/emcops.cc @@ -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 @@ -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)) diff --git a/src/libnml/posemath/posemath.h b/src/libnml/posemath/posemath.h index bd637f8baec..da757a58b87 100644 --- a/src/libnml/posemath/posemath.h +++ b/src/libnml/posemath/posemath.h @@ -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 */