mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 17:22:07 +00:00
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>
This commit is contained in:
parent
481eb486a8
commit
0979ae6646
@ -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/) {
|
||||
|
Loading…
Reference in New Issue
Block a user