Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751129AbdIJRz6 (ORCPT ); Sun, 10 Sep 2017 13:55:58 -0400 Received: from smtprelay0114.hostedemail.com ([216.40.44.114]:53977 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750730AbdIJRz5 (ORCPT ); Sun, 10 Sep 2017 13:55:57 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:599:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:2898:3138:3139:3140:3141:3142:3352:3622:3876:3877:4321:5007:6114:6642:7903:10004:10400:10848:11232:11658:11914:12043:12740:12760:12895:13069:13311:13357:13439:14181:14659:14721:21080:21451:21627:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: dress12_16947c77f2835 X-Filterd-Recvd-Size: 1767 Message-ID: <1505066153.22023.2.camel@perches.com> Subject: Re: [PATCH v2 1/1] scripts/checkpatch.pl: avoid false warning missing break From: Joe Perches To: Heinrich Schuchardt , Andrew Morton Cc: Andy Whitcroft , linux-kernel@vger.kernel.org Date: Sun, 10 Sep 2017 10:55:53 -0700 In-Reply-To: <20170910154618.25819-1-xypron.glpk@gmx.de> References: <1505052969.22023.1.camel@perches.com> <20170910154618.25819-1-xypron.glpk@gmx.de> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 879 Lines: 30 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 Acked-by: Joe Perches > 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",