summaryrefslogtreecommitdiffstats
path: root/util/lint/checkpatch.pl
diff options
context:
space:
mode:
authorElyes Haouas <ehaouas@noos.fr>2022-04-12 12:50:02 +0200
committerMartin L Roth <martinroth@google.com>2022-04-24 21:17:34 +0000
commit00d8ffdada376a0402f5088b927ea59162dffd06 (patch)
treedc2a035e5cd424fb0323c6785530d3d7d3299264 /util/lint/checkpatch.pl
parent84083a27aa0a9bc208f6d74fe5d79dcf7856b653 (diff)
downloadcoreboot-00d8ffdada376a0402f5088b927ea59162dffd06.tar.gz
coreboot-00d8ffdada376a0402f5088b927ea59162dffd06.tar.bz2
coreboot-00d8ffdada376a0402f5088b927ea59162dffd06.zip
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>
Diffstat (limited to 'util/lint/checkpatch.pl')
-rwxr-xr-xutil/lint/checkpatch.pl20
1 files changed, 10 insertions, 10 deletions
diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl
index d75d6559cec9..b1cb5249a233 100755
--- a/util/lint/checkpatch.pl
+++ b/util/lint/checkpatch.pl
@@ -6080,18 +6080,18 @@ sub process {
if ($line =~ /(\(\s*$C90_int_types\s*\)\s*)($Constant)\b/) {
my $cast = $1;
my $const = $2;
+ my $suffix = "";
+ my $newconst = $const;
+ $newconst =~ s/${Int_type}$//;
+ $suffix .= 'U' if ($cast =~ /\bunsigned\b/);
+ if ($cast =~ /\blong\s+long\b/) {
+ $suffix .= 'LL';
+ } elsif ($cast =~ /\blong\b/) {
+ $suffix .= 'L';
+ }
if (WARN("TYPECAST_INT_CONSTANT",
- "Unnecessary typecast of c90 int constant\n" . $herecurr) &&
+ "Unnecessary typecast of c90 int constant - '$cast$const' could be '$const$suffix'\n" . $herecurr) &&
$fix) {
- my $suffix = "";
- my $newconst = $const;
- $newconst =~ s/${Int_type}$//;
- $suffix .= 'U' if ($cast =~ /\bunsigned\b/);
- if ($cast =~ /\blong\s+long\b/) {
- $suffix .= 'LL';
- } elsif ($cast =~ /\blong\b/) {
- $suffix .= 'L';
- }
$fixed[$fixlinenr] =~ s/\Q$cast\E$const\b/$newconst$suffix/;
}
}