aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2018-01-14 09:49:26 -0500
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-01-21 11:49:30 -0500
commit9d1a9e8bc18bea94adfa716073df3ed83fc4e895 (patch)
treed80aae3634157d080ee24c5031eb0829f2785574 /scripts
parentd3465af60f4471b7b6201928e709bc137fdbee3e (diff)
kconfig: Document 'if' flattening logic
It is not obvious that this might refer to an 'if', making the code pretty cryptic: if (menu->list && (!menu->prompt || !menu->prompt->text)) { Kconfig keeps the 'if' menu nodes even after flattening. Reflect that in the example to be accurate. No functional changes. Only comments added. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/menu.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index dcf22008b2d6..af66065733bb 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -532,6 +532,35 @@ void menu_finalize(struct menu *parent)
532 *ep = expr_alloc_one(E_LIST, NULL); 532 *ep = expr_alloc_one(E_LIST, NULL);
533 (*ep)->right.sym = menu->sym; 533 (*ep)->right.sym = menu->sym;
534 } 534 }
535
536 /*
537 * This code serves two purposes:
538 *
539 * (1) Flattening 'if' blocks, which do not specify a submenu
540 * and only add dependencies.
541 *
542 * (Automatic submenu creation might still create a submenu
543 * from an 'if' before this code runs.)
544 *
545 * (2) "Undoing" any automatic submenus created earlier below
546 * promptless symbols.
547 *
548 * Before:
549 *
550 * A
551 * if ... (or promptless symbol)
552 * +-B
553 * +-C
554 * D
555 *
556 * After:
557 *
558 * A
559 * if ... (or promptless symbol)
560 * B
561 * C
562 * D
563 */
535 if (menu->list && (!menu->prompt || !menu->prompt->text)) { 564 if (menu->list && (!menu->prompt || !menu->prompt->text)) {
536 for (last_menu = menu->list; ; last_menu = last_menu->next) { 565 for (last_menu = menu->list; ; last_menu = last_menu->next) {
537 last_menu->parent = parent; 566 last_menu->parent = parent;