diff --git a/CMakeLists.txt b/CMakeLists.txt index cb009c3fdcb56f3a3a2cd0663da76447a3fa1b07..4638f59cd7cf019d31b4418afdf7a13b62138760 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,10 @@ endif() include (ACGOutput) +# ======================================================================== +# Definitions +# ======================================================================== + if (WIN32) add_definitions( -D_USE_MATH_DEFINES -DNOMINMAX @@ -31,6 +35,10 @@ if (WIN32) ) endif () +set(NO_DECREMENT_DEPRECATED_WARNINGS OFF CACHE BOOL "Disables all deprecated warnings warning about decrement operations on normal circulators.") +if(NO_DECREMENT_DEPRECATED_WARNINGS) + add_definitions( -DNO_DECREMENT_DEPRECATED_WARNINGS ) +endif() # ======================================================================== # Windows build style control diff --git a/src/OpenMesh/Core/Mesh/CirculatorsT.hh b/src/OpenMesh/Core/Mesh/CirculatorsT.hh index 7e74afad7b982f524acf1975b25646915341aebf..b7667ecbbd2f5da2bd2721edea87ec8453c01bcf 100644 --- a/src/OpenMesh/Core/Mesh/CirculatorsT.hh +++ b/src/OpenMesh/Core/Mesh/CirculatorsT.hh @@ -485,7 +485,20 @@ class GenericCirculatorT_DEPRECATED : protected GenericCirculatorBaseT { GenericCirculator_ValueHandleFns::increment(this->mesh_, this->heh_, this->start_, this->lap_counter_); return *this; } - DEPRECATED("current decrement operator is deprecated. Please use CCW/CW iterators.") +#ifndef NO_DECREMENT_DEPRECATED_WARNINGS +#define DECREMENT_DEPRECATED_WARNINGS_TEXT "The current decrement operator has the unintended behavior that it stays\ + valid when iterating below the start and will visit the first entity\ + twice before getting invalid. Furthermore it gets valid again, if you\ + increment at the end.\ + When you are sure that you don't iterate below the start anywhere in\ + your code or rely on this behaviour, you can disable this warning by\ + setting the define NO_DECREMENT_DEPRECATED_WARNINGS at the command line (or enable it via the\ + cmake flags).\ + To be save, you can use the CW/CCW circulator definitions, which behave\ + the same as the original ones, without the previously mentioned issues." + + DEPRECATED( DECREMENT_DEPRECATED_WARNINGS_TEXT ) +#endif // NO_DECREMENT_DEPRECATED_WARNINGS GenericCirculatorT_DEPRECATED& operator--() { assert(this->mesh_); GenericCirculator_ValueHandleFns::decrement(this->mesh_, this->heh_, this->start_, this->lap_counter_); @@ -501,7 +514,10 @@ class GenericCirculatorT_DEPRECATED : protected GenericCirculatorBaseT { } /// Post-decrement - DEPRECATED("current decrement operator is deprecated. Please use CCW/CW iterators.") +#ifndef NO_DECREMENT_DEPRECATED_WARNINGS + DEPRECATED( DECREMENT_DEPRECATED_WARNINGS_TEXT ) +#undef DECREMENT_DEPRECATED_WARNINGS_TEXT +#endif //NO_DECREMENT_DEPRECATED_WARNINGS GenericCirculatorT_DEPRECATED operator--(int) { assert(this->mesh_); GenericCirculatorT_DEPRECATED cpy(*this);