[libvirt] [RFC PATCH] build: avoid %zu in translated strings

Eric Blake eblake at redhat.com
Tue Aug 17 22:37:04 UTC 2010


On 08/17/2010 04:05 PM, Eric Blake wrote:
> Mingw64 lacks %zu, and has the unfortunate setup where
> sizeof(long)==4 but sizeof(size_t)==8.  Since gnulib's
> printf-posix module is not LGPLv2+, the best we can do
> is manually cast to the only portable int type known to
> hold size_t, and rely on gnulib's inttypes.h.
> 

> -                                 _("Failed to write %zu bytes to "
> +                                 _("Failed to write %" PRIuMAX " bytes to "

Hmmm.  Use of PRIuMAX in a translated string produces a .pot file that
refers to the special string <PRIuMAX>, and which requires the
need-formatstring-macros option passed to AM_GNU_GETTEXT in configure.ac
to be universally supported.  If I'm reading gettext.git history
correctly, need-formatstring-macros was added in gettext 0.11.4 (commit
8b45c5df), but had bugs until 0.17 (commit 4e34b2ac); which is newer
than the oldest version of gettext that libvirt is currently willing to
support.  I'm not sure if you get a fixed gettext.m4 by using just using
gnulib's gettext-h module, but using gnulib's gettext module is out of
the question since it would force the use of gettext 0.18.

Bruno, am I missing any details about how to properly use the gettext
formatstring-macros option, and which gettext versions are supported, if
I missed something in my sleuthing through gettext.git?

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100817/ec2576c5/attachment-0001.sig>


More information about the libvir-list mailing list