bug-gnulib
[Top][All Lists]
Advanced

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

Re: Portable printing of 'size_t' (especially with mingw for windows)


From: Eric Blake
Subject: Re: Portable printing of 'size_t' (especially with mingw for windows)
Date: Thu, 11 Sep 2014 09:39:19 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0

On 09/11/2014 09:28 AM, Assaf Gordon wrote:
> Hello,
> 
> I'm not sure if this is a gnulib question per-se, but I'm hopeful you
> could perhaps advise me.

gnulib has overrides for the various printf() family of functions, which
correctly parse %zu on mingw.  But pulling those in can be rather
heavyweight, especially since the modules right now are GPLv3 and fix a
lot more than just %zu (such as %A).  At one point, I wanted to
introduce a simpler LGPLv2+ fprintf module that JUST fixes the bare
minimum of the simple stuff like %zu, without dragging in the bloat and
GPL restrictions of %A; but I haven't had a reason to pursue it further.


> 
> Note that if this had been a "printf" function call, then compiling with
> 
>     CFLAGS=-D__USE_MINGW_ANSI_STDIO=1
> 
> Would have 'fixed' it (or at least worked around it) by substituting
> 'printf' with the internal '__mingw_printf' .
> But because this is 'error()' from gnulib, it is not replaces and
> therefore triggers this error.

If nothing else, this argues that maybe we should be attaching attribute
__gnu_printf__ instead of plain __printf__ to error() (or even
__ms_printf__ if we can prove %Iu is needed for your system, although
that feels a bit dirtier), at least if we can prove we are in a
situation where %zu works (such as when __USE_MINGW_ANSI_STDIO is non-zero).

-- 
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]