summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@canonical.com>2012-01-10 23:10:15 (GMT)
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-11 00:30:51 (GMT)
commitbfcb2cc798a14230d22b6dd999e2e680623de622 (patch)
treedfa486a04620bd02e58b3cdcb8b06ee5da3014ac /scripts
parent6b48db24e30d371bc54566667b82ca3d64aab80a (diff)
downloadlinux-bfcb2cc798a14230d22b6dd999e2e680623de622.tar.xz
checkpatch: catch all occurences of type and cast spacing errors per line
Fix up type and cast spacing checks such that all occurences on a line are examined and reported. For example the line below has a valid cast and a bad type, but currently we check the cast first which is good and stop: u16* bar = (u16 *)baz; We will also only report one of the errors in this example: u16* bar = (u16*)bad; Move to iterating across all casts and all types, reporting any failure. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Andy Whitcroft <apw@canonical.com> Cc: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index eb4b559..e3bfcbe 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2209,8 +2209,9 @@ sub process {
# * goes on variable not on type
# (char*[ const])
- if ($line =~ m{\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\)}) {
- my ($from, $to) = ($1, $1);
+ while ($line =~ m{(\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\))}g) {
+ #print "AA<$1>\n";
+ my ($from, $to) = ($2, $2);
# Should start with a space.
$to =~ s/^(\S)/ $1/;
@@ -2225,8 +2226,10 @@ sub process {
ERROR("POINTER_LOCATION",
"\"(foo$from)\" should be \"(foo$to)\"\n" . $herecurr);
}
- } elsif ($line =~ m{\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident)}) {
- my ($from, $to, $ident) = ($1, $1, $2);
+ }
+ while ($line =~ m{(\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident))}g) {
+ #print "BB<$1>\n";
+ my ($from, $to, $ident) = ($2, $2, $3);
# Should start with a space.
$to =~ s/^(\S)/ $1/;