From 7808d4b7892ccd80bcabb1253ee359a64c51c612 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 13 Oct 2014 15:19:35 -0700 Subject: Revert "extras: reverse test for '}' vs. following 'else' placement" This reverts commit 0a8371bdfdd88e662d09def717cc0b822feb64e8. Change-Id: I946f449ad213cea70fbbd9cd3951f5838b9f82e5 BUG: 1120646 Signed-off-by: Harshavardhana Reviewed-on: http://review.gluster.org/8927 Reviewed-by: Jeff Darcy Reviewed-by: Kaleb KEITHLEY Reviewed-by: Niels de Vos Tested-by: Niels de Vos --- extras/checkpatch.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'extras') 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 }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 -- cgit