From c7139f9d46dfafbb7dee4a2a0650c645a42c7c83 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Fri, 27 Oct 2023 11:03:48 -0600 Subject: [PATCH] util/lint/kconfig_lint: Ignore C preprocessor macros in code To see which Kconfig symbols are actually used, and to verify that they're used correctly, kconfig_lint scans the C code. It gives an error if it sees a CONFIG(symbol) where the symbol doesn't exist. This creates a problem when a C preprocessor macro is created to match multiple Kconfig symbols. The simple solution here is to just ignore those C preprocessor macro definitions as beyond the scope of this linter. Signed-off-by: Martin Roth Change-Id: I5a20e8bb5a3e19e380802cba712d6dd3ff2f4dc0 Reviewed-on: https://review.coreboot.org/c/coreboot/+/78681 Reviewed-by: Fred Reitberger Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- util/lint/kconfig_lint | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint index 107f01cdca..523fa3e9eb 100755 --- a/util/lint/kconfig_lint +++ b/util/lint/kconfig_lint @@ -291,8 +291,9 @@ sub check_config_macro { show_error( "CONFIG($symbol) used at $file:$lineno." . " CONFIG() is only valid for type 'bool', not '$symbols{$symbol}{type}'." ); } - } - else { + } elsif ($symbol =~ /\S+##\S+/ ) { + show_warning( "C preprocessor macro CONFIG_$symbol found at $file:$lineno." ); + } else { show_error("CONFIG() used on unknown value ($symbol) at $file:$lineno."); } }