diff options
author | Martin Roth <gaumless@gmail.com> | 2023-10-27 11:03:48 -0600 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-11-13 14:13:24 +0000 |
commit | c7139f9d46dfafbb7dee4a2a0650c645a42c7c83 (patch) | |
tree | cd906061035238def6ce65b2dd557ca32cf1d0f0 /util | |
parent | 6ac6f6a6d096cb9b37e57e4cf3ad6fdccdcfad2f (diff) |
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>
Diffstat (limited to 'util')
-rwxr-xr-x | util/lint/kconfig_lint | 5 |
1 files 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."); } } |