checkpatch.pl: also suggest 'else if' when if follows brace
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Wed, 6 Aug 2014 23:10:37 +0000 (16:10 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 7 Aug 2014 01:01:27 +0000 (18:01 -0700)
This might help a kernel hacker think twice before blindly adding a
newline.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-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

index 1ec6808..c40ba40 100755 (executable)
@@ -3621,7 +3621,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