Re: [Mingw-w64-public] [PATCH] Ignore _FORTIFY_SOURCE if __MINGW32__ is not defined

2024-02-21 Thread LIU Hao

在 2024-02-19 16:22, Christian Franke 写道:
It does no harm to define __MINGW_FORTIFY_LEVEL to 0 in the !__MINGW32__ case as done with the 
patch. Leaving it undefined would make no difference for Cygwin builds.


Yes, absolutely. The patch looks good to me. Pushed to master now. Thanks.


--
Best regards,
LIU Hao



OpenPGP_signature.asc
Description: OpenPGP digital signature
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH] Ignore _FORTIFY_SOURCE if __MINGW32__ is not defined

2024-02-19 Thread Christian Franke

LIU Hao wrote:

在 2024-02-19 15:56, Christian Franke 写道:
The __MINGW_FORTIFY_LEVEL set in _mingw_mac.h has no effect if a 
program including Win32 API headers like windows.h is compiled for 
Cygwin (same applies possibly to MSYS2). The __MINGW_FORTIFY_LEVEL 
only affects Libc includes which are not present in the Cygwin Win32 
API header package 
(https://cygwin.com/packages/summary/w32api-headers.html). Cygwin 
provides its own libc headers with different (and more limited) 
_FORTIFY_SOURCE support.


So the idea is that `__MINGW_FORTIFY_LEVEL` should only be defined 
when a user asks for the mingw-w64 CRT; in the case of Cygwin, 
mingw-w64 headers are included but the CRT is the Cygwin CRT, so it 
shouldn't be defined; is that right? The patch should be sensible. Let 
me have a look later.




It does no harm to define __MINGW_FORTIFY_LEVEL to 0 in the !__MINGW32__ 
case as done with the patch. Leaving it undefined would make no 
difference for Cygwin builds.





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


Re: [Mingw-w64-public] [PATCH] Ignore _FORTIFY_SOURCE if __MINGW32__ is not defined

2024-02-19 Thread LIU Hao

在 2024-02-19 15:56, Christian Franke 写道:
The __MINGW_FORTIFY_LEVEL set in _mingw_mac.h has no effect if a program including Win32 API headers 
like windows.h is compiled for Cygwin (same applies possibly to MSYS2). The __MINGW_FORTIFY_LEVEL 
only affects Libc includes which are not present in the Cygwin Win32 API header package 
(https://cygwin.com/packages/summary/w32api-headers.html). Cygwin provides its own libc headers with 
different (and more limited) _FORTIFY_SOURCE support.


So the idea is that `__MINGW_FORTIFY_LEVEL` should only be defined when a user asks for the 
mingw-w64 CRT; in the case of Cygwin, mingw-w64 headers are included but the CRT is the Cygwin CRT, 
so it shouldn't be defined; is that right? The patch should be sensible. Let me have a look later.




--
Best regards,
LIU Hao



OpenPGP_signature.asc
Description: OpenPGP digital signature
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH] Ignore _FORTIFY_SOURCE if __MINGW32__ is not defined

2024-02-18 Thread Christian Franke

LIU Hao wrote:

在 2024-02-19 02:31, Christian Franke 写道:
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.


Well, how about removing that warning, so `_FORTIFY_SOURCE=3` should 
be equivalent to `2` instead of `0`?




The __MINGW_FORTIFY_LEVEL set in _mingw_mac.h has no effect if a program 
including Win32 API headers like windows.h is compiled for Cygwin (same 
applies possibly to MSYS2). The __MINGW_FORTIFY_LEVEL only affects Libc 
includes which are not present in the Cygwin Win32 API header package 
(https://cygwin.com/packages/summary/w32api-headers.html). Cygwin 
provides its own libc headers with different (and more limited) 
_FORTIFY_SOURCE support.


--
Regards,
Christian



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


Re: [Mingw-w64-public] [PATCH] Ignore _FORTIFY_SOURCE if __MINGW32__ is not defined

2024-02-18 Thread LIU Hao

在 2024-02-19 02:31, Christian Franke 写道:
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.


Well, how about removing that warning, so `_FORTIFY_SOURCE=3` should be equivalent to `2` instead of 
`0`?



--
Best regards,
LIU Hao



OpenPGP_signature.asc
Description: OpenPGP digital signature
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public