From: "H. Peter Anvin" <hpa@zytor.com>
To: linux-kernel@vger.kernel.org, mingo@redhat.com, hpa@zytor.com,
torvalds@linux-foundation.org, rostedt@goodmis.org,
srostedt@redhat.com, tglx@linutronix.de, adobriyan@gmail.com
Cc: linux-tip-commits@vger.kernel.org
Subject: Re: [tip:core/urgent] WARN_ON_SMP(): Add comment to explain ({0;})
Date: Mon, 28 Mar 2011 07:51:57 -0700 [thread overview]
Message-ID: <4D90A08D.707@zytor.com> (raw)
In-Reply-To: <tip-ccd0d44fad38dc1bb4b26dcc7a30e9f2c3b36870@git.kernel.org>
On 03/28/2011 07:45 AM, tip-bot for Steven Rostedt wrote:
>
> WARN_ON_SMP(): Add comment to explain ({0;})
>
> The define to use ({0;}) for the !CONFIG_SMP case of WARN_ON_SMP()
> can be confusing. As the WARN_ON_SMP() needs to be a nop when
> CONFIG_SMP is not set, including all its parameters must not be
> evaluated, and that it must work as both a stand alone statement
> and inside an if condition, we define it to a funky ({0;}).
>
> A simple "0" will not work as it causes gcc to give the warning that
> the statement has no effect.
>
> As this strange definition has raised a few eyebrows from some
> major kernel developers, it is wise to document why we create such
> a work of art.
>
What the heck is wrong with the idiomatic and non-gcc-extension-using:
((void)0)
?
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
next parent reply other threads:[~2011-03-28 14:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <tip-ccd0d44fad38dc1bb4b26dcc7a30e9f2c3b36870@git.kernel.org>
2011-03-28 14:51 ` H. Peter Anvin [this message]
2011-03-28 14:56 ` [tip:core/urgent] WARN_ON_SMP(): Add comment to explain ({0;}) richard -rw- weinberger
2011-03-28 14:58 ` H. Peter Anvin
2011-03-28 15:09 ` Steven Rostedt
2011-03-28 18:18 ` Alexey Dobriyan
2011-03-29 7:30 ` Ingo Molnar
[not found] ` <8fa65ade-2b9f-4f05-9b52-dfd770326f44@email.android.com>
2011-03-29 14:47 ` Steven Rostedt
2011-03-29 11:36 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D90A08D.707@zytor.com \
--to=hpa@zytor.com \
--cc=adobriyan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=srostedt@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox