From: Andy Whitcroft <apw@canonical.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org, Andy Whitcroft <apw@canonical.com>
Subject: [PATCH 1/7] checkpatch: possible types -- prevent illegal modifiers being added
Date: Fri, 16 Oct 2009 19:39:26 +0100 [thread overview]
Message-ID: <1255718372-22805-2-git-send-email-apw@canonical.com> (raw)
In-Reply-To: <1255718372-22805-1-git-send-email-apw@canonical.com>
Prevent known non types being detected as modifiers. Ensure we do not
look at any type which starts with a keyword.
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
scripts/checkpatch.pl | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 87bbb8b..b43e309 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -997,23 +997,25 @@ sub annotate_values {
sub possible {
my ($possible, $line) = @_;
-
- print "CHECK<$possible> ($line)\n" if ($dbg_possible > 2);
- if ($possible !~ /(?:
+ my $notPermitted = qr{(?:
^(?:
$Modifier|
$Storage|
$Type|
- DEFINE_\S+|
+ DEFINE_\S+
+ )$|
+ ^(?:
goto|
return|
case|
else|
asm|__asm__|
do
- )$|
+ )(?:\s|$)|
^(?:typedef|struct|enum)\b
- )/x) {
+ )}x;
+ warn "CHECK<$possible> ($line)\n" if ($dbg_possible > 2);
+ if ($possible !~ $notPermitted) {
# Check for modifiers.
$possible =~ s/\s*$Storage\s*//g;
$possible =~ s/\s*$Sparse\s*//g;
@@ -1022,8 +1024,10 @@ sub possible {
} elsif ($possible =~ /\s/) {
$possible =~ s/\s*$Type\s*//g;
for my $modifier (split(' ', $possible)) {
- warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible);
- push(@modifierList, $modifier);
+ if ($modifier !~ $notPermitted) {
+ warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible);
+ push(@modifierList, $modifier);
+ }
}
} else {
--
1.6.3.3
next prev parent reply other threads:[~2009-10-16 18:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-16 18:39 [PATCH 0/7] update checkpatch to v0.30 Andy Whitcroft
2009-10-16 18:39 ` Andy Whitcroft [this message]
2009-10-16 18:39 ` [PATCH 2/7] checkpatch: correctly stop scanning at the bottom of a hunk Andy Whitcroft
2009-10-16 18:39 ` [PATCH 3/7] checkpatch: update copyright dates Andy Whitcroft
2009-10-16 18:39 ` [PATCH 4/7] checkpatch: fix false errors due to macro concatenation Andy Whitcroft
2009-10-16 18:39 ` [PATCH 5/7] checkpatch: fix __attribute__ matching Andy Whitcroft
2009-10-16 18:39 ` [PATCH 6/7] checkpatch: fix false EXPORT_SYMBOL warning Andy Whitcroft
2009-10-16 18:58 ` Daniel Walker
2009-10-16 23:26 ` Andy Whitcroft
2009-10-16 18:39 ` [PATCH 7/7] checkpatch: version 0.30 Andy Whitcroft
2009-10-16 18:56 ` [PATCH 0/7] update checkpatch to v0.30 Joe Perches
2009-10-16 23:29 ` Andy Whitcroft
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=1255718372-22805-2-git-send-email-apw@canonical.com \
--to=apw@canonical.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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
all inboxes | Powered by JetHome®