cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: yangtse: curl/lib sendf.c,1.125,1.126 sendf.h,1.33,1.34

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 21 Mar 2007 14:22:49 -0700

On Wed, Mar 21, 2007 at 02:34:08PM +0100, Yang Tse wrote:
> Some strange magic will be needed to shut up those warnings that
> appear with --disable-verbose. ;-)

This patch ought to have been enough:

--- sendf.h 21 Mar 2007 13:09:39 -0000 1.35
+++ sendf.h 21 Mar 2007 21:15:11 -0000
@@ -29,12 +29,13 @@
 void Curl_failf(struct SessionHandle *, const char *fmt, ...);
 
 #if defined(CURL_DISABLE_VERBOSE_STRINGS)
-#if defined(__GNUC__)
-/* This style of variable argument macros is a gcc extension */
+#if defined(__STDC__) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+/* C99 compilers support variadic macros */
+#define infof(...)
+#elif defined(__GNUC__)
+/* This style of variable argument macros is an old gcc extension */
 #define infof(x...) /*ignore*/
 #else
-/* C99 compilers could use this if we could detect them */
-/*#define infof(...) */
 /* Cast the args to void to make them a noop, side effects notwithstanding */
 #define infof (void)
 #endif

But wouldn't you know it, gcc 2.96 prints a warning for *both* styles of
variadic macros! It's nice enough to warn that anonymous variadic macros
were introduced in C99 when you use that style, and nice enough to warn that
named variadic macros aren't standard C when you use that style. The
solution for this version of gcc looks like it's going to be a new entry in
the ignored warnings regex.

I'll commit the above patch if noone complains and if you don't beat me to it.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2007-03-21