Re: [Mingw-w64-public] [PATCH] Always define __USE_MINGW_ANSI_STDIO as 0 or 1 in _mingw.h
在 2018/11/1 22:53, Ozkan Sezer 写道: >> Are there any existent projects where `__USE_MINGW_ANSI_STDIO` is >> defined as something other than `0` or `1`, if it is defined at all, >> including empty? > > That would be a bug, and I'd recommend applying this patch. > > Just in case, you guys should check documentation (wiki, etc) > and clarify as necessary. > > There is a page on our wiki [1] which doesn't mention the behavior when it is defined as anything other than a literal `1`. [1] https://sourceforge.net/p/mingw-w64/wiki2/printf%20and%20scanf%20family/ -- Best regards, LH_Mouse 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] inttypes.h: Take into account __USE_MINGW_ANSI_STDIO and msvcrt version instead of depending on _mingw_print_p*.h headers.
在 2018/11/2 5:31, Jacek Caban 写道: > The patch changes configure.ac, so you need to run autoconf after > applying it. > This patch looks good to me. -- Best regards, LH_Mouse 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] inttypes.h: Take into account __USE_MINGW_ANSI_STDIO and msvcrt version instead of depending on _mingw_print_p*.h headers.
On 01/11/2018 21:35, Mateusz wrote: W dniu 31.10.2018 o 20:12, Jacek Caban pisze: make all-am make[1]: Entering directory '/home/ma/m/build/bc_m64_head' make[1]: *** No rule to make target 'crt/_mingw_print_push.h', needed by 'all-am'. Stop. make[1]: Leaving directory '/home/ma/m/build/bc_m64_head' Makefile:542: recipe for target 'all' failed make: *** [all] Error 2 Should I do something special to test this patch? The patch changes configure.ac, so you need to run autoconf after applying it. Jacek ___ 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] Always define __USE_MINGW_ANSI_STDIO as 0 or 1 in _mingw.h
On 11/1/2018 1:22 PM, Mateusz wrote: > W dniu 01.11.2018 o 16:06, Earnie via Mingw-w64-public pisze: >> On 11/1/2018 10:53 AM, Earnie wrote: >>> >>> >>> On 11/1/2018 10:33 AM, Liu Hao wrote: 在 2018/11/1 9:52, Mateusz 写道: > During discussion about inttypes I realized that we check (in header > files) if > __USE_MINGW_ANSI_STDIO is active in non consistent way: > #if defined(__USE_MINGW_ANSI_STDIO) && ((__USE_MINGW_ANSI_STDIO + 0) != 0) > #elif defined(__USE_MINGW_ANSI_STDIO) > #if !defined (__USE_MINGW_ANSI_STDIO) || __USE_MINGW_ANSI_STDIO == 0 > > Attached patch simplified checking if __USE_MINGW_ANSI_STDIO is active -- > it > always define __USE_MINGW_ANSI_STDIO to 0 or 1 in _mingw.h so now it > should be > simple: > #if __USE_MINGW_ANSI_STDIO /* active */ > #if __USE_MINGW_ANSI_STDIO == 0 /* not active */ > > Please review. > Are there any existent projects where `__USE_MINGW_ANSI_STDIO` is defined as something other than `0` or `1`, if it is defined at all, including empty? >>> >>> If by `empty' you mean `#define FOO` as being empty the value is >>> actually 1. If __USE_MINGW_ANSI_STDIO is set to some unexpected value >>> then _mingw.h could handle it and set to the standard value of 1 or give >>> a #error (maybe best). >> >> If __USE_MINGW_ANSI_STDIO is defined but not numeric adding 0 results in >> a value of 0. The patch to _mingw.h needs to check defined and set the >> value to 1. >> >> >> #define FOO foo >> #if (FOO + 0) == 0 >> #warning FOO is 0 >> #endif >> >> >> $ gcc -c foo.c >> foo.c:3:2: warning: #warning FOO is 0 [-Wcpp] >> #warning FOO is 0 > > Yes, if you compile > gcc -D__USE_MINGW_ANSI_STDIO=foo ... > it will be set to 0. > > It is technically complicated to handle 'foo' case different than 0. > If you know the trick, please share. True too tricky to be worth anything specific. Maybe the easiest is to just ``` #ifdef __USE_MINGW_ANSI_STDIO #undef __USE_MINGW_ANSI_STDIO #define __USE_MINGW_ANSI_STDIO 1 #else #define __USE_MINGW_ANSI_STDIO 0 #endif ``` I know this is an issue for those who `gcc -D__USE_MINGW_ANSI_STDIO=0` but it's easy enough to use `gcc -U__USE_MINGW_ANSI_STDIO` instead. In any event, your patch is good to me as well. -- Earnie ___ 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] inttypes.h: Take into account __USE_MINGW_ANSI_STDIO and msvcrt version instead of depending on _mingw_print_p*.h headers.
W dniu 31.10.2018 o 20:12, Jacek Caban pisze: > We had a discussion about it and I'd like to get it back to the patch. I > tested it some more and I think it's ready. Please review the patch. > > There was a concern that applications might define > __USE_MINGW_ANSI_STDIO but instead of including stdio.h obtaining a > declaration in another way, ending up calling msvcrt.dll with invalid > arguments. While such case is questionable by itself, it matters only on > XP in practice. > > This patch cleans up the code and makes PRI*64 definitions more > consistent. It also uses C99 values for ucrt builds. > > --- > mingw-w64-headers/configure.ac| 2 +- > mingw-w64-headers/crt/_mingw_print_pop.h | 136 -- > mingw-w64-headers/crt/_mingw_print_push.h | 136 -- > mingw-w64-headers/crt/inttypes.h | 129 ++-- > mingw-w64-headers/crt/stdio.h | 4 - > mingw-w64-headers/crt/wchar.h | 3 - > mingw-w64-headers/include/wspiapi.h | 4 - > 7 files changed, 65 insertions(+), 349 deletions(-) > delete mode 100644 mingw-w64-headers/crt/_mingw_print_pop.h > delete mode 100644 mingw-w64-headers/crt/_mingw_print_push.h I have some problems with this patch. It doesn't apply cleanly on my system: ma@ma-VirtualBox:~/m/source/mingw-w64-v7$ patch -p1 <../01.diff (Stripping trailing CRs from patch; use --binary to disable.) patching file mingw-w64-headers/configure.ac (Stripping trailing CRs from patch; use --binary to disable.) patching file mingw-w64-headers/crt/_mingw_print_pop.h ... I can't compile cross compiler with this patch: + /home/ma/m/source/mingw-w64-v7/mingw-w64-headers/configure --host=x86_64-w64-mingw32 --prefix=/home/ma/m/cross/x86_64-w64-mingw32 checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for x86_64-w64-mingw32-strip... no checking for strip... strip checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether to enable maintainer-specific portions of Makefiles... no checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-w64-mingw32 checking for a sed that does not truncate output... /bin/sed checking whether to rebuild headers with widl... no checking whether to build a w32api package for Cygwin... no checking for c-runtime headers... yes checking for optional sdk headers... ddk,directx checking if installing idl files is enabled... no checking whether to enable the secure API... no checking default _WIN32_WINNT version... 0x502 checking default msvcrt... msvcrt (0x700) checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating crt/_mingw.h config.status: creating config.h + make make all-am make[1]: Entering directory '/home/ma/m/build/bc_m64_head' make[1]: *** No rule to make target 'crt/_mingw_print_push.h', needed by 'all-am'. Stop. make[1]: Leaving directory '/home/ma/m/build/bc_m64_head' Makefile:542: recipe for target 'all' failed make: *** [all] Error 2 Should I do something special to test this patch? Regards, Mateusz ___ 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] Always define __USE_MINGW_ANSI_STDIO as 0 or 1 in _mingw.h
W dniu 01.11.2018 o 16:06, Earnie via Mingw-w64-public pisze: > On 11/1/2018 10:53 AM, Earnie wrote: >> >> >> On 11/1/2018 10:33 AM, Liu Hao wrote: >>> 在 2018/11/1 9:52, Mateusz 写道: During discussion about inttypes I realized that we check (in header files) if __USE_MINGW_ANSI_STDIO is active in non consistent way: #if defined(__USE_MINGW_ANSI_STDIO) && ((__USE_MINGW_ANSI_STDIO + 0) != 0) #elif defined(__USE_MINGW_ANSI_STDIO) #if !defined (__USE_MINGW_ANSI_STDIO) || __USE_MINGW_ANSI_STDIO == 0 Attached patch simplified checking if __USE_MINGW_ANSI_STDIO is active -- it always define __USE_MINGW_ANSI_STDIO to 0 or 1 in _mingw.h so now it should be simple: #if __USE_MINGW_ANSI_STDIO /* active */ #if __USE_MINGW_ANSI_STDIO == 0 /* not active */ Please review. >>> >>> Are there any existent projects where `__USE_MINGW_ANSI_STDIO` is >>> defined as something other than `0` or `1`, if it is defined at all, >>> including empty? >> >> If by `empty' you mean `#define FOO` as being empty the value is >> actually 1. If __USE_MINGW_ANSI_STDIO is set to some unexpected value >> then _mingw.h could handle it and set to the standard value of 1 or give >> a #error (maybe best). > > If __USE_MINGW_ANSI_STDIO is defined but not numeric adding 0 results in > a value of 0. The patch to _mingw.h needs to check defined and set the > value to 1. > > > #define FOO foo > #if (FOO + 0) == 0 > #warning FOO is 0 > #endif > > > $ gcc -c foo.c > foo.c:3:2: warning: #warning FOO is 0 [-Wcpp] > #warning FOO is 0 Yes, if you compile gcc -D__USE_MINGW_ANSI_STDIO=foo ... it will be set to 0. It is technically complicated to handle 'foo' case different than 0. If you know the trick, please share. Regards, Mateusz ___ 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] Always define __USE_MINGW_ANSI_STDIO as 0 or 1 in _mingw.h
On 11/1/2018 10:53 AM, Earnie wrote: > > > On 11/1/2018 10:33 AM, Liu Hao wrote: >> 在 2018/11/1 9:52, Mateusz 写道: >>> During discussion about inttypes I realized that we check (in header files) >>> if >>> __USE_MINGW_ANSI_STDIO is active in non consistent way: >>> #if defined(__USE_MINGW_ANSI_STDIO) && ((__USE_MINGW_ANSI_STDIO + 0) != 0) >>> #elif defined(__USE_MINGW_ANSI_STDIO) >>> #if !defined (__USE_MINGW_ANSI_STDIO) || __USE_MINGW_ANSI_STDIO == 0 >>> >>> Attached patch simplified checking if __USE_MINGW_ANSI_STDIO is active -- it >>> always define __USE_MINGW_ANSI_STDIO to 0 or 1 in _mingw.h so now it should >>> be >>> simple: >>> #if __USE_MINGW_ANSI_STDIO /* active */ >>> #if __USE_MINGW_ANSI_STDIO == 0 /* not active */ >>> >>> Please review. >>> >> >> Are there any existent projects where `__USE_MINGW_ANSI_STDIO` is >> defined as something other than `0` or `1`, if it is defined at all, >> including empty? > > If by `empty' you mean `#define FOO` as being empty the value is > actually 1. If __USE_MINGW_ANSI_STDIO is set to some unexpected value > then _mingw.h could handle it and set to the standard value of 1 or give > a #error (maybe best). If __USE_MINGW_ANSI_STDIO is defined but not numeric adding 0 results in a value of 0. The patch to _mingw.h needs to check defined and set the value to 1. #define FOO foo #if (FOO + 0) == 0 #warning FOO is 0 #endif $ gcc -c foo.c foo.c:3:2: warning: #warning FOO is 0 [-Wcpp] #warning FOO is 0 -- Earnie ___ 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] Always define __USE_MINGW_ANSI_STDIO as 0 or 1 in _mingw.h
On 11/1/2018 10:33 AM, Liu Hao wrote: > 在 2018/11/1 9:52, Mateusz 写道: >> During discussion about inttypes I realized that we check (in header files) >> if >> __USE_MINGW_ANSI_STDIO is active in non consistent way: >> #if defined(__USE_MINGW_ANSI_STDIO) && ((__USE_MINGW_ANSI_STDIO + 0) != 0) >> #elif defined(__USE_MINGW_ANSI_STDIO) >> #if !defined (__USE_MINGW_ANSI_STDIO) || __USE_MINGW_ANSI_STDIO == 0 >> >> Attached patch simplified checking if __USE_MINGW_ANSI_STDIO is active -- it >> always define __USE_MINGW_ANSI_STDIO to 0 or 1 in _mingw.h so now it should >> be >> simple: >> #if __USE_MINGW_ANSI_STDIO /* active */ >> #if __USE_MINGW_ANSI_STDIO == 0 /* not active */ >> >> Please review. >> > > Are there any existent projects where `__USE_MINGW_ANSI_STDIO` is > defined as something other than `0` or `1`, if it is defined at all, > including empty? If by `empty' you mean `#define FOO` as being empty the value is actually 1. If __USE_MINGW_ANSI_STDIO is set to some unexpected value then _mingw.h could handle it and set to the standard value of 1 or give a #error (maybe best). -- Earnie ___ 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] Always define __USE_MINGW_ANSI_STDIO as 0 or 1 in _mingw.h
在 2018/11/1 9:52, Mateusz 写道: > During discussion about inttypes I realized that we check (in header files) if > __USE_MINGW_ANSI_STDIO is active in non consistent way: > #if defined(__USE_MINGW_ANSI_STDIO) && ((__USE_MINGW_ANSI_STDIO + 0) != 0) > #elif defined(__USE_MINGW_ANSI_STDIO) > #if !defined (__USE_MINGW_ANSI_STDIO) || __USE_MINGW_ANSI_STDIO == 0 > > Attached patch simplified checking if __USE_MINGW_ANSI_STDIO is active -- it > always define __USE_MINGW_ANSI_STDIO to 0 or 1 in _mingw.h so now it should be > simple: > #if __USE_MINGW_ANSI_STDIO /* active */ > #if __USE_MINGW_ANSI_STDIO == 0 /* not active */ > > Please review. > Are there any existent projects where `__USE_MINGW_ANSI_STDIO` is defined as something other than `0` or `1`, if it is defined at all, including empty? -- Best regards, LH_Mouse 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] winternl.h: Added PUBLIC_OBJECT_TYPE_INFORMATION declaration.
On 11/01/2018 12:13 PM, Jacek Caban wrote: > Signed-off-by: Jacek Caban > --- > mingw-w64-headers/include/winternl.h | 5 + > 1 file changed, 5 insertions(+) > Patch looks good to me, resent (last email went out with the wrong address). 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] Always define __USE_MINGW_ANSI_STDIO as 0 or 1 in _mingw.h
On 11/01/2018 01:52 AM, Mateusz wrote: > During discussion about inttypes I realized that we check (in header files) if > __USE_MINGW_ANSI_STDIO is active in non consistent way: > #if defined(__USE_MINGW_ANSI_STDIO) && ((__USE_MINGW_ANSI_STDIO + 0) != 0) > #elif defined(__USE_MINGW_ANSI_STDIO) > #if !defined (__USE_MINGW_ANSI_STDIO) || __USE_MINGW_ANSI_STDIO == 0 > > Attached patch simplified checking if __USE_MINGW_ANSI_STDIO is active -- it > always define __USE_MINGW_ANSI_STDIO to 0 or 1 in _mingw.h so now it should be > simple: > #if __USE_MINGW_ANSI_STDIO /* active */ > #if __USE_MINGW_ANSI_STDIO == 0 /* not active */ > > Please review. > > Regards, > Mateusz > Patch looks good to me. 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] winternl.h: Added PUBLIC_OBJECT_TYPE_INFORMATION declaration.
On 11/01/2018 12:13 PM, Jacek Caban wrote: > Signed-off-by: Jacek Caban > --- > mingw-w64-headers/include/winternl.h | 5 + > 1 file changed, 5 insertions(+) > Patch looks good to me. 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