Skip to content

Commit

Permalink
kconfig: Document SYMBOL_OPTIONAL logic
Browse files Browse the repository at this point in the history
Not obvious, especially if you don't already know how choices are
implemented.

No functional changes. Only comments added.

Signed-off-by: Ulf Magnusson <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
ulfalizer authored and masahir0y committed Jan 21, 2018
1 parent eea199b commit 3e41ba0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/kconfig/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,15 @@ void menu_finalize(struct menu *parent)
sym->flags |= SYMBOL_WARNED;
}

/*
* For non-optional choices, add a reverse dependency (corresponding to
* a select) of '<visibility> && m'. This prevents the user from
* setting the choice mode to 'n' when the choice is visible.
*
* This would also work for non-choice symbols, but only non-optional
* choices clear SYMBOL_OPTIONAL as of writing. Choices are implemented
* as a type of symbol.
*/
if (sym && !sym_is_optional(sym) && parent->prompt) {
sym->rev_dep.expr = expr_alloc_or(sym->rev_dep.expr,
expr_alloc_and(parent->prompt->visible.expr,
Expand Down

0 comments on commit 3e41ba0

Please sign in to comment.