Vincent Torri wrote:
Hey,

i am contributing to a project (the Enlightenment windows manager) and we use 
variadic macros. More precisely, this one:

#  define EINA_ARG_NONNULL(idx, ...) __attribute__ ((nonnull(idx, ## 
__VA_ARGS__)))

and we use it like that (for example):

EAPI void eina_rectangle_pool_free(Eina_Rectangle_Pool *pool) 
EINA_ARG_NONNULL(1);

The variable argument list is empty in that particular case.

On Linux, no problem, but on opensolaris, a guy reported the warning using 
SunStudio12 :

"warning: argument mismatch"

I'm not very familiar with variadic macro, and even if google found some pages 
about that (like 
http://mail.opensolaris.org/pipermail/opensolaris-code/2008-September/006029.html
 ), i didn't find the solution.

The solution is included in the mail you just cited. Changing the macro
is IMHO the only way.

So, is there a flag to pass to the SunStudio12 preprocessor and/or modifying 
the above macro ?

You could try
#  define EINA_ARG_NONNULL(...) __attribute__ ((nonnull(__VA_ARGS__)))

The problem is that the GNU cpp accepts empty argument list while the Sun pre processor follows the C99 standard which does not allow the list to be empty.

Please have a look at
http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html as well.

Regards,
  Christian

--
Christian Kaiser, Software Engineer, Dolphin Interconnect Solutions
http://www.dolphinics.com

_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to