summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
Diffstat (limited to 'extras')
-rwxr-xr-xextras/checkpatch.pl10
1 files changed, 5 insertions, 5 deletions
diff --git a/extras/checkpatch.pl b/extras/checkpatch.pl
index 18e8cc7aac7..02c2c2e02ee 100755
--- a/extras/checkpatch.pl
+++ b/extras/checkpatch.pl
@@ -3335,12 +3335,12 @@ sub process {
"trailing statements should be on next line\n" . $herecurr);
}
- # Check for "} else" which is less readable. Having if/else keywords
- # line up is a good thing, and having control structures on the same
- # line as a close-brace is bad.
- if ($line=~/^.\s*}\selse\s*/) {
+ # Check for }<nl>else {, these must be at the same
+ # indent level to be relevant to each other.
+ if ($prevline=~/}\s*$/ and $line=~/^.\s*else\s*/ and
+ $previndent == $indent) {
ERROR("ELSE_AFTER_BRACE",
- "'}' and 'else' should be on separate lines\n" . $hereprev);
+ "else should follow close brace '}'\n" . $hereprev);
}
if ($prevline=~/}\s*$/ and $line=~/^.\s*while\s*/ and