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. --- allnoconfig.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'allnoconfig.py') diff --git a/allnoconfig.py b/allnoconfig.py index a0afd78..e162ccb 100755 --- a/allnoconfig.py +++ b/allnoconfig.py @@ -31,10 +31,10 @@ def main(): # 2. Assigning values invalid for the type (only bool/tristate symbols # accept 0/1/2, for n/m/y). The assignments will be ignored for other # symbol types, which is what we want. - kconf.disable_warnings() + kconf.warn = False for sym in kconf.unique_defined_syms: sym.set_value(2 if sym.is_allnoconfig_y else 0) - kconf.enable_warnings() + kconf.warn = True kconfiglib.load_allconfig(kconf, "allno.config") -- cgit v1.2.3