From: Andrew Morton <akpm@linux-foundation.org>
To: "Robert P. J. Day" <rpjday@mindspring.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Add spaces on either side of case "..." operator.
Date: Tue, 10 Apr 2007 09:05:55 -0700 [thread overview]
Message-ID: <20070410090555.d847d466.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0704100721050.13729@CPE00045a9c397f-CM001225dbafb6>
On Tue, 10 Apr 2007 07:23:35 -0400 (EDT) "Robert P. J. Day" <rpjday@mindspring.com> wrote:
> Following the programming advice laid down in the gcc manual, make
> sure the case "..." operator has spaces on either side.
>
> Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
>
> ---
>
> According to:
>
> http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Case-Ranges.html#Case-Ranges:
>
> "Be careful: Write spaces around the ..., for otherwise it may be
> parsed wrong when you use it with integer values."
>
>
> diff --git a/kernel/audit.c b/kernel/audit.c
> index 76c9a11..d963a04 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -515,8 +515,8 @@ static int audit_netlink_ok(struct sk_buff *skb, u16 msg_type)
> err = -EPERM;
> break;
> case AUDIT_USER:
> - case AUDIT_FIRST_USER_MSG...AUDIT_LAST_USER_MSG:
> - case AUDIT_FIRST_USER_MSG2...AUDIT_LAST_USER_MSG2:
> + case AUDIT_FIRST_USER_MSG ... AUDIT_LAST_USER_MSG:
> + case AUDIT_FIRST_USER_MSG2 ... AUDIT_LAST_USER_MSG2:
hm... We have:
#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */
#define AUDIT_USER_AVC 1107 /* We filter this differently */
#define AUDIT_LAST_USER_MSG 1199
and CPP turns that into
case 1100 ...1199:
case 2100 ...2999:
and it does the same when the comments are stripped from the #defines.
So we were saved by the trailing space which cpp added to the expanded
macro. I wonder why cpp did that, and to what extent one can rely cpp
doing that.
Oh well. I guess we should apply the patch.
next prev parent reply other threads:[~2007-04-10 16:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-10 11:23 [PATCH] Add spaces on either side of case "..." operator Robert P. J. Day
2007-04-10 14:33 ` WANG Cong
2007-04-10 16:05 ` Andrew Morton [this message]
2007-04-10 17:47 ` Jeremy Fitzhardinge
2007-04-10 20:45 ` Alexey Dobriyan
2007-04-10 20:37 ` Alexey Dobriyan
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=20070410090555.d847d466.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rpjday@mindspring.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.