[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1505052969.22023.1.camel@perches.com>
Date: Sun, 10 Sep 2017 07:16:09 -0700
From: Joe Perches <joe@...ches.com>
To: Heinrich Schuchardt <xypron.glpk@....de>,
Andy Whitcroft <apw@...onical.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] scripts/checkpatch.pl: avoid false warning missing
break
On Sun, 2017-09-10 at 09:52 +0200, Heinrich Schuchardt wrote:
> 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.
OK, but
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -4361,7 +4361,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\(\b|return\b|goto\b|continue\b)/);
exit\s*\(
Although this could have a false negative
on some code.
Powered by blists - more mailing lists