diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-01-30 10:43:04 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-01-30 10:46:38 +0100 |
| commit | 0eadd61c05c523a150721f9646e4d3f7cff58e5c (patch) | |
| tree | 6972ade994a4e8b73014de367f57f6d4469e3b81 /kconfiglib.py | |
| parent | 3db12f728ec2d48640574133675bb01ca926d741 (diff) | |
Warn if choice symbol has prompt outside choice
Defining a choice symbol in multiple places to add some properties to it
outside the choice seems to actually be done deliberately by MIPS, but
it's almost guaranteed to be an error if the definition(s) outside the
choice have a prompt (and so can be changed by the user there), so warn
for that.
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index 3f1710c..c7c34bc 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -4319,12 +4319,15 @@ def _check_choice_sanity(choice): .format(_name_and_loc_str(sym))) for node in sym.nodes: - if node.prompt: - break - else: - choice.kconfig._warn("the choice symbol {} has no prompt" - .format(_name_and_loc_str(sym))) - + if node.parent.item is choice: + if not node.prompt: + choice.kconfig._warn("the choice symbol {} has no prompt" + .format(_name_and_loc_str(sym))) + + elif node.prompt: + choice.kconfig._warn("the choice symbol {} is defined with a " + "prompt outside the choice" + .format(_name_and_loc_str(sym))) # # Public global constants |
