util/lint/checkpatch.pl: Update TYPECAST_INT_CONSTANT lines

Update to v5.18-2 version.

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Change-Id: I8ed89e53f647b1b071abff33a434fb3b8dbb1de1
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63579
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <martinroth@google.com>
This commit is contained in:
Elyes Haouas 2022-04-12 12:50:02 +02:00 committed by Martin L Roth
parent 84083a27aa
commit 00d8ffdada
1 changed files with 10 additions and 10 deletions

View File

@ -6080,9 +6080,6 @@ sub process {
if ($line =~ /(\(\s*$C90_int_types\s*\)\s*)($Constant)\b/) { if ($line =~ /(\(\s*$C90_int_types\s*\)\s*)($Constant)\b/) {
my $cast = $1; my $cast = $1;
my $const = $2; my $const = $2;
if (WARN("TYPECAST_INT_CONSTANT",
"Unnecessary typecast of c90 int constant\n" . $herecurr) &&
$fix) {
my $suffix = ""; my $suffix = "";
my $newconst = $const; my $newconst = $const;
$newconst =~ s/${Int_type}$//; $newconst =~ s/${Int_type}$//;
@ -6092,6 +6089,9 @@ sub process {
} elsif ($cast =~ /\blong\b/) { } elsif ($cast =~ /\blong\b/) {
$suffix .= 'L'; $suffix .= 'L';
} }
if (WARN("TYPECAST_INT_CONSTANT",
"Unnecessary typecast of c90 int constant - '$cast$const' could be '$const$suffix'\n" . $herecurr) &&
$fix) {
$fixed[$fixlinenr] =~ s/\Q$cast\E$const\b/$newconst$suffix/; $fixed[$fixlinenr] =~ s/\Q$cast\E$const\b/$newconst$suffix/;
} }
} }