diff options
author | Andy Whitcroft <apw@shadowen.org> | 2008-10-16 01:02:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 14:21:34 -0400 |
commit | 1bdab9e5881fde3bf66528db5b91477ce4b35b3b (patch) | |
tree | 286e57468f42dd1acb83d810d049598b7e3978a6 /scripts/checkpatch.pl | |
parent | 14b111c158116f02c1c862397075e28ac12d65d6 (diff) |
checkpatch: switch indent allow plain return
It is a common and sane idiom to allow a single return on the end of a
case statement:
switch (...) {
case foo: return bar;
}
Add an exception for this.
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>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-x | scripts/checkpatch.pl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 1e7d2cdd0c20..c6782ac6f130 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -1295,7 +1295,11 @@ sub process { | |||
1295 | } | 1295 | } |
1296 | } | 1296 | } |
1297 | if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g && | 1297 | if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g && |
1298 | $line !~ /\G(?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$/g) { | 1298 | $line !~ /\G(?: |
1299 | (?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$| | ||
1300 | \s*return\s+ | ||
1301 | )/xg) | ||
1302 | { | ||
1299 | ERROR("trailing statements should be on next line\n" . $herecurr); | 1303 | ERROR("trailing statements should be on next line\n" . $herecurr); |
1300 | } | 1304 | } |
1301 | 1305 | ||