lkml.org 
[lkml]   [2020]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] checkpatch: add check for NONNETWORKING_BLOCK_COMMENT_STYLE
From
Date
On Wed, 2020-06-10 at 13:26 -0700, Scott Branden wrote:
> NETWORKING_BLOCK_COMMENT_STYLE is supported by checkpatch but there
> doesn't seem to be any check for the standard block comment style.
> Add support for NONNETWORKING_BLOCK_COMMENT_STYLE to check for empty /*
> on first line of non-networking block comments.

I think there are _way_ too many instances of this form
in non-networking code to enable this.

$ git grep -P '^\s*/\*\s*\S.*[^\*][^\\]\s*$' -- '*.[ch]' | \
grep -v -P '^(drivers/net/|net/)' | \
wc -l
51407

(with a few false positives)

Does anyone really care if non-network code uses
this style?

/* multiline
* comment
*/

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3408,6 +3408,16 @@ sub process {
> "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev);
> }
>
> +# Non-Networking with an empty initial /*
> + if ($realfile !~ m@^(drivers/net/|net/)@ &&
> + $prevrawline =~ /^\+[ \t]*\/\*[ \t]/ &&
> + $prevrawline !~ /\*\/[ \t]*$/ && #no trailing */
> + $rawline =~ /^\+[ \t]*\*/ &&
> + $realline > 2) {
> + WARN("NONNETWORKING_BLOCK_COMMENT_STYLE",
> + "non-networking block comments use an empty /* on first line\n" . $hereprev);
> + }
> +
> # Block comments use * on subsequent lines
> if ($prevline =~ /$;[ \t]*$/ && #ends in comment
> $prevrawline =~ /^\+.*?\/\*/ && #starting /*

\
 
 \ /
  Last update: 2020-06-10 23:17    [W:6.720 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site