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 <ebl...@redhat.com> >> --- >> > >> +/* 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