[PATCH] checkpatch: Always warn on missing blank line after variable declaration block

From: Joe Perches
Date: Thu Mar 06 2014 - 19:11:39 EST


Make the test system wide, modify the message too.

Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
---
> OK, let's do this for now. Could you please cook up a followon patch
> which makes this kernel-wide? I'll play with that for a while then I'll
> decide how much I feel like irritating people.

scripts/checkpatch.pl | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a6e3048..37a94f1 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2249,8 +2249,7 @@ sub process {
}

# check for missing blank lines after declarations
- if ($realfile =~ m@^(drivers/net/|net/)@ &&
- $prevline =~ /^\+\s+$Declare\s+$Ident/ &&
+ if ($prevline =~ /^\+\s+$Declare\s+$Ident/ &&
!($prevline =~ /(?:$Compare|$Assignment|$Operators)\s*$/ ||
$prevline =~ /(?:\{\s*|\\)$/) && #extended lines
$sline =~ /^\+\s+/ && #Not at char 1
@@ -2260,7 +2259,7 @@ sub process {
$sline =~ /^\+\s+(?:$|[\{\}\.\#\"\?\:\(])/ ||
$sline =~ /^\+\s+\(?\s*(?:$Compare|$Assignment|$Operators)/)) {
WARN("SPACING",
- "networking uses a blank line after declarations\n" . $hereprev);
+ "Missing a blank line after declarations\n" . $hereprev);
}

# check for spaces at the beginning of a line.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/