lint/checkpatch: Update 'concatenated string without spaces between elements'

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

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Change-Id: I04e58aca4a30e82f3da0cda08403d0daf3b5fb10
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65831
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:51:20 +02:00 committed by Martin L Roth
parent a59a87ca17
commit 71bfcf528d
1 changed files with 11 additions and 3 deletions

View File

@ -5706,9 +5706,17 @@ sub process {
}
# concatenated string without spaces between elements
if ($line =~ /$String[A-Z_]/ || $line =~ /[A-Za-z0-9_]$String/) {
CHK("CONCATENATED_STRING",
"Concatenated strings should use spaces between elements\n" . $herecurr);
if ($line =~ /$String[A-Z_]/ ||
($line =~ /([A-Za-z0-9_]+)$String/ && $1 !~ /^[Lu]$/)) {
if (CHK("CONCATENATED_STRING",
"Concatenated strings should use spaces between elements\n" . $herecurr) &&
$fix) {
while ($line =~ /($String)/g) {
my $extracted_string = substr($rawline, $-[0], $+[0] - $-[0]);
$fixed[$fixlinenr] =~ s/\Q$extracted_string\E([A-Za-z0-9_])/$extracted_string $1/;
$fixed[$fixlinenr] =~ s/([A-Za-z0-9_])\Q$extracted_string\E/$1 $extracted_string/;
}
}
}
# uncoalesced string fragments