Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932996AbdDEJzz (ORCPT ); Wed, 5 Apr 2017 05:55:55 -0400 Received: from smtprelay0224.hostedemail.com ([216.40.44.224]:60909 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932403AbdDEJz2 (ORCPT ); Wed, 5 Apr 2017 05:55:28 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::,RULES_HIT:41:355:379:541:599:960:968:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3355:3622:3653:3865:3867:3868:3870:3871:3872:3873:3874:4250:4321:4605:5007:7903:10004:10400:10848:11026:11232:11657:11658:11914:12043:12555:12740:12760:12895:13439:14180:14181:14659:14721:21060:21080:21324:21451:30012: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: jeans99_f35ed354c109 X-Filterd-Recvd-Size: 3397 Message-ID: <1491386103.27353.78.camel@perches.com> Subject: Re: [PATCH v1] checkpatch: test missing initial blank line in block comment From: Joe Perches To: Hugues FRUCHET , Andy Whitcroft Cc: "linux-kernel@vger.kernel.org" Date: Wed, 05 Apr 2017 02:55:03 -0700 In-Reply-To: <6755c558-baeb-307d-5a3e-f58650457cd3@st.com> References: <1491206895-24332-1-git-send-email-hugues.fruchet@st.com> <1491206895-24332-2-git-send-email-hugues.fruchet@st.com> <1491246400.27353.59.camel@perches.com> <5518d438-7c73-2ba0-de77-0650742895e6@st.com> <1491381342.27353.76.camel@perches.com> <6755c558-baeb-307d-5a3e-f58650457cd3@st.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.3-0ubuntu0.1 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: 2264 Lines: 64 On Wed, 2017-04-05 at 09:43 +0000, Hugues FRUCHET wrote: > > On 04/05/2017 10:35 AM, Joe Perches wrote: > > On Wed, 2017-04-05 at 08:23 +0000, Hugues FRUCHET wrote: > > > Hi Joe, thanks for reviewing, > > > > Hello Hugues > > > > > I have run the command you advice on the entire kernel code, modifying > > > the script to only match the newly introduced check case. > > > There was 14389 hits, quite huge, so I cannot 100% certify that there > > > are no false positives, but I have checked the output carefully and > > > found 2 limit cases: > > > > > > 1) space character placed just after "/*" > > > WARNING: Block comments starts with an empty /* > > > #330: FILE: arch/alpha/kernel/core_irongate.c:330: > > > + /* > > > + * Check for within the AGP aperture... > > > => 146 hits (grep -c -n -E "\/\* $" /tmp/check.txt) > > > > > > 2) // style comment followed by pointer dereference > > > WARNING: Block comments starts with an empty /* > > > #426: FILE: drivers/media/dvb-core/dvb_ca_en50221.c:426: > > > + // success > > > + *tupleType = _tupleType; > > > => 4 hits > > > > > > Anyway this reveal comment style related issues, so I would say that we > > > can keep script as it is, what do you think about ? > > > > Glancing at the output, there is also the comment > > in a multiline macro case: > > > > WARNING: Block comments starts with an empty /* > > #354: FILE: arch/mips/include/asm/processor.h:354: > > + /* \ > > + * Other stuff associated with the process \ > > > > Dunno how common that is, but maybe the test > > should be changed to avoid those. > > > > Here is a proposal that remove this macro case:Per > > # Missing initial /* > if ($realfile !~ m@^(drivers/net/|net/)@ && #networking exception > $prevrawline =~ /^\+[ \t]\/\**.+[ \t]/ && #start with /*... > $prevrawline !~ /^\+.*\/\*.*\*\/[ \t]*/ && #no inline /*...*/ > + $prevrawline !~ /^\+[ \t]\/\*+[ \t]+\\$/ &&#no macro /*<\> > $rawline =~ /^\+[ \t]*\*/ && > $realline > 2) { Perhaps it's better to change this to $prevrawline !~ /^\+\s*\/\*.*\\$/ Also perhaps the // foo *bar = baz; case could be avoided by adding tests for the comment character $; on $prevline and $line and not looking only at $prevrawline and $rawline.