DisableStupidWarnings.h
Go to the documentation of this file.
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  // 4181 - qualifier applied to reference type ignored
8  // 4211 - nonstandard extension used : redefined extern to static
9  // 4244 - 'argument' : conversion from 'type1' to 'type2', possible loss of data
10  // 4273 - QtAlignedMalloc, inconsistent DLL linkage
11  // 4324 - structure was padded due to declspec(align())
12  // 4503 - decorated name length exceeded, name was truncated
13  // 4512 - assignment operator could not be generated
14  // 4522 - 'class' : multiple assignment operators specified
15  // 4700 - uninitialized local variable 'xyz' used
16  // 4714 - function marked as __forceinline not inlined
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 4181 4211 4244 4273 4324 4503 4512 4522 4700 4714 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  #if __clang_major__ >= 3 && __clang_minor__ >= 5
45  #pragma clang diagnostic ignored "-Wabsolute-value"
46  #endif
47  #if __clang_major__ >= 10
48  #pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"
49  #endif
50  #if ( defined(__ALTIVEC__) || defined(__VSX__) ) && __cplusplus < 201103L
51  // warning: generic selections are a C11-specific feature
52  // ignoring warnings thrown at vec_ctf in Altivec/PacketMath.h
53  #pragma clang diagnostic ignored "-Wc11-extensions"
54  #endif
55 
56 #elif defined __GNUC__
57 
58  #if (!defined(EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS)) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
59  #pragma GCC diagnostic push
60  #endif
61  // g++ warns about local variables shadowing member functions, which is too strict
62  #pragma GCC diagnostic ignored "-Wshadow"
63  #if __GNUC__ == 4 && __GNUC_MINOR__ < 8
64  // Until g++-4.7 there are warnings when comparing unsigned int vs 0, even in templated functions:
65  #pragma GCC diagnostic ignored "-Wtype-limits"
66  #endif
67  #if __GNUC__>=6
68  #pragma GCC diagnostic ignored "-Wignored-attributes"
69  #endif
70  #if __GNUC__==7
71  // See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89325
72  #pragma GCC diagnostic ignored "-Wattributes"
73  #endif
74 #endif
75 
76 #if defined __NVCC__
77  #pragma diag_suppress boolean_controlling_expr_is_constant
78  // Disable the "statement is unreachable" message
79  #pragma diag_suppress code_is_unreachable
80  // Disable the "dynamic initialization in unreachable code" message
81  #pragma diag_suppress initialization_not_reachable
82  // Disable the "invalid error number" message that we get with older versions of nvcc
83  #pragma diag_suppress 1222
84  // 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)
85  #pragma diag_suppress 2527
86  #pragma diag_suppress 2529
87  #pragma diag_suppress 2651
88  #pragma diag_suppress 2653
89  #pragma diag_suppress 2668
90  #pragma diag_suppress 2669
91  #pragma diag_suppress 2670
92  #pragma diag_suppress 2671
93  #pragma diag_suppress 2735
94  #pragma diag_suppress 2737
95  #pragma diag_suppress 2739
96 #endif
97 
98 #else
99 // warnings already disabled:
100 # ifndef EIGEN_WARNINGS_DISABLED_2
101 # define EIGEN_WARNINGS_DISABLED_2
102 # elif defined(EIGEN_INTERNAL_DEBUGGING)
103 # error "Do not include \"DisableStupidWarnings.h\" recursively more than twice!"
104 # endif
105 
106 #endif // not EIGEN_WARNINGS_DISABLED


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:32:26