mirror of
https://github.com/aantron/better-enums.git
synced 2025-12-06 16:56:42 +08:00
skip handling -Wno-old-style-cast on old gcc compilers
This commit is contained in:
parent
1e76f587d9
commit
b585c76ae7
12
enum.h
12
enum.h
@ -14,16 +14,20 @@
|
||||
#include <stdexcept>
|
||||
|
||||
|
||||
// in-line warning handling
|
||||
// in-line, non-#pragma warning handling
|
||||
// not supported in very old compilers (namely gcc 4.4 or less)
|
||||
#ifdef __GNUC__
|
||||
# ifdef __clang__
|
||||
# define BETTER_ENUMS_IGNORE_OLD_CAST_HEADER _Pragma("clang diagnostic push")
|
||||
# define BETTER_ENUMS_IGNORE_OLD_CAST_BEGIN _Pragma("clang diagnostic ignored \"-Wold-style-cast\"")
|
||||
# define BETTER_ENUMS_IGNORE_OLD_CAST_END _Pragma("clang diagnostic pop")
|
||||
# else
|
||||
# define BETTER_ENUMS_IGNORE_OLD_CAST_HEADER _Pragma("GCC diagnostic push")
|
||||
# define BETTER_ENUMS_IGNORE_OLD_CAST_BEGIN _Pragma("GCC diagnostic ignored \"-Wold-style-cast\"")
|
||||
# define BETTER_ENUMS_IGNORE_OLD_CAST_END _Pragma("GCC diagnostic pop")
|
||||
# define BETTER_ENUMS_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)
|
||||
# if BETTER_ENUMS_GCC_VERSION > 40400
|
||||
# define BETTER_ENUMS_IGNORE_OLD_CAST_HEADER _Pragma("GCC diagnostic push")
|
||||
# define BETTER_ENUMS_IGNORE_OLD_CAST_BEGIN _Pragma("GCC diagnostic ignored \"-Wold-style-cast\"")
|
||||
# define BETTER_ENUMS_IGNORE_OLD_CAST_END _Pragma("GCC diagnostic pop")
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
// msvc does not recognize `_Pragma`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user