bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCHv2 3/2] error: use correct printf attributes on mingw


From: Eric Blake
Subject: Re: [PATCHv2 3/2] error: use correct printf attributes on mingw
Date: Tue, 26 May 2015 17:36:37 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 05/26/2015 05:32 PM, Eric Blake wrote:
> Now that we always turn on __USE_MINGW_ANSI_STDIO when extensions
> are in use, we need to replicate the same logic in error.h as
> we have in stdio.h, for selecting the correct format string that
> will squelch gcc -Wformat=2 warnings.
> 
> Reported by Assaf Gordon.
> 
> * lib/stdio.in.h (_GL_ATTRIBUTE_SPEC_PRINTF): New define.
> 
> Signed-off-by: Eric Blake <address@hidden>
> ---
> 

> +/* On mingw, the flavor of printf depends on whether the extensions module
> + * is in use; the check for <stdio.h> determines the witness macro.  */
> +#ifndef _GL_ATTRIBUTE_SPEC_PRINTF
> +# if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU && \
> +  (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
> +#  define _GL_ATTRIBUTE_SPEC_PRINTF __gnu_printf__
> +# else
> +#  define _GL_ATTRIBUTE_SPEC_PRINTF __printf__
> +# endif

This is a little hairy - I wonder if m4/stdio_h.m4 should be tweaked to
guarantee that GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU is only defined for
gcc 4.4 and newer (that is, gcc new enough to understand __gnu_printf__)
rather than open-coding it into all users (now stdio.in.h and error.h).

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