diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-07-10 13:23:14 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-07-10 13:30:43 +0200 |
| commit | 652d9916b12e1b2ee918b61d04ff23226d2fa4cd (patch) | |
| tree | 1cbd8ad28cc719875dd6f47ba0c1630f7e6ffb4d | |
| parent | 8ff1be9dcf7d7d30fce553b0ed21b40bbc26cae7 (diff) | |
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.
| -rw-r--r-- | kconfiglib.py | 7 |
1 files changed, 7 insertions, 0 deletions
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 |
