summaryrefslogtreecommitdiff
path: root/kconfiglib.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2018-07-10 07:46:47 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2018-07-10 07:55:56 +0200
commit4200e25c24a4441b36d6ac2d3d30987d88515eb2 (patch)
tree1fb856d39661568a311af94ebebb5be67d76b914 /kconfiglib.py
parent86a3c2da10491f7cec96a9c2720a5cd92b8aad67 (diff)
Generalize select-with-unsatisfied-deps warning
y-selecting a symbol with direct dependencies m should be flagged as well. Mirrors a change to the C tools.
Diffstat (limited to 'kconfiglib.py')
-rw-r--r--kconfiglib.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index 6cec108..333613f 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -3151,12 +3151,12 @@ class Symbol(object):
# Reverse (select-related) dependencies take precedence
rev_dep_val = expr_value(self.rev_dep)
if rev_dep_val:
+ if expr_value(self.direct_dep) < rev_dep_val:
+ self._warn_select_unsatisfied_deps()
+
val = max(rev_dep_val, val)
self._write_to_conf = True
- if not expr_value(self.direct_dep):
- self._warn_select_unsatisfied_deps()
-
# m is promoted to y for (1) bool symbols and (2) symbols with a
# weak_rev_dep (from imply) of y
if val == 1 and \
@@ -3604,17 +3604,22 @@ class Symbol(object):
def _warn_select_unsatisfied_deps(self):
# Helper for printing an informative warning when a symbol with
# unsatisfied direct dependencies (dependencies from 'depends on', ifs,
- # and menus) is selected by some other symbol
+ # and menus) is selected by some other symbol. Also warn if a symbol
+ # whose direct dependencies evaluate to m is selected to y.
+
+ dir_dep_val = expr_value(self.direct_dep)
- msg = "{} has unsatisfied direct dependencies ({}), but is " \
- "currently being selected by the following symbols:" \
- .format(_name_and_loc(self), expr_str(self.direct_dep))
+ msg = "{} has direct dependencies {} with value {}, but is " \
+ "currently being {}-selected by the following symbols:" \
+ .format(_name_and_loc(self), expr_str(self.direct_dep),
+ TRI_TO_STR[dir_dep_val],
+ TRI_TO_STR[expr_value(self.rev_dep)])
# The reverse dependencies from each select are ORed together
for select in split_expr(self.rev_dep, OR):
select_val = expr_value(select)
- if not select_val:
- # Only include selects that are not n
+ if select_val <= dir_dep_val:
+ # Only include selects that exceed the direct dependencies
continue
# - 'select A if B' turns into A && B