------- Comment #4 from joseph at codesourcery dot com  2010-06-05 17:36 -------
Subject: Re:  [4.5/4.6 Regression] gcc 4.5.0 requires
 c9x compiler to build

On Sat, 5 Jun 2010, manu at gcc dot gnu dot org wrote:

> Do you mean we should not use VA_ARGS in GCC? Then, what? static inline? Is
> this warned by -pedantic? Shouldn't it?

Variadic macros are not standard C90 or C++98 and should only be used 
*conditionally* if the compiler being used to build GCC supports them.  
Otherwise you need to define a function - which in practice won't be 
inline (inline variadic functions, passing on their variable arguments to 
another variadic function, require GNU extensions that are much more 
recent than variadic macros).

I think

#if GCC_VERSION >= 3000 || __STDC_VERSION__ >= 199901L

is a suitable condition for support of variadic macros.

Because these macros may be used *conditionally*, GCC is built with 
-Wno-variadic-macros.

For the cases that are inserting UNKNOWN_LOCATION, I'd suggest just 
changing all the call sites of the macro to pass UNKNOWN_LOCATION 
explicitly, and removing the macro.  That should deal with build_call_expr 
and with build_call_nofold in builtins.c.

For the cases in sel-sched-dump.h I'd suggest just using normal variadic 
functions that use interfaces such as vfprintf and vasprintf, and not 
macros at all.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44426

Reply via email to