lkml.org 
[lkml]   [2020]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] checkpatch: Fix false positive on empty block comment lines
From
Date
On Fri, 2020-10-02 at 21:15 +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.

Thanks.

An example in the commit description would be nice.

The intent here is to avoid the below error so the
second line of a networking file can be an initial blank

/*

$ ./scripts/checkpatch.pl -f drivers/net/Space.c
WARNING: networking block comments don't use an empty /* line, use /* Comment...
#3: FILE: drivers/net/Space.c:3:
+/*
+ * INET An implementation of the TCP/IP protocol suite for the LINUX

total: 0 errors, 1 warnings, 0 checks, 155 lines checked

> Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
> ---
> scripts/checkpatch.pl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index a213cdb82ab0..60e10da4cccb 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) {
> WARN("NETWORKING_BLOCK_COMMENT_STYLE",
> "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev);
> }

Maybe add a comment in the code too:

---
scripts/checkpatch.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a213cdb82ab0..632c543b108d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3457,10 +3457,11 @@ sub process {

# Block comment styles
# Networking with an initial /*
+# allow an initial blank /* at the top of the file with or without an SPDX line
if ($realfile =~ m@^(drivers/net/|net/)@ &&
$prevrawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&
$rawline =~ /^\+[ \t]*\*/ &&
- $realline > 2) {
+ $realline > 3) {
WARN("NETWORKING_BLOCK_COMMENT_STYLE",
"networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev);
}

\
 
 \ /
  Last update: 2020-10-02 21:41    [W:0.075 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site