Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752024AbeANLip (ORCPT + 1 other); Sun, 14 Jan 2018 06:38:45 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:38689 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751085AbeANLin (ORCPT ); Sun, 14 Jan 2018 06:38:43 -0500 X-Google-Smtp-Source: ACJfBouG/Zz2rb7z9a0KTe52HvnJ56QCc+6f4rVoQxwvWor0zGnch0B/bh5QUZRlbOPFlzbdpyW/Mg== From: Ulf Magnusson To: linux-kbuild@vger.kernel.org Cc: yamada.masahiro@socionext.com, sam@ravnborg.org, linux-kernel@vger.kernel.org, Ulf Magnusson Subject: [PATCH 1/2] kconfig: Document 'if' flattening logic Date: Sun, 14 Jan 2018 12:38:19 +0100 Message-Id: <20180114113820.19017-1-ulfalizer@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180114113345.18623-1-ulfalizer@gmail.com> References: <20180114113345.18623-1-ulfalizer@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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 --- 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