Re: [PATCH v2] checkpatch: Fix false positive on empty block comment lines

From: Joe Perches
Date: Tue Oct 06 2020 - 04:42:01 EST


On Tue, 2020-10-06 at 10:35 +0200, Łukasz Stelmach wrote:
> To avoid false positives in presence of SPDX-License-Identifier in
> networking files it is required to increase the leeway for empty block
> comment lines by one line.
>
> For example, checking drivers/net/loopback.c which starts with
>
> // SPDX-License-Identifier: GPL-2.0-or-later
> /*
> * INET An implementation of the TCP/IP protocol suite for the LINUX
>
> rsults in an unnecessary warning
>
> WARNING: networking block comments don't use an empty /* line, use /* Comment...
> +/*
> + * INET An implementation of the TCP/IP protocol suite for the LINUX
>
> Signed-off-by: Łukasz Stelmach <l.stelmach@xxxxxxxxxxx>

Thank Lukasz. Andrew, can you please pick this up?

> ---
> scripts/checkpatch.pl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Changes in v2:
> - added example warning in the commit description
> - added a comment in the code
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index a213cdb82ab0..3555ac812c99 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3460,7 +3460,7 @@ sub process {
> if ($realfile =~ m@^(drivers/net/|net/)@ &&
> $prevrawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&
> $rawline =~ /^\+[ \t]*\*/ &&
> - $realline > 2) {
> + $realline > 3) { # Do not warn about the initial copyright comment block after SPDX-License-Identifier
> WARN("NETWORKING_BLOCK_COMMENT_STYLE",
> "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev);
> }