Using --file mode can give false positives with MISSING_BREAK fall-through warnings on simple but long multiple consecutive case statements.
Look for all lines before a case statement for a switch or a statement when using --file mode. Fix a misspelling of preceded while there. Signed-off-by: Joe Perches <[email protected]> Reported-by: Lee Jones <[email protected]> --- On Mon, 2014-07-21 at 14:30 -0700, Andrew Morton wrote: > On Mon, 21 Jul 2014 07:28:49 -0700 Joe Perches <[email protected]> wrote: > > > I'll fix it soon. > > wanna do s/preceeded/preceded/g while you're in there? Sure. It might be a few days though as a generic fix seems non-trivial. There's a trivial --file fix, but I'm not sure the patch one is appropriate. In the mean time, the case range label patch should be OK to commit. scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2258497..74afc7c 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4766,13 +4766,13 @@ sub process { } } -# check for case / default statements not preceeded by break/fallthrough/switch +# check for case / default statements not preceded by break/fallthrough/switch if ($line =~ /^.\s*(?:case\s+(?:$Ident|$Constant)\s*(?:\.\.\.\s*(?:$Ident|$Constant)\s*)?|default):/) { my $has_break = 0; my $has_statement = 0; my $count = 0; my $prevline = $linenr; - while ($prevline > 1 && $count < 3 && !$has_break) { + while ($prevline > 1 && ($file || $count < 3) && !$has_break) { $prevline--; my $rline = $rawlines[$prevline - 1]; my $fline = $lines[$prevline - 1]; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

