From 652d9916b12e1b2ee918b61d04ff23226d2fa4cd Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Tue, 10 Jul 2018 13:23:14 +0200 Subject: Warn if int/hex/string symbols are evaluated logically They always evaluate to n. Would be nice if there was a trivial way to give the location(s). Just say "somewhere" for now. --- kconfiglib.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'kconfiglib.py') diff --git a/kconfiglib.py b/kconfiglib.py index 5afe43e..19cb32f 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -3334,6 +3334,13 @@ class Symbol(object): return self._cached_tri_val if self.orig_type not in (BOOL, TRISTATE): + if self.orig_type != UNKNOWN: + # Would take some work to give the location here + self.kconfig._warn( + "The {} symbol {} is being evaluated in a logical context " + "somewhere. It will always evaluate to n." + .format(TYPE_TO_STR[self.orig_type], _name_and_loc(self))) + self._cached_tri_val = 0 return 0 -- cgit v1.2.3