From patchwork Sun Jan 14 11:33:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Magnusson X-Patchwork-Id: 10162573 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ED43360390 for ; Sun, 14 Jan 2018 11:37:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBBB828AC6 for ; Sun, 14 Jan 2018 11:37:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF27B28ACA; Sun, 14 Jan 2018 11:37:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6198A28AC6 for ; Sun, 14 Jan 2018 11:37:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751441AbeANLhk (ORCPT ); Sun, 14 Jan 2018 06:37:40 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:34998 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751060AbeANLhj (ORCPT ); Sun, 14 Jan 2018 06:37:39 -0500 Received: by mail-lf0-f66.google.com with SMTP id a204so2023594lfa.2; Sun, 14 Jan 2018 03:37:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qLvNyvg/oTNiACFr1EdXlkZMSMotfUCJuvCHtmUi1oQ=; b=DpQB7d3gQYUsyAxJrxOXrdE2vi9kFKXTeLFTDsArNpmMF1wq6mZUXWOsC+kh/TlWFm 2WTh4/WQgBzKtar4WKpDsg9OrSdkbGoZGlgUxEaJ0kuyPbh0exgp81FWDrYZM0/eeykf uLJZJl7geFTc6qGtWBQFDgaf6KiybgWPtxsqwdtQXYt7ckFUN1TLr3w/aAoItxU+zXQm 1rZU4z5G46wbU8Dh727B+WOk5P1Y/HUMbic7f6AsZYqJILOmXdkm15ntBQQbs5/XHByY Un32z29yFl8F0LiFLP+Ihw1x7pZFQSum8mk2DSpeiIR3JqzLCdfWoll4yVXo4KsuD/+r FXew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qLvNyvg/oTNiACFr1EdXlkZMSMotfUCJuvCHtmUi1oQ=; b=Tk75M/p3f3wBPBDUBuX0kPQzXtHZtgV/1JTeflRuoDEODOjEiU41/GNyHCa4UpzMBY ic1GZifqBxABswuEERGFK7z9Qlz2+KrUax0TSLqPQXyDVChTO/jnv1/lbiAfNociyl+t EjcDDaHF0B7i/qNMa7+iiHAqzxJ8LETXkl9CCWxCdrH6TpAvJbftGL653XSIj7301icJ DbKp2rSvxhA4qTVfZ8oiwUDSyT54xgzmUMscbwXwjpkeMFXEsf0ZB2ya/3SDvOGAwZ9y Z8bm0g41fN5gbQjggLOaCPx1EZPmLCvLwTOzwfhd0o31CGxzRlDKlmtXphZeMJlaAes7 C1hg== X-Gm-Message-State: AKwxytc5wiLp0HJG78IwIo5LRsOHaG1G8y01AH8B6IYMvWcvpN6XSnV+ nyDPSydyVEEiqLI1GfgsgKAhrZ+H X-Google-Smtp-Source: ACJfBovpzua67ARvAi0A2js6L9xrMQcg0mR2sclxkUuYH5rjD0zphLnDb891ZQbNv1OJbpS2BL9Yzw== X-Received: by 10.46.89.157 with SMTP id g29mr828407ljf.9.1515929857442; Sun, 14 Jan 2018 03:37:37 -0800 (PST) Received: from huvuddator.lan (ua-213-113-106-221.cust.bredbandsbolaget.se. [213.113.106.221]) by smtp.gmail.com with ESMTPSA id 71sm4960856ljr.68.2018.01.14.03.33.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Jan 2018 03:37:36 -0800 (PST) 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:33:44 +0100 Message-Id: <20180114113345.18623-2-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-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;