diff options
author | Joe Perches <joe@perches.com> | 2012-12-18 04:01:59 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-18 05:15:19 +0400 |
commit | 0979ae66464bd9793c6701861bccb21f9f118a52 (patch) | |
tree | e2e7a6f513aba1c433dbad1ccbb24adb834ca406 /scripts | |
parent | 481eb486a88c9b068f0168ac4c21291802720933 (diff) | |
download | linux-0979ae66464bd9793c6701861bccb21f9f118a52.tar.xz |
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@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/checkpatch.pl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 3e9fee60642c..e0a674f471ee 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/) { |