Eigen  3.2.93
DisableStupidWarnings.h
1 #ifndef EIGEN_WARNINGS_DISABLED
2 #define EIGEN_WARNINGS_DISABLED
3 
4 #ifdef _MSC_VER
5  // 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p))
6  // 4101 - unreferenced local variable
7  // 4127 - conditional expression is constant
8  // 4181 - qualifier applied to reference type ignored
9  // 4211 - nonstandard extension used : redefined extern to static
10  // 4244 - 'argument' : conversion from 'type1' to 'type2', possible loss of data
11  // 4273 - QtAlignedMalloc, inconsistent DLL linkage
12  // 4324 - structure was padded due to declspec(align())
13  // 4503 - decorated name length exceeded, name was truncated
14  // 4512 - assignment operator could not be generated
15  // 4522 - 'class' : multiple assignment operators specified
16  // 4700 - uninitialized local variable 'xyz' used
17  // 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow
18  // 4800 - 'type' : forcing value to bool 'true' or 'false' (performance warning)
19  #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
20  #pragma warning( push )
21  #endif
22  #pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4503 4512 4522 4700 4717 4800)
23 
24 #elif defined __INTEL_COMPILER
25  // 2196 - routine is both "inline" and "noinline" ("noinline" assumed)
26  // ICC 12 generates this warning even without any inline keyword, when defining class methods 'inline' i.e. inside of class body
27  // typedef that may be a reference type.
28  // 279 - controlling expression is constant
29  // ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case.
30  // 1684 - conversion from pointer to same-sized integral type (potential portability problem)
31  // 2259 - non-pointer conversion from "Eigen::Index={ptrdiff_t={long}}" to "int" may lose significant bits
32  #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
33  #pragma warning push
34  #endif
35  #pragma warning disable 2196 279 1684 2259
36 
37 #elif defined __clang__
38  // -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant
39  // this is really a stupid warning as it warns on compile-time expressions involving enums
40  #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
41  #pragma clang diagnostic push
42  #endif
43  #pragma clang diagnostic ignored "-Wconstant-logical-operand"
44 
45 #elif defined __GNUC__ && __GNUC__>=6
46 
47  #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
48  #pragma GCC diagnostic push
49  #endif
50  #pragma GCC diagnostic ignored "-Wignored-attributes"
51 
52 #endif
53 
54 #if defined __NVCC__
55  // Disable the "statement is unreachable" message
56  #pragma diag_suppress code_is_unreachable
57  // Disable the "dynamic initialization in unreachable code" message
58  #pragma diag_suppress initialization_not_reachable
59  // Disable the "calling a __host__ function from a __host__ __device__ function is not allowed" messages (yes, there are 4 of them)
60  #pragma diag_suppress 2651
61  #pragma diag_suppress 2653
62  #pragma diag_suppress 2668
63  #pragma diag_suppress 2669
64  #pragma diag_suppress 2670
65  #pragma diag_suppress 2671
66 #endif
67 
68 #endif // not EIGEN_WARNINGS_DISABLED