Re: Warning when compiling with -pedantic, and fix

Raphaël HUCK <[email protected]>
Newsgroups gmane.text.clearsilver.general
Message-ID <[email protected]>
As Splint isn't able to parse macros with (...) parameters, it's even 
better to add defined (S_SPLINT_S) like this:

#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define nerr_raise(e,f,...) \
    nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)
#elif __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 4) || defined 
(S_SPLINT_S)
#define nerr_raise(e,f,a...) \
    nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,##a)
#else
#error The compiler is missing support for variable-argument macros.
#endif

> When compiling with -pedantic, gcc complains:
> 
> util/neo_err.h:75:25: warning: ISO C does not permit named variadic
> macros
> util/neo_err.h:89:31: warning: ISO C does not permit named variadic
> macros
> util/neo_err.h:126:28: warning: ISO C does not permit named variadic
> macros
> 
> After replacing:
> 
> #ifdef __GNUC__
> #define nerr_raise(e,f,a...) \
>    nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,##a)
> #else
> #define nerr_raise(e,f,...) \
>    nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)
> #endif
> 
> with:
> 
> #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
> #define nerr_raise(e,f,...) \
>    nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)
> #elif __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 4)
> #define nerr_raise(e,f,a...) \
>    nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,##a)
> #else
> #error The compiler is missing support for variable-argument macros.
> #endif
> 
> gcc no longer complains, and everything is fine ;)
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.