]> Savannah Git Hosting - gnulib.git/commit
stdio: fix use of PRIdMAX on modern mingw
authorEric Blake <eblake@redhat.com>
Mon, 5 Jan 2015 21:08:27 +0000 (14:08 -0700)
committerEric Blake <eblake@redhat.com>
Mon, 5 Jan 2015 23:32:05 +0000 (16:32 -0700)
commitca563b431be8c350dedab557044d8896fbf9d6ba
tree9968aa172c48ea6c6a2b9a7002d0cb9b66cb90d2
parent71fe7f2d3d9125170d7ba33412a7af6b25283a6a
stdio: fix use of PRIdMAX on modern mingw

Commit cf88e56ab broke the use of PRIdMAX and friends on modern
mingw64 installations.  Basically, when requesting
_USE_MINGW_ANSI_STDIO, not only does mingw turn on support for %lld,
it also rewrites <inttypes.h> to provide PRIdMAX as "lld" instead of
"I64d" (but only when <stdio.h> is also included).  But if a user is
NOT using the gnulib printf module, gnulib's <stdio.h> was still
giving printf() the system printf attribute, which causes the
compiler to then complain about an unknown %lld specifier, even though
we know we don't need to use the non-standard %I64d.  So this patch
adds a configure-time probe that should work with older gcc (which
does not differentiate between printf flavors) and older mingw (where
_USE_MINGW_ANSI_STDIO has no impact on behavior), while fixing the
mismatch in flavors on modern systems.

* m4/stdio_h.m4 (gl_STDIO_H): Probe for printf flavor via inttypes.
* lib/stdio.in.h (_GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM): Use result
to work with modern mingw.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
lib/stdio.in.h
m4/stdio_h.m4