Hi all, I have a problem with the Sun Studio Express C pre-processor handling variadic macros. Look at the following code example:
> 1 #define OSIF_WARN( fmt, args... ) osif_warn(fmt, ## args) > 2 > 3 void osif_warn(char *fmt, ... ) > 4 { > 5 } > 6 > 7 int main (void) > 8 { > 9 osif_warn("%s", "bla"); > 10 OSIF_WARN("%s", "bla"); > 11 osif_warn("blu"); > 12 OSIF_WARN("blu"); > 13 return 0; > 14 } The pre-processor throws a warning: "varargs.c", line 12: warning: argument mismatch Although, the code the pre-processor (cc -E) generates looks good! > int main (void) > { > osif_warn("%s", "bla"); > osif_warn ( "%s" , "bla" ); > osif_warn("blu"); > osif_warn ( "blu" ); > return 0; > } Why does the sun-cpp generate a warning even though the code looks good? It seems that the sun-cpp is not able to handle variable argument lists with zero entries! Is this a bug then? I am using cc: Sun Ceres C 5.10 SunOS_i386 2008/04/04 of the "sunstudioexpress" package for OpenSolaris 2008.05. 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