diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/checkpatch.pl | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 66bcedc0c8b3..457f87460d6e 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -1363,14 +1363,6 @@ sub process { | |||
1363 | ERROR("switch and case should be at the same indent\n$hereline$err"); | 1363 | ERROR("switch and case should be at the same indent\n$hereline$err"); |
1364 | } | 1364 | } |
1365 | } | 1365 | } |
1366 | if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g && | ||
1367 | $line !~ /\G(?: | ||
1368 | (?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$| | ||
1369 | \s*return\s+ | ||
1370 | )/xg) | ||
1371 | { | ||
1372 | ERROR("trailing statements should be on next line\n" . $herecurr); | ||
1373 | } | ||
1374 | 1366 | ||
1375 | # if/while/etc brace do not go on next line, unless defining a do while loop, | 1367 | # if/while/etc brace do not go on next line, unless defining a do while loop, |
1376 | # or if that brace on the next line is for something else | 1368 | # or if that brace on the next line is for something else |
@@ -1986,6 +1978,15 @@ sub process { | |||
1986 | ERROR("trailing statements should be on next line\n" . $herecurr); | 1978 | ERROR("trailing statements should be on next line\n" . $herecurr); |
1987 | } | 1979 | } |
1988 | } | 1980 | } |
1981 | # case and default should not have general statements after them | ||
1982 | if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g && | ||
1983 | $line !~ /\G(?: | ||
1984 | (?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$| | ||
1985 | \s*return\s+ | ||
1986 | )/xg) | ||
1987 | { | ||
1988 | ERROR("trailing statements should be on next line\n" . $herecurr); | ||
1989 | } | ||
1989 | 1990 | ||
1990 | # Check for }<nl>else {, these must be at the same | 1991 | # Check for }<nl>else {, these must be at the same |
1991 | # indent level to be relevant to each other. | 1992 | # indent level to be relevant to each other. |