public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Whitcroft <apw@canonical.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/1] scripts/checkpatch.pl: avoid false warning missing break
Date: Sun, 10 Sep 2017 10:55:53 -0700	[thread overview]
Message-ID: <1505066153.22023.2.camel@perches.com> (raw)
In-Reply-To: <20170910154618.25819-1-xypron.glpk@gmx.de>

On Sun, 2017-09-10 at 17:46 +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.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Acked-by: Joe Perches <joe@perches.com>

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -6084,7 +6084,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",

      reply	other threads:[~2017-09-10 17:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-10  7:52 [PATCH 1/1] scripts/checkpatch.pl: avoid false warning missing break Heinrich Schuchardt
2017-09-10 14:16 ` Joe Perches
2017-09-10 15:46   ` [PATCH v2 " Heinrich Schuchardt
2017-09-10 17:55     ` Joe Perches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1505066153.22023.2.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox