提交 0fe3dc2b 编写于 作者: J Joe Perches 提交者: Linus Torvalds

checkpatch: add for_each tests to indentation and brace tests

All the various for_each loop macros were not tested for trailing brace
on the following lines and for bad indentation.

Add them.
Signed-off-by: NJoe Perches <joe@perches.com>
Reported-by: NGreg KH <gregkh@linuxfoundation.org>
Cc: Andy Whitcroft <apw@canonical.com
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 8b8856f4
...@@ -2698,7 +2698,7 @@ sub process { ...@@ -2698,7 +2698,7 @@ sub process {
# if/while/etc brace do not go on next line, unless defining a do while loop, # if/while/etc brace do not go on next line, unless defining a do while loop,
# or if that brace on the next line is for something else # or if that brace on the next line is for something else
if ($line =~ /(.*)\b((?:if|while|for|switch)\s*\(|do\b|else\b)/ && $line !~ /^.\s*\#/) { if ($line =~ /(.*)\b((?:if|while|for|switch|(?:[a-z_]+|)for_each[a-z_]+)\s*\(|do\b|else\b)/ && $line !~ /^.\s*\#/) {
my $pre_ctx = "$1$2"; my $pre_ctx = "$1$2";
my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0); my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0);
...@@ -2744,7 +2744,7 @@ sub process { ...@@ -2744,7 +2744,7 @@ sub process {
} }
# Check relative indent for conditionals and blocks. # Check relative indent for conditionals and blocks.
if ($line =~ /\b(?:(?:if|while|for)\s*\(|do\b)/ && $line !~ /^.\s*#/ && $line !~ /\}\s*while\s*/) { if ($line =~ /\b(?:(?:if|while|for|(?:[a-z_]+|)for_each[a-z_]+)\s*\(|do\b)/ && $line !~ /^.\s*#/ && $line !~ /\}\s*while\s*/) {
($stat, $cond, $line_nr_next, $remain_next, $off_next) = ($stat, $cond, $line_nr_next, $remain_next, $off_next) =
ctx_statement_block($linenr, $realcnt, 0) ctx_statement_block($linenr, $realcnt, 0)
if (!defined $stat); if (!defined $stat);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册