...

From 26774c66ae0298e1640e276f8fd50edc39e43874 Mon Sep 17 00:00:00 2001
From: Christian Franke <[email protected]>
Date: Fri, 13 Sep 2019 21:39:59 +0200
Subject: [PATCH 2/2] headers: _FORTIFY_SOURCE: Allow to disable usage of
 __builtin_va_arg_pack().

_FORTIFY_VA_ARG=0 disables inline functions with __builtin_va_arg_pack().
This allows _FORTIFY_SOURCE also in the rare case that the address of a
s*printf() function is used.

Signed-off-by: Christian Franke <[email protected]>
---
 mingw-w64-headers/crt/_mingw_mac.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mingw-w64-headers/crt/_mingw_mac.h 
b/mingw-w64-headers/crt/_mingw_mac.h
index 17f6d3c8..e380e265 100644
--- a/mingw-w64-headers/crt/_mingw_mac.h
+++ b/mingw-w64-headers/crt/_mingw_mac.h
@@ -341,7 +341,11 @@
 #  define __mingw_bos_ovr __mingw_ovr
 #endif /* __MINGW_FORTIFY_LEVEL > 0 */
 
-#if __MINGW_FORTIFY_LEVEL > 0 && __MINGW_GNUC_PREREQ(4, 3) && 
!defined(__clang__)
+/* If _FORTIFY_SOURCE is enabled, some inline functions may use
+   __builtin_va_arg_pack().  GCC may report an error if the address
+   of such a function is used.  Set _FORTIFY_VA_ARG=0 in this case.  */
+#if __MINGW_FORTIFY_LEVEL > 0 && __MINGW_GNUC_PREREQ(4, 3) && 
!defined(__clang__) \
+    && (!defined(_FORTIFY_VA_ARG) || _FORTIFY_VA_ARG > 0)
 #  define __MINGW_FORTIFY_VA_ARG 1
 #else
 #  define __MINGW_FORTIFY_VA_ARG 0
-- 
2.21.0

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to