kconfig.py: Flag selects with unsatisfied deps and remove whitelisting

Turn the warning for selecting a symbol with unsatisfied dependencies
into an error. The last instance has been fixed (that triggers in CI at
least).

Also remove the warning whitelisting functionality, which was only used
to whitelist that warning. It hasn't been used for anything else in over
a year, so it probably wouldn't be useful to keep. Getting rid of it
makes the script easier to read.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit is contained in:
Ulf Magnusson 2020-01-28 06:11:44 +01:00 committed by Kumar Gala
commit bf4133d262

View file

@ -11,23 +11,6 @@ from kconfiglib import Kconfig, split_expr, expr_value, expr_str, BOOL, \
TRISTATE, TRI_TO_STR, AND
# Warnings that won't be turned into errors (but that will still be printed),
# identified by a substring of the warning. The warning texts from Kconfiglib
# are guaranteed to not change.
WARNING_WHITELIST = (
# Warning generated when a symbol with unsatisfied dependencies is being
# selected. These should be investigated, but whitelist them for now.
"y-selected",
)
def fatal(warning):
# Returns True if 'warning' is not whitelisted and should be turned into an
# error
return not any(wl_warning in warning for wl_warning in WARNING_WHITELIST)
def main():
args = parse_args()
@ -75,25 +58,18 @@ def main():
# fast.
kconf.write_config(os.devnull)
# Print warnings ourselves so that we can put a blank line between them for
# readability. We could roll this into the loop below, but it's nice to
# always print all warnings, even if one of them turns out to be fatal.
for warning in kconf.warnings:
print("\n" + warning, file=sys.stderr)
if kconf.warnings:
# Put a blank line between warnings to make them easier to read
for warning in kconf.warnings:
print("\n" + warning, file=sys.stderr)
# Turn all warnings except for explicitly whitelisted ones into errors. In
# particular, this will turn assignments to undefined Kconfig variables
# into errors.
#
# A warning is generated by this script whenever a symbol gets a different
# value than the one it was assigned. Keep that one as just a warning for
# now as well.
for warning in kconf.warnings:
if fatal(warning):
err(f"""\
Aborting due to non-whitelisted Kconfig warning '{warning}'. If this warning
doesn't point to an actual problem, you can add it to the whitelist at the top
of {sys.argv[0]}.""")
# Turn all warnings into errors, so that e.g. assignments to undefined
# Kconfig symbols become errors.
#
# A warning is generated by this script whenever a symbol gets a
# different value than the one it was assigned. Keep that one as just a
# warning for now.
err("Aborting due to Kconfig warnings")
# Write the merged configuration and the C header
print(kconf.write_config(args.config_out))