kconfig: Document SYMBOL_OPTIONAL logic
authorUlf Magnusson <ulfalizer@gmail.com>
Sun, 14 Jan 2018 09:56:20 +0000 (10:56 +0100)
committerChristian Lamparter <chunkeey@gmail.com>
Sun, 10 Feb 2019 20:54:34 +0000 (21:54 +0100)
Not obvious, especially if you don't already know how choices are
implemented.

No functional changes. Only comments added.

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
config/menu.c

index 47bec3434fef16f1b0c46e0f8d908ee704aa57ca..7634d567e77949d2f7a71d05a5de8d9e96403500 100644 (file)
@@ -549,6 +549,15 @@ void menu_finalize(struct menu *parent)
                sym->flags |= SYMBOL_WARNED;
        }
 
                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,
        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,