Re: [PATCH] intel-iommu: fix build with CONFIG_BRANCH_TRACER=y

Kyle Moffett
2009-04-07T22:42:28Z

Whoops, resent the original HTML email as plain text, sorry...

On Tue, Apr 7, 2009 at 10:59 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> On Tue, 7 Apr 2009, Linus Torvalds wrote:
> >
> > Can we please do it something like the following instead:
> >
> >       #define if(a, ...) \
> >               __trace_if( (a, ## __VA_ARGS__) )
> >
> > so that you don't need to do that ", ## __VA_ARGS__" thing three times?
>
> IOW, does this (TOTALLY UNTESTED) patch work?
>
>                Linus
>
> -#define if(cond) if (__builtin_constant_p((cond)) ? !!(cond) :         \
> +#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
> +#define __trace_if(cond) \
> +       if (__builtin_constant_p((cond)) ? !!(cond) :                   \

Umm, why not just use the much nicer pre-C99 GCC syntax?  It
automatically makes "cond" expand into the full comma-separated
argument list.  No other changes should be necessary.  IOW, something
like this:

-#define if(cond) if (__builtin_constant_p((cond)) ? !!(cond) :         \
+#define if(cond...) if (__builtin_constant_p((cond)) ? !!(cond) :         \

Cheers,
Kyle Moffett