From bf36f5de0f49d56975b1a844e25484ec385dc971 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Mon, 3 Jun 2019 01:55:50 +0200 Subject: Improve warning control API (with backwards compatibility) A wart of the warning control API (enable/disable_*_warnings()) is that the current warning settings can't be queried. Querying warning settings is useful in functions that want to temporarily enable/disable some warning and then put things back to how they were. kconfiglib.load_allconfig() ran into this, for example. Make the internal warning control variables public (improve the naming at the same time), and encourage just setting them directly. Keep the old API for backwards compatibility. Also remove _warn_redun_assign() and _warn_override(). They're trivial and were called in a single place. --- examples/merge_config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples/merge_config.py') diff --git a/examples/merge_config.py b/examples/merge_config.py index 6f60375..ef11d79 100755 --- a/examples/merge_config.py +++ b/examples/merge_config.py @@ -82,7 +82,7 @@ if len(sys.argv) < 4: kconf = Kconfig(sys.argv[1]) # Enable warnings for assignments to undefined symbols -kconf.enable_undef_warnings() +kconf.warn_assign_undef = True # (This script uses alldefconfig as the base. Other starting states could be # set up here as well. The approach in examples/allnoconfig_simpler.py could @@ -91,8 +91,8 @@ kconf.enable_undef_warnings() # Disable warnings generated for multiple assignments to the same symbol within # a (set of) configuration files. Assigning a symbol multiple times might be # done intentionally when merging configuration files. -kconf.disable_override_warnings() -kconf.disable_redun_warnings() +kconf.warn_assign_override = False +kconf.warn_assign_redun = False # Create a merged configuration by loading the fragments with replace=False. # load_config() and write_config() returns a message to print. -- cgit v1.2.3