mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
checkpatch: if should not continue a preceeding brace
We should not be continuing a braced section with an if, for example: if (...) { } if (...) { } Detect this and suggest adding a newline. Signed-off-by: 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
63f17f8973
commit
3966778236
1 changed files with 5 additions and 0 deletions
|
@ -2108,6 +2108,11 @@ sub process {
|
|||
ERROR("trailing statements should be on next line\n" . $herecurr);
|
||||
}
|
||||
}
|
||||
# if should not continue a brace
|
||||
if ($line =~ /}\s*if\b/) {
|
||||
ERROR("trailing statements should be on next line\n" .
|
||||
$herecurr);
|
||||
}
|
||||
# case and default should not have general statements after them
|
||||
if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g &&
|
||||
$line !~ /\G(?:
|
||||
|
|
Loading…
Reference in a new issue