Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751785AbdIJOQN (ORCPT ); Sun, 10 Sep 2017 10:16:13 -0400 Received: from smtprelay0111.hostedemail.com ([216.40.44.111]:60205 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751576AbdIJOQM (ORCPT ); Sun, 10 Sep 2017 10:16:12 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::,RULES_HIT:41:355:379:541:599: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:21627:30012: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:1,LUA_SUMMARY:none X-HE-Tag: group95_8d4ac9e60ba50 X-Filterd-Recvd-Size: 1572 Message-ID: <1505052969.22023.1.camel@perches.com> Subject: Re: [PATCH 1/1] scripts/checkpatch.pl: avoid false warning missing break From: Joe Perches To: Heinrich Schuchardt , Andy Whitcroft Cc: linux-kernel@vger.kernel.org Date: Sun, 10 Sep 2017 07:16:09 -0700 In-Reply-To: <20170910075249.13997-1-xypron.glpk@gmx.de> References: <20170910075249.13997-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: 771 Lines: 30 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.