diff options
Diffstat (limited to 'scripts/checkpatch.pl')
| -rwxr-xr-x | scripts/checkpatch.pl | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index f27b0b53e3ea..725c59611e97 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
| @@ -3448,8 +3448,22 @@ sub process { | |||
| 3448 | 3448 | ||
| 3449 | # check for multiple semicolons | 3449 | # check for multiple semicolons |
| 3450 | if ($line =~ /;\s*;\s*$/) { | 3450 | if ($line =~ /;\s*;\s*$/) { |
| 3451 | WARN("ONE_SEMICOLON", | 3451 | WARN("ONE_SEMICOLON", |
| 3452 | "Statements terminations use 1 semicolon\n" . $herecurr); | 3452 | "Statements terminations use 1 semicolon\n" . $herecurr); |
| 3453 | } | ||
| 3454 | |||
| 3455 | # check for switch/default statements without a break; | ||
| 3456 | if ($^V && $^V ge 5.10.0 && | ||
| 3457 | defined $stat && | ||
| 3458 | $stat =~ /^\+[$;\s]*(?:case[$;\s]+\w+[$;\s]*:[$;\s]*|)*[$;\s]*\bdefault[$;\s]*:[$;\s]*;/g) { | ||
| 3459 | my $ctx = ''; | ||
| 3460 | my $herectx = $here . "\n"; | ||
| 3461 | my $cnt = statement_rawlines($stat); | ||
| 3462 | for (my $n = 0; $n < $cnt; $n++) { | ||
| 3463 | $herectx .= raw_line($linenr, $n) . "\n"; | ||
| 3464 | } | ||
| 3465 | WARN("DEFAULT_NO_BREAK", | ||
| 3466 | "switch default: should use break\n" . $herectx); | ||
| 3453 | } | 3467 | } |
| 3454 | 3468 | ||
| 3455 | # check for gcc specific __FUNCTION__ | 3469 | # check for gcc specific __FUNCTION__ |
