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/menuconfig_example.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'examples/menuconfig_example.py') diff --git a/examples/menuconfig_example.py b/examples/menuconfig_example.py index b265e69..2c98fff 100755 --- a/examples/menuconfig_example.py +++ b/examples/menuconfig_example.py @@ -277,9 +277,8 @@ def get_value_from_user(sc): val = "0x" + val # Let Kconfiglib itself print a warning here if the value is invalid. We - # could also disable warnings temporarily with - # kconf.disable_warnings() / kconf.enable_warnings() and print our own - # warning. + # could also disable warnings temporarily with 'kconf.warn = False' and + # print our own warning. return sc.set_value(val) -- cgit v1.2.3