From 71bfcf528dd54329db4466f11ae91f8d3a33adaf Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Wed, 13 Jul 2022 16:51:20 +0200 Subject: [PATCH] lint/checkpatch: Update 'concatenated string without spaces between elements' This reduce the difference with linux v5.19-rc7. Signed-off-by: Elyes Haouas Change-Id: I04e58aca4a30e82f3da0cda08403d0daf3b5fb10 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65831 Tested-by: build bot (Jenkins) Reviewed-by: Martin L Roth --- util/lint/checkpatch.pl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl index 577bdfa1a2..72c0f365d9 100755 --- a/util/lint/checkpatch.pl +++ b/util/lint/checkpatch.pl @@ -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