summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@shadowen.org>2008-10-16 07:02:16 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 20:21:34 +0200
commit14b111c158116f02c1c862397075e28ac12d65d6 (patch)
tree136c634a2edfecfb1b8f85e3abbf9023faad80c5 /scripts
parentcheckpatch: values: double ampersand may be unary (diff)
downloadlinux-14b111c158116f02c1c862397075e28ac12d65d6.tar.xz
linux-14b111c158116f02c1c862397075e28ac12d65d6.zip
checkpatch: conditional indent -- labels have different indent rules
Labels have different indent rules and must be ignored when checking the conditional indent levels. Also correct identify labels in single statement conditionals. Signed-off-by: Andy Whitcroft <apw@shadowen.org> 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, 8 insertions, 3 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 114821364c00..1e7d2cdd0c20 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -782,9 +782,9 @@ sub annotate_values {
}
$type = 'N';
- } elsif ($cur =~ /^(if|while|typeof|__typeof__|for)\b/o) {
+ } elsif ($cur =~ /^(if|while|for)\b/o) {
print "COND($1)\n" if ($dbg_values > 1);
- $av_pending = 'N';
+ $av_pending = 'E';
$type = 'N';
} elsif ($cur =~/^(case)/o) {
@@ -792,7 +792,7 @@ sub annotate_values {
$av_pend_colon = 'C';
$type = 'N';
- } elsif ($cur =~/^(return|else|goto)/o) {
+ } elsif ($cur =~/^(return|else|goto|typeof|__typeof__)\b/o) {
print "KEYWORD($1)\n" if ($dbg_values > 1);
$type = 'N';
@@ -1846,6 +1846,11 @@ sub process {
$check = 0;
}
+ # Ignore the current line if it is label.
+ if ($s =~ /^\s*$Ident\s*:/) {
+ $check = 0;
+ }
+
my (undef, $sindent) = line_stats("+" . $s);
##print "line<$line> prevline<$prevline> indent<$indent> sindent<$sindent> check<$check> continuation<$continuation> s<$s>\n";