From 280d3a25e8e84e1bfed84ef957c65c491badfd86 Mon Sep 17 00:00:00 2001 From: Nicholas Chin Date: Wed, 30 Jul 2025 21:13:16 -0600 Subject: [PATCH] util/lint/kconfig_lint: Fix operator precedence issue Perl 5.42.0 added a new warning for possible precedence problems between the `!` logical negation operator and various other operators [1]. In particular, the kconfig_lint script uses `!` and `=~` (binding operator) to check that a filename does not match a regex, but was written in a way that would be parsed as negating the filename and then comparing it to the regex. The resulting warning from the newer version of Perl caused lint-stable to fail on the lint-stable-008-kconfig test due to the non empty output, causing the pre-commit hook to fail. Fix this by using the negated binding operator `!~` instead as recommended by the Perl documentation [2]. [1] https://perldoc.perl.org/perl5420delta#New-Warnings [2] https://perldoc.perl.org/perldiag#Possible-precedence-problem-between-!-and-%25s Change-Id: I3631b8b0be92bf85a1510be1f1d4221a010be1ba Signed-off-by: Nicholas Chin Reviewed-on: https://review.coreboot.org/c/coreboot/+/88619 Reviewed-by: Nicholas Sudsgaard Tested-by: build bot (Jenkins) --- util/lint/kconfig_lint | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint index 551faabdbb..e8a498b19a 100755 --- a/util/lint/kconfig_lint +++ b/util/lint/kconfig_lint @@ -1347,8 +1347,8 @@ sub print_wholeconfig { sub check_if_file_referenced { my $filename = $File::Find::name; if ( ( $filename =~ /Kconfig/ ) - && ( !$filename =~ /\.orig$/ ) - && ( !$filename =~ /~$/ ) + && ( $filename !~ /\.orig$/ ) + && ( $filename !~ /~$/ ) && ( !exists $loaded_files{$filename} ) ) { show_warning("'$filename' is never referenced");