Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754592AbdDEIZE convert rfc822-to-8bit (ORCPT ); Wed, 5 Apr 2017 04:25:04 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:29879 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754557AbdDEIXm (ORCPT ); Wed, 5 Apr 2017 04:23:42 -0400 From: Hugues FRUCHET To: Joe Perches , Andy Whitcroft CC: "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v1] checkpatch: test missing initial blank line in block comment Thread-Topic: [PATCH v1] checkpatch: test missing initial blank line in block comment Thread-Index: AQHSrK1seI0c+MrB6EOR0d8E/iXMYKG2UPMA Date: Wed, 5 Apr 2017 08:23:37 +0000 Message-ID: <5518d438-7c73-2ba0-de77-0650742895e6@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> In-Reply-To: <1491246400.27353.59.camel@perches.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.75.127.44] Content-Type: text/plain; charset="Windows-1252" Content-ID: <9E9361C931FA0E45B24C45AD25D40855@st.com> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-05_07:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2933 Lines: 104 Hi Joe, thanks for reviewing, 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 ? Here is the count detail by first level of directories within kernel: $ grep FILE /tmp/check.txt | grep -c "FILE: drivers/" 8859 $ grep FILE /tmp/check.txt | grep -c "FILE: arch/" 2306 $ grep FILE /tmp/check.txt | grep -c "FILE: fs/" 1136 $ grep FILE /tmp/check.txt | grep -c "FILE: sound/" 810 $ grep FILE /tmp/check.txt | grep -c "FILE: include/" 669 $ grep FILE /tmp/check.txt | grep -c "FILE: kernel/" 143 $ grep FILE /tmp/check.txt | grep -c "FILE: security/" 112 $ grep FILE /tmp/check.txt | grep -c "FILE: lib/" 91 $ grep FILE /tmp/check.txt | grep -c "FILE: tools/" 81 $ grep FILE /tmp/check.txt | grep -c "FILE: crypto/" 54 $ grep FILE /tmp/check.txt | grep -c "FILE: scripts/" 44 $ grep FILE /tmp/check.txt | grep -c "FILE: mm/" 35 $ grep FILE /tmp/check.txt | grep -c "FILE: block/" 27 $ grep FILE /tmp/check.txt | grep -c "FILE: virt/" 8 $ grep FILE /tmp/check.txt | grep -c "FILE: samples/" 5 $ grep FILE /tmp/check.txt | grep -c "FILE: ipc/" 5 $ grep FILE /tmp/check.txt | grep -c "FILE: certs/" 1 The complete output is there for reference: http://paste.ubuntu.com/24319042/ Best regards, Hugues. On 04/03/2017 09:06 PM, Joe Perches wrote: > On Mon, 2017-04-03 at 10:08 +0200, Hugues Fruchet wrote: >> Warn when block comments are not starting with blank comment: >> >> /* multiple lines >> * block comment, >> * => warning >> */ >> >> /* >> * multiple lines >> * block comment, >> * => no warning >> */ >> >> Exception made for networking files where rule is the >> exact opposite. > > I recall there was some reason I didn't do this > when adding the block comment code, but I don't > recall what it was. Perhaps it was the initial > line of files. > > Maybe your $realline > 2 test fixes it. Maybe not. > Dunno. > > If you run this against the entire kernel code > using a unique test type and not BLOCK_COMMENT_STYLE > are there any false positives? > > Maybe test with something like: > > $ git ls-files -- "*.[ch]" | \ > xargs --max-args 20 ./scripts/checkpatch.pl -f --types= >