summaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-08-07 01:10:42 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-07 03:01:27 +0200
commit365dd4eaafa22d2c79913d5f057d636e8842c470 (patch)
tree73921bbddacb64cbb5b203cab91d55422bd23dfa /scripts/checkpatch.pl
parentcheckpatch: add test for blank lines after function/struct/union/enum (diff)
downloadlinux-365dd4eaafa22d2c79913d5f057d636e8842c470.tar.xz
linux-365dd4eaafa22d2c79913d5f057d636e8842c470.zip
checkpatch: add a multiple blank lines test
Multiple consecutive blank lines waste screen space. Emit a --strict only message with these blank lines. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9e4ba9fa9bc8..fad2116f51a4 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1642,6 +1642,8 @@ sub process {
my $non_utf8_charset = 0;
+ my $last_blank_line = 0;
+
our @report = ();
our $cnt_lines = 0;
our $cnt_error = 0;
@@ -2308,6 +2310,15 @@ sub process {
"Please use a blank line after function/struct/union/enum declarations\n" . $hereprev);
}
+# check for multiple consecutive blank lines
+ if ($prevline =~ /^[\+ ]\s*$/ &&
+ $line =~ /^\+\s*$/ &&
+ $last_blank_line != ($linenr - 1)) {
+ CHK("LINE_SPACING",
+ "Please don't use multiple blank lines\n" . $hereprev);
+ $last_blank_line = $linenr;
+ }
+
# check for missing blank lines after declarations
if ($sline =~ /^\+\s+\S/ && #Not at char 1
# actual declarations