From ca7fcfe9c3fe7f2c1944ba6beb1d21d2de5047cb Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Aug 2020 20:58:30 +0200 Subject: [PATCH] Add wxGCC_ONLY_WARNING_{SUPPRESS,RESTORE} macros When the original wxGCC_WARNING_SUPPRESS was added, clang understood all gcc warnings, so it made sense to also apply it when building with clang, but recent gcc versions have added warnings not available in clang any more, so we now need a macro for disabling warning the warnings for gcc only. Perhaps we should rename the existing wxGCC_XXX macros to use wxGCC_OR_CLANG prefix. --- include/wx/defs.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/wx/defs.h b/include/wx/defs.h index 804e828b74..cb1d495b80 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -662,6 +662,9 @@ typedef short int WXTYPE; wxGCC_WARNING_SUPPRESS(float-equal) inline bool wxIsSameDouble(double x, double y) { return x == y; } wxGCC_WARNING_RESTORE(float-equal) + + Note that these macros apply to both gcc and clang, even though they only + have "GCC" in their names. */ #if defined(__clang__) || wxCHECK_GCC_VERSION(4, 6) # define wxGCC_WARNING_SUPPRESS(x) \ @@ -674,6 +677,17 @@ typedef short int WXTYPE; # define wxGCC_WARNING_RESTORE(x) #endif +/* + Similar macros but for gcc-specific warnings. + */ +#ifdef __GNUC__ +# define wxGCC_ONLY_WARNING_SUPPRESS(x) wxGCC_WARNING_SUPPRESS(x) +# define wxGCC_ONLY_WARNING_RESTORE(x) wxGCC_WARNING_RESTORE(x) +#else +# define wxGCC_ONLY_WARNING_SUPPRESS(x) +# define wxGCC_ONLY_WARNING_RESTORE(x) +#endif + /* Specific macros for -Wcast-function-type warning new in gcc 8. */ #if wxCHECK_GCC_VERSION(8, 0) #define wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE() \