summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElyes Haouas <ehaouas@noos.fr>2022-04-12 13:19:50 +0200
committerMartin L Roth <martinroth@google.com>2022-04-24 21:19:40 +0000
commit43529c8b20611af9dccc783bc4196ec87279070b (patch)
tree5ce1264ceff7764920dbf1d3291d6c676663c78c
parentf0e150c35aafa7b2f5ac4123a8de918f296de01c (diff)
util/lint/checkpatch.pl: Update lines related to CONST_STRUCT
Update to v5.18-2 version. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I0fe2ec6a74a4b8c70452fbf05d534a37e1ea2c26 Reviewed-on: https://review.coreboot.org/c/coreboot/+/63582 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <martinroth@google.com>
-rwxr-xr-xutil/lint/checkpatch.pl11
1 files changed, 7 insertions, 4 deletions
diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl
index 8275daaebf..81fda35d33 100755
--- a/util/lint/checkpatch.pl
+++ b/util/lint/checkpatch.pl
@@ -867,9 +867,11 @@ sub read_words {
return 0;
}
-my $const_structs = "";
-read_words(\$const_structs, $conststructsfile)
- or warn "No structs that should be const will be found - file '$conststructsfile': $!\n";
+my $const_structs;
+if (show_type("CONST_STRUCT")) {
+ read_words(\$const_structs, $conststructsfile)
+ or warn "No structs that should be const will be found - file '$conststructsfile': $!\n";
+}
my $typeOtherTypedefs = "";
if (length($typedefsfile)) {
@@ -6603,7 +6605,8 @@ sub process {
# check for various structs that are normally const (ops, kgdb, device_tree)
# and avoid what seem like struct definitions 'struct foo {'
- if ($line !~ /\bconst\b/ &&
+ if (defined($const_structs) &&
+ $line !~ /\bconst\b/ &&
$line =~ /\bstruct\s+($const_structs)\b(?!\s*\{)/) {
WARN("CONST_STRUCT",
"struct $1 should normally be const\n" . $herecurr);