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

From: Steven Rostedt
Date: Mon Mar 28 2011 - 11:09:08 EST


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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/