Cygwin's cygport now defaults to _FORTIFY_SOURCE=3 but the stable Cygwin
gcc is still 11.4.0 which does not support it. If Cygwin programs
include windows.h, this results in bogus warnings or broken builds if
-Werror is set. The attached patch fixes this.
--
Regards,
Christian
From 8af250ab394bc5785e4c53227cadc26370875956 Mon Sep 17 00:00:00 2001
From: Christian Franke <christian.fra...@t-online.de>
Date: Sun, 18 Feb 2024 19:24:01 +0100
Subject: [PATCH] Ignore _FORTIFY_SOURCE if __MINGW32__ is not defined
This prevents bogus warnings or build aborts (-Werror) if Windows
includes are used on Cygwin.
Signed-off-by: Christian Franke <christian.fra...@t-online.de>
---
mingw-w64-headers/crt/_mingw_mac.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mingw-w64-headers/crt/_mingw_mac.h
b/mingw-w64-headers/crt/_mingw_mac.h
index 4ea8c6687..0186eaf20 100644
--- a/mingw-w64-headers/crt/_mingw_mac.h
+++ b/mingw-w64-headers/crt/_mingw_mac.h
@@ -308,7 +308,8 @@
# define __has_builtin(x) 0
#endif
-#if _FORTIFY_SOURCE > 0 && __OPTIMIZE__ > 0 && __MINGW_GNUC_PREREQ(4, 1)
+#if defined(__MINGW32__) && _FORTIFY_SOURCE > 0 && __OPTIMIZE__ > 0 \
+ && __MINGW_GNUC_PREREQ(4, 1)
# if _FORTIFY_SOURCE > 3
# warning Using _FORTIFY_SOURCE=3 (levels > 3 are not supported)
# endif
--
2.43.0
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public