diff options
author | Harshavardhana <harsha@harshavardhana.net> | 2014-10-13 15:19:35 -0700 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2014-10-14 06:43:32 -0700 |
commit | 7808d4b7892ccd80bcabb1253ee359a64c51c612 (patch) | |
tree | 6d19866d3b040e78d77549e7c6fa0304dc46d538 /extras/checkpatch.pl | |
parent | 3b5b5042ec2f119e3ec807829c101c421e90e2da (diff) |
Revert "extras: reverse test for '}' vs. following 'else' placement"
This reverts commit 0a8371bdfdd88e662d09def717cc0b822feb64e8.
Change-Id: I946f449ad213cea70fbbd9cd3951f5838b9f82e5
BUG: 1120646
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/8927
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'extras/checkpatch.pl')
-rwxr-xr-x | extras/checkpatch.pl | 10 |
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 |