linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Alexandre Ghiti <alex@ghiti.fr>,
	Andy Whitcroft <apw@canonical.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scripts: checkpatch: Check block comments start with /* empty line outside net
Date: Tue, 05 Mar 2019 15:08:24 -0800	[thread overview]
Message-ID: <4b86da69fc4460a9992a5d90fe2a1673c2fa4f37.camel@perches.com> (raw)
In-Reply-To: <20190305180238.32630-1-alex@ghiti.fr>

On Tue, 2019-03-05 at 13:02 -0500, Alexandre Ghiti wrote:
> This patch ensures that apart from net code, block comments start with an
> empty /* line.

I'm not sure it's useful to try to eliminate these types
of lines as there are ~20K of them in the kernel

$ git grep -P "^\/\*\s*\S" | \
  grep -v "\*/\s*$" | \
  grep -vP "^(drivers/net|net/)" | \
  grep -vP "\/\*\**$" | \
  wc -l
19437

Also, perhaps the code would be simpler using something like:
---
 scripts/checkpatch.pl | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d0001fd1112d..c62dbd440c50 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3262,6 +3262,17 @@ sub process {
 			     "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev);
 		}
 
+# Block comments use an initial blank /* unless self contained single line
+# or a continuous header line like /**********************
+# This also allows for introductory kernel-doc /** lines
+		if ($realfile !~ m@(?:drivers/net|net/)@ &&
+		    $rawline =~ m@^\+\s*/\*(?:\s*\*++)?\s*\S@ &&
+		    $rawline !~ m@\*/\s*$@ &&
+		    $realline > 2) {
+			WARN("BLOCK_COMMENT_STYLE",
+			     "Block comments start with only /* on an otherwise blank line\n" . $herecurr);
+		}
+
 # Block comments use * on subsequent lines
 		if ($prevline =~ /$;[ \t]*$/ &&			#ends in comment
 		    $prevrawline =~ /^\+.*?\/\*/ &&		#starting /*



  reply	other threads:[~2019-03-05 23:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2019-03-06 12:12   ` Alexandre Ghiti
2019-03-17 15:48     ` Alex Ghiti
2019-03-25  7:08       ` Alex Ghiti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4b86da69fc4460a9992a5d90fe2a1673c2fa4f37.camel@perches.com \
    --to=joe@perches.com \
    --cc=alex@ghiti.fr \
    --cc=apw@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).