mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
add EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS non-default option. Use it in our own CMakeLists. also add a include-guard-like mechanism to prevent doing unmatched #pragma warning push/pop.
This commit is contained in:
parent
9e1127619c
commit
c58a2ff03a
@ -101,6 +101,8 @@ if(EIGEN_DEFAULT_TO_ROW_MAJOR)
|
|||||||
add_definitions("-DEIGEN_DEFAULT_TO_ROW_MAJOR")
|
add_definitions("-DEIGEN_DEFAULT_TO_ROW_MAJOR")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_definitions("-DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS")
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
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 "${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")
|
set(CMAKE_CXX_FLAGS_DEBUG "-g3")
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#ifndef EIGEN_WARNINGS_DISABLED
|
||||||
|
#define EIGEN_WARNINGS_DISABLED
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p))
|
// 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p))
|
||||||
// 4101 - unreferenced local variable
|
// 4101 - unreferenced local variable
|
||||||
@ -11,14 +14,20 @@
|
|||||||
// 4522 - 'class' : multiple assignment operators specified
|
// 4522 - 'class' : multiple assignment operators specified
|
||||||
// 4700 - uninitialized local variable 'xyz' used
|
// 4700 - uninitialized local variable 'xyz' used
|
||||||
// 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow
|
// 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 )
|
#pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4512 4522 4700 4717 )
|
||||||
#elif defined __INTEL_COMPILER
|
#elif defined __INTEL_COMPILER
|
||||||
// 2196 - routine is both "inline" and "noinline" ("noinline" assumed)
|
// 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
|
// 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
|
// 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
|
// 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
|
// typedef that may be a reference type.
|
||||||
#pragma warning push
|
#ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
|
||||||
|
#pragma warning push
|
||||||
|
#endif
|
||||||
#pragma warning disable 2196 2536
|
#pragma warning disable 2196 2536
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // not EIGEN_WARNINGS_DISABLED
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
#ifdef _MSC_VER
|
#ifdef EIGEN_WARNINGS_DISABLED
|
||||||
#pragma warning( pop )
|
#undef EIGEN_WARNINGS_DISABLED
|
||||||
#elif defined __INTEL_COMPILER
|
|
||||||
#pragma warning pop
|
#ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning( pop )
|
||||||
|
#elif defined __INTEL_COMPILER
|
||||||
|
#pragma warning pop
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // EIGEN_WARNINGS_DISABLED
|
Loading…
x
Reference in New Issue
Block a user