[PATCH] scripts: checkpatch: Check block comments start with /* empty line outside net
From: Alexandre Ghiti
Date: Tue Mar 05 2019 - 13:02:46 EST
This patch ensures that apart from net code, block comments start with an
empty /* line.
Signed-off-by: Alexandre Ghiti <alex@xxxxxxxx>
---
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