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 // 4714 - function marked as __forceinline not inlined
18 // 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow
19 // 4800 - 'type' : forcing value to bool 'true' or 'false' (performance warning)
20 #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
21 #pragma warning( push )
22 #endif
23 #pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4503 4512 4522 4700 4714 4717 4800)
24
25#elif defined __INTEL_COMPILER
26 // 2196 - routine is both "inline" and "noinline" ("noinline" assumed)
27 // ICC 12 generates this warning even without any inline keyword, when defining class methods 'inline' i.e. inside of class body
28 // typedef that may be a reference type.
29 // 279 - controlling expression is constant
30 // ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case.
31 // 1684 - conversion from pointer to same-sized integral type (potential portability problem)
32 // 2259 - non-pointer conversion from "Eigen::Index={ptrdiff_t={long}}" to "int" may lose significant bits
33 #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
34 #pragma warning push
35 #endif
36 #pragma warning disable 2196 279 1684 2259
37
38#elif defined __clang__
39 // -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant
40 // this is really a stupid warning as it warns on compile-time expressions involving enums
41 #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
42 #pragma clang diagnostic push
43 #endif
44 #pragma clang diagnostic ignored "-Wconstant-logical-operand"
45
46#elif defined __GNUC__
47
48 #if (!defined(EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS)) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
49 #pragma GCC diagnostic push
50 #endif
51 // g++ warns about local variables shadowing member functions, which is too strict
52 #pragma GCC diagnostic ignored "-Wshadow"
53 #if __GNUC__ == 4 && __GNUC_MINOR__ < 8
54 // Until g++-4.7 there are warnings when comparing unsigned int vs 0, even in templated functions:
55 #pragma GCC diagnostic ignored "-Wtype-limits"
56 #endif
57 #if __GNUC__>=6
58 #pragma GCC diagnostic ignored "-Wignored-attributes"
59 #endif
60
61#endif
62
63#if defined __NVCC__
64 // Disable the "statement is unreachable" message
65 #pragma diag_suppress code_is_unreachable
66 // Disable the "dynamic initialization in unreachable code" message
67 #pragma diag_suppress initialization_not_reachable
68 // Disable the "invalid error number" message that we get with older versions of nvcc
69 #pragma diag_suppress 1222
70 // Disable the "calling a __host__ function from a __host__ __device__ function is not allowed" messages (yes, there are many of them and they seem to change with every version of the compiler)
71 #pragma diag_suppress 2527
72 #pragma diag_suppress 2529
73 #pragma diag_suppress 2651
74 #pragma diag_suppress 2653
75 #pragma diag_suppress 2668
76 #pragma diag_suppress 2669
77 #pragma diag_suppress 2670
78 #pragma diag_suppress 2671
79 #pragma diag_suppress 2735
80 #pragma diag_suppress 2737
81#endif
82
83#endif // not EIGEN_WARNINGS_DISABLED
84