Re: CodingStyle vs checkpatch for block comments

From: Chris Metcalf
Date: Tue Apr 03 2012 - 14:08:14 EST


On 4/3/2012 1:41 PM, Joe Perches wrote:
> On Tue, 2012-04-03 at 13:25 -0400, Chris Metcalf wrote:
>> The relevant code in checkpatch.pl is:
>>
>> if ($rawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&
>> $prevrawline =~ /^\+[ \t]*$/) {
>> CHK("BLOCK_COMMENT_STYLE",
>> "Don't begin block comments with only a /*
>> line, use /* comment...\n" . $hereprev);
>> }
>>
>> So, my questions -
>>
>> 1. I'm not sure what the regexps are really trying to avoid. Presumably a
>> blank line followed by a block comment is OK? Certainly the kernel sources
>> are full of this construct.
> It emits a check message on
> <blank line>
> /*
>
> but not
> <blank line>
> /* some actual comment

Right, I understand what the regexps do, I'm just not clear on what the
rationale is. Is it trying to ensure that multi-line block comments are
never preceded by a blank line? Is it trying to change the format of block
comments such that they either are preceded by a blank line, or a
standalone "/*", but not both? Confusing.

>> 2. The actual warning message emitted seems to directly contradict the
>> CodingStyle document, so presumably we should either clarify the message,
>> or update CodingStyle if we're really trying to change the style.
> Or just remove it or add a test for the patched file
> to be in net/... or drivers/net... or something.

Obviously removing it would be an easy fix. :-) I don't know if it makes
sense to advocate for different kernel comment styles in different subtrees.

--
Chris Metcalf, Tilera Corp.
http://www.tilera.com

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/