Home | History | Annotate | Download | only in util
      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__ && __GNUC__>=6
     47 
     48   #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
     49     #pragma GCC diagnostic push
     50   #endif
     51   #pragma GCC diagnostic ignored "-Wignored-attributes"
     52 
     53 #endif
     54 
     55 #if defined __NVCC__
     56   // Disable the "statement is unreachable" message
     57   #pragma diag_suppress code_is_unreachable
     58   // Disable the "dynamic initialization in unreachable code" message
     59   #pragma diag_suppress initialization_not_reachable
     60   // Disable the "invalid error number" message that we get with older versions of nvcc
     61   #pragma diag_suppress 1222
     62   // 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)
     63   #pragma diag_suppress 2527
     64   #pragma diag_suppress 2529
     65   #pragma diag_suppress 2651
     66   #pragma diag_suppress 2653
     67   #pragma diag_suppress 2668
     68   #pragma diag_suppress 2669
     69   #pragma diag_suppress 2670
     70   #pragma diag_suppress 2671
     71   #pragma diag_suppress 2735
     72   #pragma diag_suppress 2737
     73 #endif
     74 
     75 #endif // not EIGEN_WARNINGS_DISABLED
     76