skip handling -Wno-old-style-cast on old gcc compilers

This commit is contained in:
Felipe Lema 2019-05-09 13:58:38 -04:00
parent 1e76f587d9
commit b585c76ae7

12
enum.h
View File

@ -14,16 +14,20 @@
#include <stdexcept> #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 __GNUC__
# ifdef __clang__ # ifdef __clang__
# define BETTER_ENUMS_IGNORE_OLD_CAST_HEADER _Pragma("clang diagnostic push") # 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_BEGIN _Pragma("clang diagnostic ignored \"-Wold-style-cast\"")
# define BETTER_ENUMS_IGNORE_OLD_CAST_END _Pragma("clang diagnostic pop") # define BETTER_ENUMS_IGNORE_OLD_CAST_END _Pragma("clang diagnostic pop")
# else # else
# define BETTER_ENUMS_IGNORE_OLD_CAST_HEADER _Pragma("GCC diagnostic push") # define BETTER_ENUMS_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)
# define BETTER_ENUMS_IGNORE_OLD_CAST_BEGIN _Pragma("GCC diagnostic ignored \"-Wold-style-cast\"") # if BETTER_ENUMS_GCC_VERSION > 40400
# define BETTER_ENUMS_IGNORE_OLD_CAST_END _Pragma("GCC diagnostic pop") # 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
#endif #endif
// msvc does not recognize `_Pragma` // msvc does not recognize `_Pragma`