When compiling any application with flags under gcc 7+ with flags
-D__MINGW_INTRIN_INLINE -Wall -Wextra, it throws about 300 lines of
preprocessor warnings for __INTRINSIC_PROLOG usage:
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.
---
 mingw-w64-headers/include/psdk_inc/intrin-impl.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/mingw-w64-headers/include/psdk_inc/intrin-impl.h 
b/mingw-w64-headers/include/psdk_inc/intrin-impl.h
index b30e0404ba88..06bbbfe4f7df 100644
--- a/mingw-w64-headers/include/psdk_inc/intrin-impl.h
+++ b/mingw-w64-headers/include/psdk_inc/intrin-impl.h
@@ -67,6 +67,16 @@ __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.
+ */
+#if defined(__GNUC__) && __GNUC__ >= 7
+#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 +2299,10 @@ __build_writecr(__writecr8, unsigned __LONG32, "8")
 #undef __FLAGCLOBBER1
 #undef __FLAGCLOBBER2
 
+#if defined(__GNUC__) && __GNUC__ >= 7
+#pragma GCC diagnostic pop
+#endif
+
 #pragma pop_macro("__has_builtin")
 
 #endif /* __MINGW_INTRIN_INLINE */
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to