Skip to contentSkip to conversation

kconfig: Document SYMBOL_OPTIONAL logic

PATCH In review Ulf Magnusson 2 participants 2 messages Jan 14, 2018 – Jan 18, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kconfig: Document SYMBOL_OPTIONAL logic

Not obvious, especially if you don't already know how choices are implemented.

No functional changes. Only comments added.

---
 scripts/kconfig/menu.c | 9 +++++++++
 1 file changed, 9 insertions(+)
scripts/kconfig/menu.c +9 -0
index 92d3f06cd8a2..372eb5d9fef3 100644
@@ -548,6 +548,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,
Signature · 1 line
2.14.1
#1 lore raw

2018-01-14 18:56 GMT+09:00 Ulf Magnusson <[email protected]>:

Quoted 21 lines

Not obvious, especially if you don't already know how choices are implemented.

No functional changes. Only comments added.

---
 scripts/kconfig/menu.c | 9 +++++++++
 1 file changed, 9 insertions(+)
scripts/kconfig/menu.c +3 -0
index 92d3f06cd8a2..372eb5d9fef3 100644
@@ -548,6 +548,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

scripts/kconfig/menu.c void menu_finalize(struct menu *parent)

Quoted 10 lines
scripts/kconfig/menu.c +6 -1
+        * 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,
--

Applied to linux-kbuild/kconfig. Thanks!

Signature · 2 lines
Best Regards
Masahiro Yamada