lint/checkpatch: Update 'check for assignments on the start of a line'

This reduce the difference with linux v5.19-rc7.

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Change-Id: Ia7d4b0176bad849e79f037f74c3d99ce9eb061c0
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65825
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@tutanota.com>
This commit is contained in:
Elyes Haouas 2022-07-13 16:29:14 +02:00 committed by Martin L Roth
parent eca8859133
commit c5ede53ba8
1 changed files with 8 additions and 2 deletions

View File

@ -3364,8 +3364,14 @@ sub process {
# check for assignments on the start of a line
if ($sline =~ /^\+\s+($Assignment)[^=]/) {
CHK("ASSIGNMENT_CONTINUATIONS",
"Assignment operator '$1' should be on the previous line\n" . $hereprev);
my $operator = $1;
if (CHK("ASSIGNMENT_CONTINUATIONS",
"Assignment operator '$1' should be on the previous line\n" . $hereprev) &&
$fix && $prevrawline =~ /^\+/) {
# add assignment operator to the previous line, remove from current line
$fixed[$fixlinenr - 1] .= " $operator";
$fixed[$fixlinenr] =~ s/\Q$operator\E\s*//;
}
}
# check for && or || at the start of a line