public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
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 1/2] kconfig: Document 'if' flattening logic
Date: Sun, 14 Jan 2018 12:38:19 +0100	[thread overview]
Message-ID: <20180114113820.19017-1-ulfalizer@gmail.com> (raw)
In-Reply-To: <20180114113345.18623-1-ulfalizer@gmail.com>

It is not obvious that this refers 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>
---
 scripts/kconfig/menu.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 372eb5d9fef3..1f7bcceacde3 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -524,6 +524,30 @@ void menu_finalize(struct menu *parent)
 			*ep = expr_alloc_one(E_LIST, NULL);
 			(*ep)->right.sym = menu->sym;
 		}
+
+		/*
+		 * Flatten '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.)
+		 *
+		 * Before:
+		 *
+		 *	A
+		 *	if ...
+		 *	 +-B
+		 *	 +-C
+		 *	D
+		 *
+		 * After:
+		 *
+		 *	A
+		 *	if ...
+		 *	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


  parent reply	other threads:[~2018-01-14 11:38 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 [this message]
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   ` [PATCH v2 1/2] kconfig: Document 'if' flattening logic Ulf Magnusson
2018-01-21 16:47     ` 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=20180114113820.19017-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