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: Pádraig Brady
Subject: Re: [PATCHv2 3/2] error: use correct printf attributes on mingw
Date: Wed, 27 May 2015 02:22:29 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 27/05/15 00:36, Eric Blake wrote:
> 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).

Thanks for these fixes, they look good.
The above adjustment would be a slight improvement,
though open coding isn't too onerous as yet.

cheers,
Pádraig



reply via email to

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