lkml.org 
[lkml]   [2011]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [tip:core/urgent] WARN_ON_SMP(): Allow use in if() statements on UP
From
Date
On Fri, 2011-03-25 at 09:45 -0700, Linus Torvalds wrote:
> On Fri, Mar 25, 2011 at 3:48 AM, tip-bot for Steven Rostedt
> <srostedt@redhat.com> wrote:
> > -# define WARN_ON_SMP(x) do { } while (0)
> > +# define WARN_ON_SMP(x) ({0;})
>
> That's a VERY odd way of writing "0".
>
> Am I missing something subtle?

I thought about using "0", but when WARN_ON_SMP() is used outside of an
if statement, it turns into:

0;

Which seems strange to me. Thus the ({0;}) was basically a way to state
that this is also a function and not just a 0 value.

Also, a quick test shows that

0;

gives the warning:

"warning: statement with no effect"

-- Steve




\
 
 \ /
  Last update: 2011-03-25 19:19    [W:0.430 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site