Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1614958

[PATCH v1] checkpatch: test missing initial blank line in block comment

From Hugues Fruchet <hugues.fruchet@st.com>
Newsgroups linux.kernel
Subject [PATCH v1] checkpatch: test missing initial blank line in block comment
Date 2017-04-03 10:10 +0200
Message-ID <ts5dM-4gF-3@gated-at.bofh.it> (permalink)
References <ts5dM-4gF-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH v1] checkpatch: test missing initial blank line in block comment Hugues Fruchet <hugues.fruchet@st.com> - 2017-04-03 10:10 +0200
  Re: [PATCH v1] checkpatch: test missing initial blank line in block  comment Joe Perches <joe@perches.com> - 2017-04-03 21:10 +0200
    Re: [PATCH v1] checkpatch: test missing initial blank line in block  comment Hugues FRUCHET <hugues.fruchet@st.com> - 2017-04-05 10:30 +0200
      Re: [PATCH v1] checkpatch: test missing initial blank line in block  comment Joe Perches <joe@perches.com> - 2017-04-05 10:40 +0200
        Re: [PATCH v1] checkpatch: test missing initial blank line in block  comment Hugues FRUCHET <hugues.fruchet@st.com> - 2017-04-05 11:50 +0200
          Re: [PATCH v1] checkpatch: test missing initial blank line in block  comment Joe Perches <joe@perches.com> - 2017-04-05 12:00 +0200
            Re: [PATCH v1] checkpatch: test missing initial blank line in block  comment Hugues FRUCHET <hugues.fruchet@st.com> - 2017-04-05 15:30 +0200
              Re: [PATCH v1] checkpatch: test missing initial blank line in block  comment Hugues FRUCHET <hugues.fruchet@st.com> - 2017-04-07 12:00 +0200
                Re: [PATCH v1] checkpatch: test missing initial blank line in block  comment Joe Perches <joe@perches.com> - 2017-04-07 12:30 +0200

csiph-web