projects
/
GitHub
/
MotorolaMobilityLLC
/
kernel-slsi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1bde561
)
checkpatch: notice unbalanced else braces in a patch
author
Joe Perches
<joe@perches.com>
Fri, 24 Feb 2017 23:01:41 +0000
(15:01 -0800)
committer
Linus Torvalds
<torvalds@linux-foundation.org>
Sat, 25 Feb 2017 01:46:57 +0000
(17:46 -0800)
Patches that add or modify code like
} else
<foo>
or
else {
<bar>
where one branch appears to have a brace and the other branch does not
have a brace should emit a --strict style message.
Link:
http://lkml.kernel.org/r/c6be32747fc725cbc235802991746700a0f54fdc.1486754390.git.joe@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl
patch
|
blob
|
blame
|
history
diff --git
a/scripts/checkpatch.pl
b/scripts/checkpatch.pl
index 12db1483e6c250b399139bc1482af121a9c77967..7fb73d92801cd80ff726f622b014ef8ec1d715e0 100755
(executable)
--- a/
scripts/checkpatch.pl
+++ b/
scripts/checkpatch.pl
@@
-5104,6
+5104,12
@@
sub process {
}
}
+# check for single line unbalanced braces
+ if ($sline =~ /.\s*\}\s*else\s*$/ ||
+ $sline =~ /.\s*else\s*\{\s*$/) {
+ CHK("BRACES", "Unbalanced braces around else statement\n" . $herecurr);
+ }
+
# check for unnecessary blank lines around braces
if (($line =~ /^.\s*}\s*$/ && $prevrawline =~ /^.\s*$/)) {
if (CHK("BRACES",