bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] stdio: fix probe on mingw under gcc 5.1


From: Eric Blake
Subject: Re: [PATCH] stdio: fix probe on mingw under gcc 5.1
Date: Tue, 26 May 2015 14:21:03 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 05/26/2015 01:49 PM, Assaf Gordon wrote:
> Hello,
> 
> I'm encountering a similar/related issue with PRIdMAX on mingw32-gcc 4.8.2.
> 
> In short, when using gnulib in my project and cross-compiling with
> mingw32-gcc 4.8.2
> somehow the PRIdMAX becomes "lld" instead of "I64d".

That somehow is that gnulib is unconditionally turning on
__USE_MINGW_ANSI_STDIO, which tells mingw to stick in its own printf
that understands "lld" instead of Window's "I64d".


> -1-
> The system is Ubuntu 14.04.2, with mingw from the standard package.
> 
>     $ dpkg -l gcc-mingw-w64-x86-64
>     ii  gcc-mingw-w64-x86-64 4.8.2-10ubuntu2 amd64           GNU C
> compiler for MinGW-w64 targeting Win64
>     $ x86_64-w64-mingw32-gcc -v
>     gcc version 4.8.2 (GCC)

Okay, so that's a version of mingw new enough to honor
__USE_MINGW_ANSI_STDIO, and a version of gcc old enough that the
existing probe in m4/stdio_h.m4 should be detecting that "lld" is supported.

> 
> -2-
> Checking a simple C file without gnulib, PRIdMAX is correctly defined as
> "I64d":

Without gnulib, "I64d" is correct, since you didn't specify
__USE_MINGW_ANSI_STDIO yourself.

> 
> -3-
> Checking with gnulib's internal tests, PRIdMAX is still correct:
> 
>     # Create unit-tests for 'inttypes' module
>     git clone git://git.sv.gnu.org/gnulib.git
>     cd gnulib/
>     ./gnulib-tool --create-testdir --dir foo inttypes
>     cd foo
> 
>     # add the compile-time check
>     sed -i '/return 0/ichar PRIdMAX_is_I64d[sizeof PRIdMAX == sizeof
> "I64d" ? 1 : -1];' gltests/test-inttypes.c
>     ./configure --host=x86_64-w64-mingw32
>     make
>     ## (no compilation errors)

Hmm - the gnulib override to turn on __USE_MINGW_ANSI_STDIO lives in
<config.h> as part of the 'extensions' module, so it should be on at
this point, and you _should_ be seeing "lld".  Is this a case of the
configure test guessing wrong?

Oh, maybe I see it - the 'inttypes' module does NOT require the
'extensions' module.  But based on this argument, it should.

> -4-
> However,
> Adding the same check to a 'real' project which uses gnulib (GNU Hello),
> somehow PRIdMAX is reverted to "lld".
> Perhaps some other headers are missing or additional gnulib modules are
> needed?

Thanks for the hint - yes, the moment you pull in an additional module
that requires 'extensions', then PRIdMAX should be converted to "lld";
therefore, inttypes should pull in extensions.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]