Re: [tip:core/urgent] WARN_ON_SMP(): Add comment to explain ({0;})

Steven Rostedt
2011-03-28T15:09:05Z

On Mon, 2011-03-28 at 07:58 -0700, H. Peter Anvin wrote:
> On 03/28/2011 07:56 AM, richard -rw- weinberger wrote:
> >>
> >> What the heck is wrong with the idiomatic and non-gcc-extension-using:
> >>
> >> ((void)0)
> >>
> >> ?
> >
> > AFAIK you cannot use it within an if-statement.
> >
>
> OK, fair enough.

If people hate the ({0;}) so much, we could replace it with:

static inline int _WARN_ON_SMP(void) { return 0; }
#define WARN_ON_SMP(x) _WARN_ON_SMP()

That would pretty much do the same thing.

o Keeps the parameters from being evaluated, as they may not be defined
for SMP

o Can be used as a standalone statement without gcc complaining

o Can be used within an if condition.

Geeze, I never expected such a fuss over a simple change ;)

-- Steve