mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] checkpatch: Fix false positive on empty block comment lines
       [not found] <CGME20201006083511eucas1p213c64f56efcc905970fa2b26a05c55bf@eucas1p2.samsung.com>
@ 2020-10-06  8:35 ` Łukasz Stelmach
  2020-10-06  8:41   ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Łukasz Stelmach @ 2020-10-06  8:35 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches, linux-kernel
  Cc: Bartłomiej Żolnierkiewicz, Marek Szyprowski,
	Łukasz Stelmach

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@samsung.com>
---
 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);
 		}
-- 
2.26.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] checkpatch: Fix false positive on empty block comment lines
  2020-10-06  8:35 ` [PATCH v2] checkpatch: Fix false positive on empty block comment lines Łukasz Stelmach
@ 2020-10-06  8:41   ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2020-10-06  8:41 UTC (permalink / raw)
  To: Łukasz Stelmach, Andy Whitcroft, linux-kernel, Andrew Morton
  Cc: Bartłomiej Żolnierkiewicz, Marek Szyprowski

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@samsung.com>

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);
>  		}


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-06  8:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20201006083511eucas1p213c64f56efcc905970fa2b26a05c55bf@eucas1p2.samsung.com>
2020-10-06  8:35 ` [PATCH v2] checkpatch: Fix false positive on empty block comment lines Łukasz Stelmach
2020-10-06  8:41   ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®