From b1303e6d920c3df3d4c89399924ff98c0a633f7f Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Tue, 23 Oct 2012 12:10:45 +0200 Subject: [PATCH] gccmacro: Disable printf-like format checking on mingw32 compilers. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 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. --- src/pulse/gccmacro.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pulse/gccmacro.h b/src/pulse/gccmacro.h index 1e818ff..e906f59 100644 --- a/src/pulse/gccmacro.h +++ b/src/pulse/gccmacro.h @@ -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) -- 2.7.4