linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scripts: checkpatch: Check block comments start with /* empty line outside net
@ 2019-03-05 18:02 Alexandre Ghiti
  2019-03-05 23:08 ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Ghiti @ 2019-03-05 18:02 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches, linux-kernel; +Cc: Alexandre Ghiti

This patch ensures that apart from net code, block comments start with an
empty /* line.

Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
---
 scripts/checkpatch.pl | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 7dc12c137009..bcaf5d317976 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3230,12 +3230,21 @@ sub process {
 
 # Block comment styles
 # Networking with an initial /*
-		if ($realfile =~ m@^(drivers/net/|net/)@ &&
-		    $prevrawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&
-		    $rawline =~ /^\+[ \t]*\*/ &&
-		    $realline > 2) {
-			WARN("NETWORKING_BLOCK_COMMENT_STYLE",
-			     "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev);
+		if ($realfile =~ m@^(drivers/net/|net/)@) {
+			if ($prevrawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&
+			    $rawline =~ /^\+[ \t]*\*/ &&
+			    $realline > 2) {
+				WARN("NETWORKING_BLOCK_COMMENT_STYLE",
+				     "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev);
+			}
+		} else {
+# 'Normal' with an initial empty /*
+			if ($prevrawline =~ /^\+[ \t]*\/\*[ \t]*\S/ &&
+			    $rawline =~ /^\+[ \t]*\*/ &&
+			    $realline > 2) {
+				WARN("BLOCK_COMMENT_STYLE",
+				     "block comments use an empty /* line, don't use /* Comment...\n" . $hereprev);
+			}
 		}
 
 # Block comments use * on subsequent lines
-- 
2.20.1


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

end of thread, other threads:[~2019-03-25  7:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-05 18:02 [PATCH] scripts: checkpatch: Check block comments start with /* empty line outside net Alexandre Ghiti
2019-03-05 23:08 ` Joe Perches
2019-03-06 12:12   ` Alexandre Ghiti
2019-03-17 15:48     ` Alex Ghiti
2019-03-25  7:08       ` Alex Ghiti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).