From patchwork Thu Sep 14 05:33:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 9952455 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 988C0602C9 for ; Thu, 14 Sep 2017 05:34:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BF6928B58 for ; Thu, 14 Sep 2017 05:34:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 809A528BC1; Thu, 14 Sep 2017 05:34:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 62CD228BA3 for ; Thu, 14 Sep 2017 05:34:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Mime-Version:References:In-Reply-To: Date:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7jQEaBYwuk9VVQngxMV2yxLn1HasDNZsKUcZJ052240=; b=VVxhM7zryY00DG yWe1hS3yA5c+AIxh8lYd1qDAwLpn9nBXO7gBJoplU7tfB0jFnvpzjqg25byx/SijWraqsRd8PIGBN xqVazMv45S4PKdHVSVCfGiVG3wPUeoB4erxqfj6raT7cpO+mBEJ0xTsE8PppNNeFMpGb9Mh3aLk7m Nbnutx23va9A1VQEmzuMwkfMo6fe7OYLE4U2iyImcvY+qNCj4TAom3LsD2FmWPEulYOzFyYwu/Jff ysq7DMOxNqxX4jAyTZYaQr4Bs9Q2MX4C5OePPBmg9+WJoqYGYt9/hpAfQAYs319yyYT+858YWmEGa JW6tkmD1bzAU6UrdiEYQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dsMn2-0007SN-Le; Thu, 14 Sep 2017 05:34:16 +0000 Received: from smtprelay0114.hostedemail.com ([216.40.44.114] helo=smtprelay.hostedemail.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dsMmz-0007Kc-5Y for linux-mediatek@lists.infradead.org; Thu, 14 Sep 2017 05:34:15 +0000 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 30BB6837F27B; Thu, 14 Sep 2017 05:33:44 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: pear81_207a18d9c7112 X-Filterd-Recvd-Size: 2650 Received: from XPS-9350 (unknown [47.151.132.55]) (Authenticated sender: joe@perches.com) by omf05.hostedemail.com (Postfix) with ESMTPA; Thu, 14 Sep 2017 05:33:43 +0000 (UTC) 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 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> X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170913_223413_292890_7E80E78A X-CRM114-Status: UNSURE ( 9.88 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, wsd_upstream@mediatek.com Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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) {