diff --git a/CMakeLists.txt b/CMakeLists.txt index 39b29e48d..a09a2ea06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,6 +101,8 @@ if(EIGEN_DEFAULT_TO_ROW_MAJOR) add_definitions("-DEIGEN_DEFAULT_TO_ROW_MAJOR") endif() +add_definitions("-DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS") + if(CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fexceptions -fno-check-new -fno-common -fstrict-aliasing") set(CMAKE_CXX_FLAGS_DEBUG "-g3") diff --git a/Eigen/src/Core/util/DisableStupidWarnings.h b/Eigen/src/Core/util/DisableStupidWarnings.h index 01c04abdc..69e557ae5 100644 --- a/Eigen/src/Core/util/DisableStupidWarnings.h +++ b/Eigen/src/Core/util/DisableStupidWarnings.h @@ -1,3 +1,6 @@ +#ifndef EIGEN_WARNINGS_DISABLED +#define EIGEN_WARNINGS_DISABLED + #ifdef _MSC_VER // 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p)) // 4101 - unreferenced local variable @@ -11,14 +14,20 @@ // 4522 - 'class' : multiple assignment operators specified // 4700 - uninitialized local variable 'xyz' used // 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow - #pragma warning( push ) + #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS + #pragma warning( push ) + #endif #pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4512 4522 4700 4717 ) #elif defined __INTEL_COMPILER // 2196 - routine is both "inline" and "noinline" ("noinline" assumed) // ICC 12 generates this warning even without any inline keyword, when defining class methods 'inline' i.e. inside of class body // 2536 - type qualifiers are meaningless here // ICC 12 generates this warning when a function return type is const qualified, even if that type is a template-parameter-dependent - // typedef that may be a reference type - #pragma warning push + // typedef that may be a reference type. + #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS + #pragma warning push + #endif #pragma warning disable 2196 2536 -#endif \ No newline at end of file +#endif + +#endif // not EIGEN_WARNINGS_DISABLED diff --git a/Eigen/src/Core/util/ReenableStupidWarnings.h b/Eigen/src/Core/util/ReenableStupidWarnings.h index 92d2d95c0..4bd1d1506 100644 --- a/Eigen/src/Core/util/ReenableStupidWarnings.h +++ b/Eigen/src/Core/util/ReenableStupidWarnings.h @@ -1,5 +1,12 @@ -#ifdef _MSC_VER - #pragma warning( pop ) -#elif defined __INTEL_COMPILER - #pragma warning pop -#endif \ No newline at end of file +#ifdef EIGEN_WARNINGS_DISABLED +#undef EIGEN_WARNINGS_DISABLED + +#ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS + #ifdef _MSC_VER + #pragma warning( pop ) + #elif defined __INTEL_COMPILER + #pragma warning pop + #endif +#endif + +#endif // EIGEN_WARNINGS_DISABLED \ No newline at end of file