Messages in this thread Patch in this message | | | Subject | [PATCH] checkpatch: Allow case labels with ranges | From | Joe Perches <> | Date | Mon, 21 Jul 2014 06:13:26 -0700 |
| |
The MISSING_BREAK / fallthrough test does not support gcc's extension for case labels with ranges.
Add it.
Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Lee Jones <lee.jones@linaro.org> --- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index dc72a9b..2258497 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4767,7 +4767,7 @@ sub process { } # check for case / default statements not preceeded by break/fallthrough/switch - if ($line =~ /^.\s*(?:case\s+(?:$Ident|$Constant)\s*|default):/) { + if ($line =~ /^.\s*(?:case\s+(?:$Ident|$Constant)\s*(?:\.\.\.\s*(?:$Ident|$Constant)\s*)?|default):/) { my $has_break = 0; my $has_statement = 0; my $count = 0; @@ -4778,7 +4778,7 @@ sub process { my $fline = $lines[$prevline - 1]; last if ($fline =~ /^\@\@/); next if ($fline =~ /^\-/); - next if ($fline =~ /^.(?:\s*(?:case\s+(?:$Ident|$Constant)[\s$;]*|default):[\s$;]*)*$/); + next if ($fline =~ /^.(?:\s*(?:case\s+(?:$Ident|$Constant(?:\s*\.\.\.\s*(?:$Ident|$Constant))?)[\s$;]*|default):[\s$;]*)*$/); $has_break = 1 if ($rline =~ /fall[\s_-]*(through|thru)/i); next if ($fline =~ /^.[\s$;]*$/); $has_statement = 1;
| |