From: Alexandre Ghiti <alex@ghiti.fr>
To: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>,
linux-kernel@vger.kernel.org
Cc: Alexandre Ghiti <alex@ghiti.fr>
Subject: [PATCH] scripts: checkpatch: Check block comments start with /* empty line outside net
Date: Tue, 5 Mar 2019 13:02:38 -0500 [thread overview]
Message-ID: <20190305180238.32630-1-alex@ghiti.fr> (raw)
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
next reply other threads:[~2019-03-05 18:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-05 18:02 Alexandre Ghiti [this message]
2019-03-05 23:08 ` [PATCH] scripts: checkpatch: Check block comments start with /* empty line outside net Joe Perches
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=20190305180238.32630-1-alex@ghiti.fr \
--to=alex@ghiti.fr \
--cc=apw@canonical.com \
--cc=joe@perches.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).