From 3e41ba05b6d60cd54e64639b308be62c12308a04 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sun, 14 Jan 2018 10:56:20 +0100 Subject: kconfig: Document SYMBOL_OPTIONAL logic Not obvious, especially if you don't already know how choices are implemented. No functional changes. Only comments added. Signed-off-by: Ulf Magnusson Signed-off-by: Masahiro Yamada --- scripts/kconfig/menu.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'scripts') diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 47bec3434fef..7634d567e779 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -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 ' && 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, -- cgit