From: Joe Perches Date: Tue, 18 Dec 2012 00:01:59 +0000 (-0800) Subject: checkpatch: Add --strict messages for blank lines around braces X-Git-Tag: v3.8-rc1~74^2~99 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0979ae66464bd9793c6701861bccb21f9f118a52;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git 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 Cc: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 3e9fee6..e0a674f 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3189,6 +3189,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/) {