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. <file name="foo.c"> #define FOO foo #if (FOO + 0) == 0 #warning FOO is 0 #endif </file> $ 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