1c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#ifndef EIGEN_WARNINGS_DISABLED
2c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#define EIGEN_WARNINGS_DISABLED
3c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
4c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#ifdef _MSC_VER
5c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  // 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p))
6c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  // 4101 - unreferenced local variable
7c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  // 4127 - conditional expression is constant
8c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  // 4181 - qualifier applied to reference type ignored
9c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  // 4211 - nonstandard extension used : redefined extern to static
10c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  // 4244 - 'argument' : conversion from 'type1' to 'type2', possible loss of data
11c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  // 4273 - QtAlignedMalloc, inconsistent DLL linkage
12c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  // 4324 - structure was padded due to declspec(align())
13c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  // 4512 - assignment operator could not be generated
14c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  // 4522 - 'class' : multiple assignment operators specified
15c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  // 4700 - uninitialized local variable 'xyz' used
16c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  // 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow
17c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
18c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    #pragma warning( push )
19c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  #endif
20c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  #pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4512 4522 4700 4717 )
21c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#elif defined __INTEL_COMPILER
22c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  // 2196 - routine is both "inline" and "noinline" ("noinline" assumed)
23c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  //        ICC 12 generates this warning even without any inline keyword, when defining class methods 'inline' i.e. inside of class body
24c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  //        typedef that may be a reference type.
25c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  // 279  - controlling expression is constant
26c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  //        ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case.
27c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
28c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    #pragma warning push
29c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  #endif
30c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  #pragma warning disable 2196 279
31c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#elif defined __clang__
32c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  // -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant
33c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  //     this is really a stupid warning as it warns on compile-time expressions involving enums
34c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
35c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    #pragma clang diagnostic push
36c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  #endif
37c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  #pragma clang diagnostic ignored "-Wconstant-logical-operand"
38c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#endif
39c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
40c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#endif // not EIGEN_WARNINGS_DISABLED
41