W dniu 01.11.2018 o 15:33, Liu Hao pisze:
> 在 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?

I don't know.

If you compile with option
gcc -D__USE_MINGW_ANSI_STDIO ...
it will be set as 1, if you add line to source code
#define __USE_MINGW_ANSI_STDIO
it will be set as empty. It is easy for mistake and for me it should work
in mingw-w64 as 1 in both cases (and this patch do that).

Current code works OK for not defined __USE_MINGW_ANSI_STDIO and defined as 1.
Works wrong for defined as 0 -- stdio.h from line #223:
#if defined(__clang__)
#define __MINGW_PRINTF_FORMAT printf
#define __MINGW_SCANF_FORMAT  scanf
#elif defined(__USE_MINGW_ANSI_STDIO)
#define __MINGW_PRINTF_FORMAT gnu_printf
#define __MINGW_SCANF_FORMAT  gnu_scanf
#else
#define __MINGW_PRINTF_FORMAT ms_printf
#define __MINGW_SCANF_FORMAT  ms_scanf
#endif

It should be fixed anyway -- so we can fix it and simplify at once.

Regards,
Mateusz



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

Reply via email to