]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
checkpatch: switch -- report trailing statements on case and default
authorAndy Whitcroft <apw@shadowen.org>
Thu, 24 Jul 2008 04:29:02 +0000 (21:29 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Jul 2008 17:47:25 +0000 (10:47 -0700)
Report trailing statements on case and default lines.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl

index 614999f29aa04846a5588e3f74537bb3f5104807..5f71b30502539ba9c15d4ed7a2a05de4fe79135e 100755 (executable)
@@ -1244,6 +1244,10 @@ sub process {
                                ERROR("switch and case should be at the same indent\n$hereline$err");
                        }
                }
+               if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g &&
+                   $line !~ /\G(?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$/g) {
+                       ERROR("trailing statements should be on next line\n" . $herecurr);
+               }
 
 # if/while/etc brace do not go on next line, unless defining a do while loop,
 # or if that brace on the next line is for something else