From patchwork Fri Mar 19 19:32:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 12151791 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22FF1C433E0 for ; Fri, 19 Mar 2021 19:33:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E0ACF61980 for ; Fri, 19 Mar 2021 19:33:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230313AbhCSTck (ORCPT ); Fri, 19 Mar 2021 15:32:40 -0400 Received: from mail2.protonmail.ch ([185.70.40.22]:34247 "EHLO mail2.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230453AbhCSTcQ (ORCPT ); Fri, 19 Mar 2021 15:32:16 -0400 Date: Fri, 19 Mar 2021 19:32:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1616182334; bh=5yWe8Hx3mAzgD1cjJ6fOFRik6bzQ9/2qcyBrY/E5cZw=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=VPTcDjFrZg96Qg6rq2J8Y02Dk/JQQeRfozk2s+srD9UjD0Pae7fK6jZNDHywDfuqv QoSNznF0Y2Fu4jTDqAJk/L+SSANzlOjC1UY1Wg3xQdatfMxPEN0RpfFzvhYhSQyJiN 2QUMKosKWmfk7SRf/0mU3sZQ9epU6CuhhWj/4PbMZjiD3QK+gG2IW07MhmyxT6sUCO eodVEOGQyuUh5Q5jN6LDpbSLJcAId8ASjVAil226Jker5X32wOdU5Nsb5P9VBi6pLX y55LyCt09La1xRauNB+ZoeTPU8uM972GPeG/Qu4pMgeUitOq53WFfTqlm6ACt+bqn7 ZwESYQTIpZtHQ== To: Masahiro Yamada From: Alexander Lobakin Cc: Alexander Lobakin , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH 2/2] kconfig: mention submenu type in comment blocks in .config Message-ID: <20210319193150.267510-3-alobakin@pm.me> In-Reply-To: <20210319193150.267510-1-alobakin@pm.me> References: <20210319193150.267510-1-alobakin@pm.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org To have a better understanding of the dotconfig blocks, mention if a particular block-commented section is a choice or a menu{,config}. Before: CONFIG_TICK_ONESHOT=y CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_HIGH_RES_TIMERS=y After: CONFIG_TICK_ONESHOT=y CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_HIGH_RES_TIMERS=y Signed-off-by: Alexander Lobakin --- scripts/kconfig/confdata.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) -- 2.31.0 diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index e4f0a21fd469..3f50d8b82a54 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -822,6 +822,17 @@ int conf_write_defconfig(const char *filename) return 0; } +static const char *menu_type_string(const struct menu *menu) +{ + if (menu->sym && (menu->sym->flags & SYMBOL_CHOICE)) + return " choice"; + + if (menu->prompt && menu->prompt->type == P_MENU) + return " menu"; + + return ""; +} + int conf_write(const char *name) { FILE *out; @@ -876,8 +887,8 @@ int conf_write(const char *name) str = menu_get_prompt(menu); fprintf(out, "\n" "#\n" - "# %s\n" - "#\n", str); + "# %s%s\n" + "#\n", str, menu_type_string(menu)); need_newline = false; } @@ -905,7 +916,8 @@ int conf_write(const char *name) (menu->prompt && menu->prompt->type == P_MENU)) && menu_is_visible(menu) && menu != &rootmenu) { str = menu_get_prompt(menu); - fprintf(out, "# end of %s\n", str); + fprintf(out, "# end of %s%s\n", str, + menu_type_string(menu)); need_newline = true; } if (menu->next) {