mingw-w64 and __attribute__((format(printf))) issue

Liu Hao lh_mouse@126.com
Tue May 12 13:15:17 GMT 2020


在 2020/5/12 20:02, Jakub Jelinek 写道:
> 
> gomp_fatal etc. call vfprintf under the hood though, does that one handle
> %llu on mingw?  If not, using %llu for the PRI* macros looks wrong to me.
> 

As long as libgomp doesn't enable `__USE_MINGW_ANSI_STDIO`, the answer
is a bit complex:

0) With all versions of mingw-w64 (probably MinGW.org too) that have
   been released, the MS `vfprintf()` is called; see below.

1) With current master of mingw-w64, and:

   a) -std={gnu,c}89, or
      -std={gnu,c}++03: Ditto; see below.

   b) -std={gnu,c}99, or
      -std={gnu,c}++11: The mingw-w64 one is called,
                        so it is always supported.

2) If stdio.h is not included (the user declares this function
   themselves, e.g. during configure checks), then the MS one is called;
   see below.


About the behavior of MS `vfprintf()`:

0) On Windows 7 (probably Vista and 2008, untested), *printf functions
   from MSVCRT do accept `%llu`, so it's valid despite the warning.

1) On Windows XP (probably also 2003, untested), `%lld` is not
   recognized.

-- 
Best regards,
LH_Mouse

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20200512/37dac076/attachment.sig>


More information about the Gcc-help mailing list