summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorElyes Haouas <ehaouas@noos.fr>2022-07-13 16:34:29 +0200
committerMartin L Roth <gaumless@tutanota.com>2022-07-19 01:46:22 +0000
commitd92fcf448f3e50f605b2c4eda13772680f47516f (patch)
tree0c1b188271ac01b5faf6b8d8b4cf36fe0993249d /util
parent86e4a3ae05fbc16198ab63c2cfab0b72e0f8d1df (diff)
downloadcoreboot-d92fcf448f3e50f605b2c4eda13772680f47516f.tar.gz
coreboot-d92fcf448f3e50f605b2c4eda13772680f47516f.tar.bz2
coreboot-d92fcf448f3e50f605b2c4eda13772680f47516f.zip
lint/checkpatch: Update 'check for logical continuations'
This reduce the difference with linux v5.19-rc7. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I222e3378ded4cd73d0141cd1e38ac3282d311cc4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65827 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
Diffstat (limited to 'util')
-rwxr-xr-xutil/lint/checkpatch.pl12
1 files changed, 10 insertions, 2 deletions
diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl
index a8ecff4e7119..f41f6ab2446f 100755
--- a/util/lint/checkpatch.pl
+++ b/util/lint/checkpatch.pl
@@ -3379,8 +3379,16 @@ sub process {
# check for && or || at the start of a line
if ($rawline =~ /^\+\s*(&&|\|\|)/) {
- CHK("LOGICAL_CONTINUATIONS",
- "Logical continuations should be on the previous line\n" . $hereprev);
+ my $operator = $1;
+ if (CHK("LOGICAL_CONTINUATIONS",
+ "Logical continuations should be on the previous line\n" . $hereprev) &&
+ $fix && $prevrawline =~ /^\+/) {
+ # insert logical operator at last non-comment, non-whitepsace char on previous line
+ $prevline =~ /[\s$;]*$/;
+ my $line_end = substr($prevrawline, $-[0]);
+ $fixed[$fixlinenr - 1] =~ s/\Q$line_end\E$/ $operator$line_end/;
+ $fixed[$fixlinenr] =~ s/\Q$operator\E\s*//;
+ }
}
# check indentation starts on a tab stop