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 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(): def main():
args = parse_args() args = parse_args()
@ -75,25 +58,18 @@ def main():
# fast. # fast.
kconf.write_config(os.devnull) kconf.write_config(os.devnull)
# Print warnings ourselves so that we can put a blank line between them for if kconf.warnings:
# readability. We could roll this into the loop below, but it's nice to # Put a blank line between warnings to make them easier to read
# always print all warnings, even if one of them turns out to be fatal. for warning in kconf.warnings:
for warning in kconf.warnings: print("\n" + warning, file=sys.stderr)
print("\n" + warning, file=sys.stderr)
# Turn all warnings except for explicitly whitelisted ones into errors. In # Turn all warnings into errors, so that e.g. assignments to undefined
# particular, this will turn assignments to undefined Kconfig variables # Kconfig symbols become errors.
# into errors. #
# # A warning is generated by this script whenever a symbol gets a
# A warning is generated by this script whenever a symbol gets a different # different value than the one it was assigned. Keep that one as just a
# value than the one it was assigned. Keep that one as just a warning for # warning for now.
# now as well. err("Aborting due to Kconfig warnings")
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]}.""")
# Write the merged configuration and the C header # Write the merged configuration and the C header
print(kconf.write_config(args.config_out)) print(kconf.write_config(args.config_out))