mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugues Fruchet <hugues.fruchet@st.com>
To: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH v1] checkpatch: test missing initial blank line in block comment
Date: Mon, 3 Apr 2017 10:08:15 +0200	[thread overview]
Message-ID: <1491206895-24332-2-git-send-email-hugues.fruchet@st.com> (raw)
In-Reply-To: <1491206895-24332-1-git-send-email-hugues.fruchet@st.com>

Warn when block comments are not starting with blank comment:

/* multiple lines
 * block comment,
 * => warning
 */

/*
 * multiple lines
 * block comment,
 * => no warning
 */

Exception made for networking files where rule is the
exact opposite.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
---
 scripts/checkpatch.pl | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index baa3c7b..8754c9d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3000,6 +3000,17 @@ sub process {
 			     "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev);
 		}
 
+# Block comment styles
+# Missing initial /*
+		if ($realfile !~ m@^(drivers/net/|net/)@ &&	#networking exception
+		    $prevrawline =~ /^\+[ \t]\/\**.+[ \t]/ &&	#start with /*...
+		    $prevrawline !~ /^\+.*\/\*.*\*\/[ \t]*/ &&	#no inline /*...*/
+		    $rawline =~ /^\+[ \t]*\*/ &&
+		    $realline > 2) {
+			WARN("BLOCK_COMMENT_STYLE",
+			     "Block comments starts with an empty /*\n" . $hereprev);
+		}
+
 # Block comments use * on subsequent lines
 		if ($prevline =~ /$;[ \t]*$/ &&			#ends in comment
 		    $prevrawline =~ /^\+.*?\/\*/ &&		#starting /*
-- 
1.9.1

  reply	other threads:[~2017-04-03  8:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03  8:08 Hugues Fruchet
2017-04-03  8:08 ` Hugues Fruchet [this message]
2017-04-03 19:06   ` Joe Perches
2017-04-05  8:23     ` Hugues FRUCHET
2017-04-05  8:35       ` Joe Perches
2017-04-05  9:43         ` Hugues FRUCHET
2017-04-05  9:55           ` Joe Perches
2017-04-05 13:26             ` Hugues FRUCHET
2017-04-07  9:56               ` Hugues FRUCHET
2017-04-07 10:22                 ` Joe Perches

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=1491206895-24332-2-git-send-email-hugues.fruchet@st.com \
    --to=hugues.fruchet@st.com \
    --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

all inboxes | Powered by JetHome®