From: Hugues FRUCHET <hugues.fruchet@st.com>
To: Joe Perches <joe@perches.com>, Andy Whitcroft <apw@canonical.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] checkpatch: test missing initial blank line in block comment
Date: Fri, 7 Apr 2017 09:56:31 +0000 [thread overview]
Message-ID: <bb5eb3fe-f089-3961-731f-60e22392efb1@st.com> (raw)
In-Reply-To: <654b3487-23a1-4766-4f42-73fa41fd7c9a@st.com>
Hi Joe,
here is the output with the last version of the script:
https://paste.ubuntu.com/24333124/
Differences are on the macro cases and the //foo \ *bar, no more warned.
BR,
Hugues.
On 04/05/2017 03:26 PM, Hugues Fruchet wrote:
>
>
> On 04/05/2017 11:55 AM, Joe Perches wrote:
>> 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 /*<tab><\>
>>> $rawline =~ /^\+[ \t]*\*/ &&
>>> $realline > 2) {
>>
>> Perhaps it's better to change this to
>>
>> $prevrawline !~ /^\+\s*\/\*.*\\$/
>
> KO with this line, I suspect you meant "\s" instead of "." in above
> expression, so I've changed to:
> $prevrawline !~ /^\+\s*\/\*\s*\\$/
> this one is OK
>
>>
>> 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.
>>
>
> Sorry for my poor understanding of the script but I don't catch what you
> meant regarding "raw" and non "raw" variables, so I've done the job
> simply by excluding the lines starting with "//":
> $prevrawline !~ /^\+.*\/\/.*[ \t]*/ && #no inline //
>
> Which gives finally:
>
> # Missing initial /*
> if ($realfile !~ m@^(drivers/net/|net/)@ && #networking exception
> $prevrawline =~ /^\+[ \t]\/\**.+[ \t]/ && #start with /*...
> $prevrawline !~ /^\+.*\/\*.*\*\/[ \t]*/ && #no inline /*...*/
> + $prevrawline !~ /^\+.*\/\/.*[ \t]*/ && #no inline //
> + $prevrawline !~ /^\+\s*\/\*\s*\\$/ && #no macro /*<whitespace><\>
> $rawline =~ /^\+[ \t]*\*/ &&
> $realline > 2) {
> WARN("MISSING_INITIAL_BLOCK_COMMENT_STYLE",
> "Block comments starts with an empty /*\n" . $hereprev);
> }
>
>
> BR,
> Hugues.
next prev parent reply other threads:[~2017-04-07 9:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-03 8:08 [PATCH v1] checkpatch: test missing initial blank line in block comment Hugues Fruchet
2017-04-03 8:08 ` Hugues Fruchet
2017-04-03 19:06 ` Joe Perches
2017-04-05 8:23 ` Hugues FRUCHET
2017-04-05 8:35 ` Joe Perches
2017-04-05 9:43 ` Hugues FRUCHET
2017-04-05 9:55 ` Joe Perches
2017-04-05 13:26 ` Hugues FRUCHET
2017-04-07 9:56 ` Hugues FRUCHET [this message]
2017-04-07 10:22 ` Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bb5eb3fe-f089-3961-731f-60e22392efb1@st.com \
--to=hugues.fruchet@st.com \
--cc=apw@canonical.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).