scripts: modify checkpatch to respect Zephyr for_each spelling
Linux uses for_each in macros that produce loops; Zephyr uses FOR_EACH. Update the corresponding checks to match Zephyr's spelling. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
5b10fac97e
commit
afe8a3777a
1 changed files with 2 additions and 2 deletions
|
@ -3615,7 +3615,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|(?:[a-z_]+|)for_each[a-z_]+)\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);
|
||||||
|
@ -3661,7 +3661,7 @@ sub process {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check relative indent for conditionals and blocks.
|
# Check relative indent for conditionals and blocks.
|
||||||
if ($line =~ /\b(?:(?:if|while|for|(?:[a-z_]+|)for_each[a-z_]+)\s*\(|(?:do|else)\b)/ && $line !~ /^.\s*#/ && $line !~ /\}\s*while\s*/) {
|
if ($line =~ /\b(?:(?:if|while|for|(?:[A-Z_]+|)FOR_EACH[A-Z_]+)\s*\(|(?:do|else)\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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue