From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755966AbdJJIys (ORCPT ); Tue, 10 Oct 2017 04:54:48 -0400 Received: from smtprelay0017.hostedemail.com ([216.40.44.17]:34189 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755960AbdJJIyq (ORCPT ); Tue, 10 Oct 2017 04:54:46 -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:2197:2199:2393:2559:2562:2693:2828:3138:3139:3140:3141:3142:3150:3352:3622:3653:3865:3870:3871:3874:4321:5007:10004:10400:10848:11232:11658:11914:12043:12555:12740:12760:12895:13069:13161:13229:13311:13357:13439:14181:14659:14721:21080:21221:21451:21627:30054:30070: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: food43_63992259bc648 X-Filterd-Recvd-Size: 1788 Message-ID: <1507625682.3552.30.camel@perches.com> Subject: Re: [PATCH] scripts/checkpatch.pl: fix false warning of externs checking. From: Joe Perches To: Jiang Biao , apw@canonical.com Cc: linux-kernel@vger.kernel.org, zhong.weidong@zte.com.cn Date: Tue, 10 Oct 2017 01:54:42 -0700 In-Reply-To: <1507624970-4609-1-git-send-email-jiang.biao2@zte.com.cn> References: <1507624970-4609-1-git-send-email-jiang.biao2@zte.com.cn> 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 On Tue, 2017-10-10 at 16:42 +0800, Jiang Biao wrote: > When adding a function declaration in a .c file without an extern > keywork decoration, checkpatch.pl will complain *externs should be > avoided in .c files* false warning. This patch fix the bug. nack. The point is that external function declarations should be done via #include. > Signed-off-by: Jiang Biao > --- > scripts/checkpatch.pl | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index dd2c262..170daf1 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -5927,7 +5927,7 @@ sub process { > > # check for new externs in .c files. > if ($realfile =~ /\.c$/ && defined $stat && > - $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s) > + $stat =~ /^.\s*(?:extern\s+)$Type\s+($Ident)(\s*)\(/s) > { > my $function_name = $1; > my $paren_space = $2;