[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1353691473.28931.8.camel@joe-AO722>
Date: Fri, 23 Nov 2012 09:24:33 -0800
From: Joe Perches <joe@...ches.com>
To: Andy Whitcroft <apw@...onical.com>
Cc: Glauber Costa <glommer@...allels.com>,
Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] checkpatch: Add --strict messages for blank lines around
braces
Blank lines around braces are not unnecessary.
Emit a message on the use of these blank lines only when
using --strict.
int foo(int bar)
{
something or other....
}
is generally written in the kernel as:
int foo(int bar)
{
something or other...
}
Signed-off-by: Joe Perches <joe@...ches.com>
---
scripts/checkpatch.pl | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 13ce29e..6d0247f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3184,6 +3184,16 @@ sub process {
}
}
+# check for unnecessary blank lines around braces
+ if (($line =~ /^..*}\s*$/ && $prevline =~ /^.\s*$/)) {
+ CHK("BRACES",
+ "Blank lines aren't necessary before a close brace '}'\n" . $hereprev);
+ }
+ if (($line =~ /^.\s*$/ && $prevline =~ /^..*{\s*$/)) {
+ CHK("BRACES",
+ "Blank lines aren't necessary after an open brace '{'\n" . $hereprev);
+ }
+
# no volatiles please
my $asm_volatile = qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b};
if ($line =~ /\bvolatile\b/ && $line !~ /$asm_volatile/) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists