diff options
-rw-r--r-- | gdbsupport/enum-flags.h | 3 | ||||
-rw-r--r-- | include/diagnostics.h | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/gdbsupport/enum-flags.h b/gdbsupport/enum-flags.h index 700037f..41ac783 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<typename T> struct enum_underlying_type { + DIAGNOSTIC_PUSH + DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION typedef typename integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type type; + DIAGNOSTIC_POP }; namespace enum_flags_detail diff --git a/include/diagnostics.h b/include/diagnostics.h index d3ff27b..41e6db6 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 */ |