From ec3667c1986714901e894311d2ec5c5091cbfb01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=B6ller?= Date: Wed, 4 Mar 2015 14:51:24 +0000 Subject: [PATCH] - improve warning text - add checkbox to disable warning git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1232 fdac6126-5c0c-442c-9429-916003d36597 --- CMakeLists.txt | 8 ++++++++ src/OpenMesh/Core/Mesh/CirculatorsT.hh | 20 ++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb009c3f..4638f59c 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 7e74afad..b7667ecb 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);