gccmacro: Disable printf-like format checking on mingw32 compilers.

Am 23.10.2012 08:25, schrieb Arun Raghavan:
> On Tue, 2012-08-21 at 13:32 +0200, Thomas Martitz wrote:
>> Am 21.08.2012 08:51, schrieb Rémi Denis-Courmont:
>>> Le mardi 21 août 2012 00:50:34 Thomas Martitz, vous avez écrit :
>>>> There are tons of warnings, most of them because the function is not
>>>> recognized as printf-like.
>>> Removing checks looks very fishy.
>>>
>>> To use C99 and/or GNU format specifiers on MingW, you need to use the
>>> gnuprintf attribute instead of printf. With printf, the format string is
>>> validated according to the antiquated MSVC rules.
>>>
>> Interesting, I didn't know about gnuprintf. FWIW, what are those
>> antiquated MSVC rules? I assumed the return value which isn't int for
>> some affected functions?
> Is this one going to be respun?
>

Yes, here you go.

>From c5f15eec69bf95c9a1261e0d82abbd039156e75e Mon Sep 17 00:00:00 2001
From: Thomas Martitz <kuge@rockbox.org>
Date: Wed, 8 Aug 2012 17:38:04 +0200
Subject: [PATCH 1/3] gccmacro: Work around warnings due to printf redirection
 by libintl.

Libintl defines printf as libintl_printf, which breaks the format
attribue. Unfortunately the workaround around provided by libintl
is only enabled for cygwin, but not for mingw builds. Therefore
install the workaround manually.
This commit is contained in:
Thomas Martitz 2012-10-23 12:10:45 +02:00 committed by Arun Raghavan
parent bb038f76af
commit b1303e6d92

View file

@ -25,8 +25,15 @@
/** \file
* GCC attribute macros */
#ifdef __GNUC__
#if defined(__GNUC__)
#ifdef __MINGW32__
/* libintl overrides printf with a #define. As this breaks this attribute,
* it has a workaround. However the workaround isn't enabled for MINGW
* builds (only cygwin) */
#define PA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (__printf__, a, b)))
#else
#define PA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b)))
#endif
#else
/** If we're in GNU C, use some magic for detecting invalid format strings */
#define PA_GCC_PRINTF_ATTR(a,b)