From: Ulf Magnusson <ulfalizer@gmail.com>
To: linux-kbuild@vger.kernel.org
Cc: yamada.masahiro@socionext.com, sam@ravnborg.org,
linux-kernel@vger.kernel.org, Ulf Magnusson <ulfalizer@gmail.com>
Subject: [PATCH v2 1/2] kconfig: Document 'if' flattening logic
Date: Sun, 14 Jan 2018 15:49:26 +0100 [thread overview]
Message-ID: <20180114144926.29162-1-ulfalizer@gmail.com> (raw)
In-Reply-To: <20180114113820.19017-1-ulfalizer@gmail.com>
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>
---
Changelog
v2:
I forgot to mention that this code also undoes automatic submenus created below
promptless symbols.
| 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
--git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 53964d911708..a8af08aabfd6 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -531,6 +531,35 @@ void menu_finalize(struct menu *parent)
*ep = expr_alloc_one(E_LIST, NULL);
(*ep)->right.sym = menu->sym;
}
+
+ /*
+ * This code serves two purposes:
+ *
+ * (1) Flattening 'if' blocks, which do not specify a submenu
+ * and only add dependencies.
+ *
+ * (Automatic submenu creation might still create a submenu
+ * from an 'if' before this code runs.)
+ *
+ * (2) "Undoing" any automatic submenus created earlier below
+ * promptless symbols.
+ *
+ * Before:
+ *
+ * A
+ * if ... (or promptless symbol)
+ * +-B
+ * +-C
+ * D
+ *
+ * After:
+ *
+ * A
+ * if ... (or promptless symbol)
+ * B
+ * C
+ * D
+ */
if (menu->list && (!menu->prompt || !menu->prompt->text)) {
for (last_menu = menu->list; ; last_menu = last_menu->next) {
last_menu->parent = parent;
--
2.14.1
next prev parent reply other threads:[~2018-01-14 14:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-14 11:33 [PATCH 0/2] kconfig: 'if' and automatic submenu creation documentation Ulf Magnusson
2018-01-14 11:33 ` [PATCH 1/2] kconfig: Document 'if' flattening logic Ulf Magnusson
2018-01-14 11:38 ` Ulf Magnusson
2018-01-14 11:38 ` [PATCH 2/2] kconfig: Improve auto. menu documentation accuracy Ulf Magnusson
2018-01-18 13:54 ` Masahiro Yamada
2018-01-14 14:49 ` Ulf Magnusson [this message]
2018-01-21 16:47 ` [PATCH v2 1/2] kconfig: Document 'if' flattening logic Masahiro Yamada
2018-01-14 21:00 ` [PATCH 0/2] kconfig: 'if' and automatic submenu creation documentation Sam Ravnborg
2018-01-15 11:00 ` Ulf Magnusson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180114144926.29162-1-ulfalizer@gmail.com \
--to=ulfalizer@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sam@ravnborg.org \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox