From: Pali Rohár <pali.ro...@gmail.com> If the mingw-w64 headers are included in a way that doesn't mute warnings in system headers, this header causes lots of warnings like: warning: this use of "defined" may not be portable
It is caused by the fact that this macro __INTRINSIC_PROLOG uses non-portable Conditional inclusion (ISO WG14 N2176 (C17) 6.10.1/4). Disable this gcc warning via localized GCC pragmas to prevent 300 lines of warnings for every application. Signed-off-by: Martin Storsjö <mar...@martin.st> --- mingw-w64-headers/include/psdk_inc/intrin-impl.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mingw-w64-headers/include/psdk_inc/intrin-impl.h b/mingw-w64-headers/include/psdk_inc/intrin-impl.h index b30e0404b..16ccecc13 100644 --- a/mingw-w64-headers/include/psdk_inc/intrin-impl.h +++ b/mingw-w64-headers/include/psdk_inc/intrin-impl.h @@ -67,6 +67,17 @@ __INTRINSICS_USEINLINE #define __has_builtin(x) 0 #endif +/* + * Macro __INTRINSIC_PROLOG uses non-portable Conditional inclusion + * (ISO WG14 N2176 (C17) 6.10.1/4). Avoid gcc 7+ -Wexpansion-to-defined + * warning enabled by -W or -Wextra option. + * In Clang, this warning is enabled by -pedantic. + */ +#if defined(__GNUC__) && (__GNUC__ >= 7 || defined(__clang__)) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wexpansion-to-defined" +#endif + /* These macros are used by the routines below. While this file may be included multiple times, these macros only need to be defined once. */ #ifndef _INTRIN_MAC_ @@ -2289,6 +2300,10 @@ __build_writecr(__writecr8, unsigned __LONG32, "8") #undef __FLAGCLOBBER1 #undef __FLAGCLOBBER2 +#if defined(__GNUC__) && (__GNUC__ >= 7 || defined(__clang__)) +#pragma GCC diagnostic pop +#endif + #pragma pop_macro("__has_builtin") #endif /* __MINGW_INTRIN_INLINE */ -- 2.34.1 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public