mirror of
https://github.com/torvalds/linux.git
synced 2024-12-18 00:53:40 +00:00
scripts/checkpatch.pl: avoid false warning missing break
void foo(int a) switch (a) { case 'h': fun1(); exit(1); default: } creates a warning "Possible switch case/default not preceded by break or fallthrough comment". exit( should be treated like return. Link: http://lkml.kernel.org/r/20170910154618.25819-1-xypron.glpk@gmx.de Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Acked-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
25bdda2bd6
commit
258f79d5a1
@ -6109,7 +6109,7 @@ sub process {
|
||||
next if ($fline =~ /^.[\s$;]*$/);
|
||||
$has_statement = 1;
|
||||
$count++;
|
||||
$has_break = 1 if ($fline =~ /\bswitch\b|\b(?:break\s*;[\s$;]*$|return\b|goto\b|continue\b)/);
|
||||
$has_break = 1 if ($fline =~ /\bswitch\b|\b(?:break\s*;[\s$;]*$|exit\s*\(\b|return\b|goto\b|continue\b)/);
|
||||
}
|
||||
if (!$has_break && $has_statement) {
|
||||
WARN("MISSING_BREAK",
|
||||
|
Loading…
Reference in New Issue
Block a user