summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorElyes Haouas <ehaouas@noos.fr>2023-08-01 18:15:19 +0200
committerElyes Haouas <ehaouas@noos.fr>2023-08-09 20:40:34 +0000
commit32cae137142c3f94d601ce9275e1b54300d2b853 (patch)
tree852ae2f70bc117454026cf596f95a682350733e1 /util
parentd2bb4858f3246fc7b6af74a28cd5f14cdee2c5a4 (diff)
downloadcoreboot-32cae137142c3f94d601ce9275e1b54300d2b853.tar.gz
coreboot-32cae137142c3f94d601ce9275e1b54300d2b853.tar.bz2
coreboot-32cae137142c3f94d601ce9275e1b54300d2b853.zip
lint/checkpatch.pl: Update check for TRAILING_STATEMENTS
This reduces the difference with linux v6.5-rc4. Change-Id: I59d9619f2e58f24e0a5474bcfa79351e3afb933d Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/76870 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@gmail.com>
Diffstat (limited to 'util')
-rwxr-xr-xutil/lint/checkpatch.pl16
1 files changed, 14 insertions, 2 deletions
diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl
index 120e57ea734b..91cf2da8406b 100755
--- a/util/lint/checkpatch.pl
+++ b/util/lint/checkpatch.pl
@@ -5229,8 +5229,20 @@ sub process {
$stat_real = "[...]\n$stat_real";
}
- ERROR("TRAILING_STATEMENTS",
- "trailing statements should be on next line\n" . $herecurr . $stat_real);
+ if (ERROR("TRAILING_STATEMENTS",
+ "trailing statements should be on next line\n" . $herecurr . $stat_real) &&
+ !$fixed_assign_in_if &&
+ $cond_lines == 0 &&
+ $fix && $perl_version_ok &&
+ $fixed[$fixlinenr] =~ /^\+(\s*)((?:if|while|for)\s*$balanced_parens)\s*(.*)$/) {
+ my $indent = $1;
+ my $test = $2;
+ my $rest = rtrim($4);
+ if ($rest =~ /;$/) {
+ $fixed[$fixlinenr] = "\+$indent$test";
+ fix_insert_line($fixlinenr + 1, "$indent\t$rest");
+ }
+ }
}
}