Received: by 2002:aa6:c3ca:0:b029:c8:4414:5686 with SMTP id b10csp1818302lkq; Fri, 19 Mar 2021 12:38:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaJ6dGvL6+3JaaacuI2zPjobW0P2Gs27G0IKW88xXilG8EfbDXJqbcX1YS9qsySMOEr/7j X-Received: by 2002:a17:906:8546:: with SMTP id h6mr6150270ejy.23.1616182734414; Fri, 19 Mar 2021 12:38:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616182734; cv=none; d=google.com; s=arc-20160816; b=km9wpTarghYbRdVD2oxkpsV1CNKf+Ih/4FiASJa3MOAMJin6squPAcUsAP52CyC80q NANNQBVihHw6vaL4lcSafVBK6mpdkY+o6B/F0MaZLMpdJ+RXCUrz0sHQcegqbwq9bbkg K65EmIpp2zCoLKubtnl4/LCgKD5YqMcNHtNte25I+zr6qc6YpjhlNePIUtpRolxnV3R2 11p/Jo6mHRlbPxmfEpO+tumFLVS+94QXyOrvX5gF4+jCodh+YTLw6sY7TyYRe7zbG8+H mcgLSEVVuLWRfQwDg0qqo05z/KGjgWvBYSTKzvcegsjpfZZYk/qRQ+rKfmRHwplHzMGO sPbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=qe2wF/6r8Z9PIeJLQcxvqMy/4efs7G1Yf5tEbNVKzRY=; b=pA5RiLQ8ig+Kkd9SaBdpF74y4FSqTygIyFdqZSJ21vS6aS7Rbl6RWN/Thl5sp3y1rv G4PPTqBKzSEmTjDAefaZF9RSLpybAvnKSKpPDg07ATNQgXLRLaswRfALXdO5nTbbpqf3 nuMdsutICbFmMVSwOHtxBDCRpHWrCzP5q0KEPhsbJIzkv1xzIaV8ZQkXlFQujiDXsW0O TngHMzyVi26royzky5ZE41xKPwS60TMRmh2IdfFXoiAwdo35VdiOb3myXPFzFI4IAwsw lxou//EYhMB0JyUStMC4a6zHyUXmlKY6v9tAkDdF58aGWJ54LFxT3AABPCQy2nBCnKSK 9MJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=B6BvNsWp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x10si4476188ejw.389.2021.03.19.12.38.31; Fri, 19 Mar 2021 12:38:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=B6BvNsWp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230419AbhCSTha (ORCPT + 99 others); Fri, 19 Mar 2021 15:37:30 -0400 Received: from mail-40131.protonmail.ch ([185.70.40.131]:43741 "EHLO mail-40131.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230348AbhCSThP (ORCPT ); Fri, 19 Mar 2021 15:37:15 -0400 Date: Fri, 19 Mar 2021 19:37:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1616182633; bh=qe2wF/6r8Z9PIeJLQcxvqMy/4efs7G1Yf5tEbNVKzRY=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=B6BvNsWpkPWd5FENMvXXa4K05/jIDiOX/vITwXreqxDWNhmsyirF43Wpwc3nLHQQG q4AYurdAlUWGuCC3GkpuLZDig5AvyVeJmbxk3SwXEtoPyzWCVJEX7RDyFVyiejTMsg Z6wFiIIGsmC5zXcGAt/Ax2amYkGzAUPfy2YcmbAot6TT4Ku9Xe32TKZfDZuAKbt/WB wajLwhhlAXqTvQpCMgt7HhCWtNpwUgDY+P/SbTUFtmGB15R5wuh1PuHqYqhbaMUrRd 7w7E1OpF9tDWkjU58gJkyXP7oKwO6JL2CtMRt1VYBDKSeQfghtRKpdQNtHgAwocLci gUITtEn3VRHTw== 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 RESEND 1/2] kconfig: fence choices and menuconfigs with comments in .config too Message-ID: <20210319193705.267922-2-alobakin@pm.me> In-Reply-To: <20210319193705.267922-1-alobakin@pm.me> References: <20210319193705.267922-1-alobakin@pm.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Comment blocks are now generated in .config only for menus. Provide them for choices and menuconfigs too to greatly improve dotconfig readability. Choices before: x CONFIG_BOOT_CONFIG is not set CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=3Dy x CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=3Dy Choices after: x CONFIG_BOOT_CONFIG is not set x x Compiler optimization level x CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=3Dy x CONFIG_CC_OPTIMIZE_FOR_SIZE is not set x end of Compiler optimization level CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=3Dy Menuconfigs before: x CONFIG_IPACK_BUS is not set CONFIG_RESET_CONTROLLER=3Dy x CONFIG_RESET_BRCMSTB_RESCAL is not set x CONFIG_RESET_INTEL_GW is not set x CONFIG_RESET_TI_SYSCON is not set Menuconfigs after: x x IndustryPack bus support x x CONFIG_IPACK_BUS is not set x end of IndustryPack bus support x x Reset Controller Support x CONFIG_RESET_CONTROLLER=3Dy x CONFIG_RESET_BRCMSTB_RESCAL is not set x CONFIG_RESET_INTEL_GW is not set x CONFIG_RESET_TI_SYSCON is not set x end of Reset Controller Support Signed-off-by: Alexander Lobakin --- scripts/kconfig/confdata.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 2568dbe16ed6..e4f0a21fd469 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -869,17 +869,20 @@ int conf_write(const char *name) =09menu =3D rootmenu.list; =09while (menu) { =09=09sym =3D menu->sym; -=09=09if (!sym) { -=09=09=09if (!menu_is_visible(menu)) -=09=09=09=09goto next; + +=09=09if ((!sym || (sym->flags & SYMBOL_CHOICE) || +=09=09 (menu->prompt && menu->prompt->type =3D=3D P_MENU)) && +=09=09 menu_is_visible(menu)) { =09=09=09str =3D menu_get_prompt(menu); =09=09=09fprintf(out, "\n" =09=09=09=09 "#\n" =09=09=09=09 "# %s\n" =09=09=09=09 "#\n", str); =09=09=09need_newline =3D false; -=09=09} else if (!(sym->flags & SYMBOL_CHOICE) && -=09=09=09 !(sym->flags & SYMBOL_WRITTEN)) { +=09=09} + +=09=09if (sym && !(sym->flags & SYMBOL_CHOICE) && +=09=09 !(sym->flags & SYMBOL_WRITTEN)) { =09=09=09sym_calc_value(sym); =09=09=09if (!(sym->flags & SYMBOL_WRITE)) =09=09=09=09goto next; @@ -896,11 +899,11 @@ int conf_write(const char *name) =09=09=09menu =3D menu->list; =09=09=09continue; =09=09} -=09=09if (menu->next) -=09=09=09menu =3D menu->next; -=09=09else while ((menu =3D menu->parent)) { -=09=09=09if (!menu->sym && menu_is_visible(menu) && -=09=09=09 menu !=3D &rootmenu) { + +=09=09do { +=09=09=09if (((menu->sym && menu->sym->flags & SYMBOL_CHOICE) || +=09=09=09 (menu->prompt && menu->prompt->type =3D=3D P_MENU)) && +=09=09=09 menu_is_visible(menu) && menu !=3D &rootmenu) { =09=09=09=09str =3D menu_get_prompt(menu); =09=09=09=09fprintf(out, "# end of %s\n", str); =09=09=09=09need_newline =3D true; @@ -909,7 +912,7 @@ int conf_write(const char *name) =09=09=09=09menu =3D menu->next; =09=09=09=09break; =09=09=09} -=09=09} +=09=09} while ((menu =3D menu->parent)); =09} =09fclose(out); -- 2.31.0