diff --git a/gdbsupport/enum-flags.h b/gdbsupport/enum-flags.h index 440ffe09734..947d4773052 100644 --- a/gdbsupport/enum-flags.h +++ b/gdbsupport/enum-flags.h @@ -91,9 +91,12 @@ template<> struct integer_for_size<8, 1> { typedef int64_t type; }; template struct enum_underlying_type { + DIAGNOSTIC_PUSH + DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION typedef typename integer_for_size(T (-1) < T (0))>::type type; + DIAGNOSTIC_POP }; namespace enum_flags_detail diff --git a/include/diagnostics.h b/include/diagnostics.h index 3a75f4e2719..c164e7bd9f4 100644 --- a/include/diagnostics.h +++ b/include/diagnostics.h @@ -76,6 +76,11 @@ # define DIAGNOSTIC_ERROR_SWITCH \ DIAGNOSTIC_ERROR ("-Wswitch") +# if __has_warning ("-Wenum-constexpr-conversion") +# define DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION \ + DIAGNOSTIC_IGNORE ("-Wenum-constexpr-conversion") +# endif + #elif defined (__GNUC__) /* GCC */ # define DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS \ @@ -155,4 +160,8 @@ # define DIAGNOSTIC_ERROR_SWITCH #endif +#ifndef DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION +# define DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION +#endif + #endif /* DIAGNOSTICS_H */