Re: [pulseaudio-discuss] [PATCH v2 1/6] gccmacro: Disable printf-like format checking on mingw32 compilers.

2012-10-23 Thread 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?

-- Arun

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH v2 1/6] gccmacro: Disable printf-like format checking on mingw32 compilers.

2012-10-23 Thread Thomas Martitz

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 k...@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.
---
 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)
-- 
1.7.10.4

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH v2 1/6] gccmacro: Disable printf-like format checking on mingw32 compilers.

2012-08-21 Thread Rémi Denis-Courmont
Le mardi 21 août 2012 14:32:06 Thomas Martitz, vous avez écrit :
 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?

The ones from C89.

-- 
Rémi Denis-Courmont
C/C++ software engineer looking for a job
http://www.linkedin.com/in/remidenis
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss