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 <gaumless@gmail.com>
Change-Id: I5a20e8bb5a3e19e380802cba712d6dd3ff2f4dc0
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78681
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Martin Roth 2023-10-27 11:03:48 -06:00 committed by Felix Held
parent 6ac6f6a6d0
commit c7139f9d46
1 changed files with 3 additions and 2 deletions

View File

@ -291,8 +291,9 @@ sub check_config_macro {
show_error( "CONFIG($symbol) used at $file:$lineno." show_error( "CONFIG($symbol) used at $file:$lineno."
. " CONFIG() is only valid for type 'bool', not '$symbols{$symbol}{type}'." ); . " CONFIG() is only valid for type 'bool', not '$symbols{$symbol}{type}'." );
} }
} } elsif ($symbol =~ /\S+##\S+/ ) {
else { show_warning( "C preprocessor macro CONFIG_$symbol found at $file:$lineno." );
} else {
show_error("CONFIG() used on unknown value ($symbol) at $file:$lineno."); show_error("CONFIG() used on unknown value ($symbol) at $file:$lineno.");
} }
} }