From a5b97e8f45d02d8b6dc2ca560291c6ecfb4785ee Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 17 Dec 2012 16:02:01 -0800 Subject: [PATCH] --- yaml --- r: 346422 b: refs/heads/master c: d1e2ad07e78c4bbac9fce4d2e3c0fe60bce091d8 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/scripts/checkpatch.pl | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 33cf21540a5b..391f39e5a196 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 88982fea52d0115d44b77619afef576f24cdb844 +refs/heads/master: d1e2ad07e78c4bbac9fce4d2e3c0fe60bce091d8 diff --git a/trunk/scripts/checkpatch.pl b/trunk/scripts/checkpatch.pl index f27b0b53e3ea..725c59611e97 100755 --- a/trunk/scripts/checkpatch.pl +++ b/trunk/scripts/checkpatch.pl @@ -3448,8 +3448,22 @@ sub process { # check for multiple semicolons if ($line =~ /;\s*;\s*$/) { - WARN("ONE_SEMICOLON", - "Statements terminations use 1 semicolon\n" . $herecurr); + WARN("ONE_SEMICOLON", + "Statements terminations use 1 semicolon\n" . $herecurr); + } + +# check for switch/default statements without a break; + if ($^V && $^V ge 5.10.0 && + defined $stat && + $stat =~ /^\+[$;\s]*(?:case[$;\s]+\w+[$;\s]*:[$;\s]*|)*[$;\s]*\bdefault[$;\s]*:[$;\s]*;/g) { + my $ctx = ''; + my $herectx = $here . "\n"; + my $cnt = statement_rawlines($stat); + for (my $n = 0; $n < $cnt; $n++) { + $herectx .= raw_line($linenr, $n) . "\n"; + } + WARN("DEFAULT_NO_BREAK", + "switch default: should use break\n" . $herectx); } # check for gcc specific __FUNCTION__