From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751278AbdINFdq (ORCPT ); Thu, 14 Sep 2017 01:33:46 -0400 Received: from smtprelay0072.hostedemail.com ([216.40.44.72]:42317 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750792AbdINFdp (ORCPT ); Thu, 14 Sep 2017 01:33:45 -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:1541:1593:1594:1711:1730:1747:1777:1792:2197:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3653:3867:3868:3872:3874:4321:5007:10004:10400:10848:11232:11658:11783:11914:12043:12555:12740:12895:12986:13069:13255:13311:13357:13439:13894:14181:14659:14721:21080:21221:21451:21627:30029:30030: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:1,LUA_SUMMARY:none X-HE-Tag: pear81_207a18d9c7112 X-Filterd-Recvd-Size: 2650 Message-ID: <1505367221.8969.25.camel@perches.com> Subject: Re: [PATCH] checkpatch: support function pointers for unnamed function definition arguments From: Joe Perches To: Miles Chen , Andy Whitcroft Cc: linux-kernel@vger.kernel.org, wsd_upstream@mediatek.com, linux-mediatek@lists.infradead.org Date: Wed, 13 Sep 2017 22:33:41 -0700 In-Reply-To: <1505358082-12997-1-git-send-email-miles.chen@mediatek.com> References: <1505358082-12997-1-git-send-email-miles.chen@mediatek.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2017-09-14 at 11:01 +0800, Miles Chen wrote: > Current unnamed function definition argument does not include function > pointer cases and it reports warnings like: > > WARNING: function definition argument 'void' should also have an identifier name > > Support function pointers for unnamed function arguments. > > Signed-off-by: Miles Chen > --- > scripts/checkpatch.pl | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index dd2c262..dc6da15 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -5957,7 +5957,7 @@ sub process { > > # check for function declarations that have arguments without identifier names > if (defined $stat && > - $stat =~ /^.\s*(?:extern\s+)?$Type\s*$Ident\s*\(\s*([^{]+)\s*\)\s*;/s && > + $stat =~ /^.\s*(?:extern\s+)?$Type\s*\(?\s*\*?\s*$Ident\s*\)\s*\(\s*([^{]+)\s*\)\s*;/s && Better would be to specifically support function pointers like: ---  scripts/checkpatch.pl | 2 +-  1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 05dd72693621..7289c1eb0b19 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -5957,7 +5957,7 @@ sub process {    # check for function declarations that have arguments without identifier names   if (defined $stat && -     $stat =~ /^.\s*(?:extern\s+)?$Type\s*$Ident\s*\(\s*([^{]+)\s*\)\s*;/s && +     $stat =~ /^.\s*(?:extern\s+)?$Type\s*(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*\(\s*([^{]+)\s*\)\s*;/s &&       $1 ne "void") {   my $args = trim($1);   while ($args =~ m/\s*($Type\s*(?:$Ident|\(\s*\*\s*$Ident?\s*\)\s*$balanced_parens)?)/g) {