mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] checkpatch: warn about multi-line comments without an empty /* line
@ 2023-09-26 19:24 Petr Tesarik
  2023-09-26 19:56 ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Petr Tesarik @ 2023-09-26 19:24 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn, open list
  Cc: Catalin Marinas, Petr Tesarik

According to Documentation/process/coding-style.rst, the preferred style
for multi-line comments outside net/ and drivers/net/ is:

.. code-block:: c

        /*
         * This is the preferred style for multi-line
         * comments in the Linux kernel source code.
         * Please use it consistently.
         *
         * Description:  A column of asterisks on the left side,
         * with beginning and ending almost-blank lines.
         */

Signed-off-by: Petr Tesarik <petr@tesarici.cz>
---
 scripts/checkpatch.pl | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 7d16f863edf1..e48e7b4d08c0 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4006,6 +4006,14 @@ sub process {
 			     "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev);
 		}
 
+# Non-networking without an initial /*
+		if ($realfile !~ m@^(drivers/net/|net/)@ &&
+		    $prevrawline =~ /^\+[ \t]*\/\*.*[^ \t]$/ &&
+		    $rawline =~ /^\+[ \t]*\*/) {
+			WARN("BLOCK_COMMENT_STYLE",
+			     "multi-line block comments should start with an empty /* line\n" . $hereprev);
+		}
+
 # Block comments use * on subsequent lines
 		if ($prevline =~ /$;[ \t]*$/ &&			#ends in comment
 		    $prevrawline =~ /^\+.*?\/\*/ &&		#starting /*
-- 
2.42.0


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

end of thread, other threads:[~2023-09-27  6:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-26 19:24 [PATCH v2] checkpatch: warn about multi-line comments without an empty /* line Petr Tesarik
2023-09-26 19:56 ` Joe Perches
2023-09-26 20:16   ` Petr Tesařík
2023-09-26 20:39     ` Joe Perches
2023-09-27  6:19       ` Petr Tesařík

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®