Improve clang warning suppressions by checking if warning is supported

This commit is contained in:
Sean McBride 2022-01-21 00:27:43 +00:00 committed by Rasmus Munk Larsen
parent fb05198bdd
commit c454b8c813

View File

@ -36,22 +36,25 @@
#pragma warning disable 2196 279 1684 2259 #pragma warning disable 2196 279 1684 2259
#elif defined __clang__ #elif defined __clang__
// -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant
// this is really a stupid warning as it warns on compile-time expressions involving enums
#ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
#pragma clang diagnostic push #pragma clang diagnostic push
#endif #endif
#pragma clang diagnostic ignored "-Wconstant-logical-operand" #if defined(__has_warning)
#if __clang_major__ >= 3 && __clang_minor__ >= 5 // -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant
#pragma clang diagnostic ignored "-Wabsolute-value" // this is really a stupid warning as it warns on compile-time expressions involving enums
#endif #if __has_warning("-Wconstant-logical-operand")
#if __clang_major__ >= 10 #pragma clang diagnostic ignored "-Wconstant-logical-operand"
#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" #endif
#endif #if __has_warning("-Wimplicit-int-float-conversion")
#if ( defined(__ALTIVEC__) || defined(__VSX__) ) && __cplusplus < 201103L #pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"
// warning: generic selections are a C11-specific feature #endif
// ignoring warnings thrown at vec_ctf in Altivec/PacketMath.h #if ( defined(__ALTIVEC__) || defined(__VSX__) ) && __cplusplus < 201103L
#pragma clang diagnostic ignored "-Wc11-extensions" // warning: generic selections are a C11-specific feature
// ignoring warnings thrown at vec_ctf in Altivec/PacketMath.h
#if __has_warning("-Wc11-extensions")
#pragma clang diagnostic ignored "-Wc11-extensions"
#endif
#endif
#endif #endif
#elif defined __GNUC__ && !defined(__FUJITSU) #elif defined __GNUC__ && !defined(__FUJITSU)