summaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@canonical.com>2009-01-15 22:51:06 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-16 01:39:38 +0100
commit39667782362becd5527e48d6c976a9f9985b95e6 (patch)
tree43fbe3e89848a863a857018d8e9e33ce07759bb8 /scripts/checkpatch.pl
parentcheckpatch: allow parentheses on return handle array values (diff)
downloadlinux-39667782362becd5527e48d6c976a9f9985b95e6.tar.xz
linux-39667782362becd5527e48d6c976a9f9985b95e6.zip
checkpatch: if should not continue a preceeding brace
We should not be continuing a braced section with an if, for example: if (...) { } if (...) { } Detect this and suggest adding a newline. Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 696196e194f5..5ea55e330c24 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2108,6 +2108,11 @@ sub process {
ERROR("trailing statements should be on next line\n" . $herecurr);
}
}
+# if should not continue a brace
+ if ($line =~ /}\s*if\b/) {
+ ERROR("trailing statements should be on next line\n" .
+ $herecurr);
+ }
# case and default should not have general statements after them
if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g &&
$line !~ /\G(?: