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.
This commit is contained in:
Vadim Zeitlin
2020-08-30 20:58:30 +02:00
parent 266c3a962f
commit ca7fcfe9c3

View File

@@ -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() \