Skip to contentSkip to conversation

checkpatch.pl: Also suggest 'else if' when if follows brace

PATCH In review Rasmus Villemoes 2 participants 2 messages Jun 20, 2014 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch.pl: Also suggest 'else if' when if follows brace

This might help a kernel hacker think twice before blindly adding a newline.

---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
index 010b18e..e1924eb 100755
@@ -3601,7 +3601,7 @@ sub process {
 # if should not continue a brace
 		if ($line =~ /}\s*if\b/) {
 			ERROR("TRAILING_STATEMENTS",
-			      "trailing statements should be on next line\n" .
+			      "trailing statements should be on next line (or did you mean 'else if'?)\n" .
 				$herecurr);
 		}
 # case and default should not have general statements after them
Signature · 1 line
1.9.2
maintainer
#1 lore raw
Quoted 2 lines · Rasmus Villemoes

This might help a kernel hacker think twice before blindly adding a newline.

Sure, fine by me.

Quoted 18 lines
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
index 010b18e..e1924eb 100755
@@ -3601,7 +3601,7 @@ sub process {
 # if should not continue a brace
 		if ($line =~ /}\s*if\b/) {
 			ERROR("TRAILING_STATEMENTS",
-			      "trailing statements should be on next line\n" .
+			      "trailing statements should be on next line (or did you mean 'else if'?)\n" .
 				$herecurr);
 		}
 # case and default should not have general statements after them