On Tue, Aug 12, 2008 at 9:15 PM, Steven Stallion <[EMAIL PROTECTED]> wrote:
> Sebastien Roy wrote:
>> On Sat, 2008-08-09 at 11:17 -0500, Steven Stallion wrote:
>>> Does Studio 11/uts support any macros which allow varargs to be passed
>>> to a macro (__VA_ARGS__ comes to mind)?
>>
>> Yes; look for existing uses of __VA_ARGS__ in the ON source.
>> -Seb
>
> Consider the following:
>
>    static void ne_cmn_err(dev_info_t *, int, const char *, ...);
>
>    #define ne_error(dip, format, ...) \
>        ne_cmn_err((dip), CE_WARN, (format), __VA_ARGS__)
>
> If issued without varargs, the preprocessor incorrectly expands the
> ne_error macro as:
>
>    ne_cmn_err(dip, level, format, ); /* note extraneous comma */
>
> Odd... I seem to recall this working just fine on studio 12 - is this a
> limitation of 11 or am I missing something?

I think gcc allows things to automagically work, but I don't think
whatever standard that introduced vararg macros does.  What I've done
to work around it in the past is do something analogous to:
ne_cmn_err(dip, level, "%s", "msg");
_______________________________________________
driver-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/driver-discuss

Reply via email to