Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2655919yba; Fri, 17 May 2019 23:35:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0ZVmKdOcLymxHTHJROuQtFj2fyyd6zZLZTOuFCz4zSq5u2NOwRaDulK2iidWG7SY1u5Uz X-Received: by 2002:a63:d354:: with SMTP id u20mr13051026pgi.129.1558161352951; Fri, 17 May 2019 23:35:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558161352; cv=none; d=google.com; s=arc-20160816; b=tByRheIMPgqBY4fCOHwmHJmIfFoWyf00EHKq+33vbQkV6JwDgM1MPJBrsCIpUh5wd4 EOFPb3ms+9b4Vd82Hobr9IndKOUQZReggMp5hYHH5CLQqkDe0trGKWz18PujCqE18kXC O6Y7mZ5N/qZTEmIbrNMYaqnNo5W0tkRt52aqFmPIvJpUepQ2Fj2k/eRkIhEm4jfh6J23 Ej6QCXP3UvRxyBQ3HPAPSTa/PoZCvwq+PTPfVl/7bwfQHuOtvgBaB0otDIS7zjEJ7/a+ xpcF5mSFfcQwyvdQplLWplMENwXvqMmdNoKX3J4WwOqzEhaITWD3VN1B5EbfDsu8etIa Eglg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=ei52fYKWjTlRAbyCt0fr60Z6fZOw8HyESNllhyAewIw=; b=Yw3SmX2AU4+ZY+74KsfCYXYCo7hm7EffX6FkrjawcXUoGK658A+CdzNmg7rwc0bQWR 03y6/5jJ6niS0ckAmLZlSnmxSxe+NFI4D56PGh2h9We0hxchYr6O1vGz2vmmZ1nZ9s+Y 0nuWS44frJBfZA+fcSx2VsXbiXALkvcookxIpSJDuLLBpQh0kqM7RjAax7I/KGgmy/Uk 1I1E1VMshlKMftGJttfcYRvrGEv1nEms65hPtv5sEY7TEWS5ZTEl53UYpYJsyMxhifup 77FC+LeC1as9aBPXfVDP7CQV7Npr23HUvAIVIxGH1lzxmLIK1wdgmNy7waMHnGdtHl/R bliA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=zWD6szCu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k23si7849205pls.88.2019.05.17.23.35.38; Fri, 17 May 2019 23:35:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=zWD6szCu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727261AbfERGbP (ORCPT + 99 others); Sat, 18 May 2019 02:31:15 -0400 Received: from conssluserg-03.nifty.com ([210.131.2.82]:60034 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725268AbfERGbP (ORCPT ); Sat, 18 May 2019 02:31:15 -0400 Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com [209.85.217.53]) (authenticated) by conssluserg-03.nifty.com with ESMTP id x4I6Uvd7026025; Sat, 18 May 2019 15:30:58 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com x4I6Uvd7026025 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1558161058; bh=ei52fYKWjTlRAbyCt0fr60Z6fZOw8HyESNllhyAewIw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=zWD6szCuLtmRonWEDr/i2GNYVDvgxpAEAVRtSHIJWGTD9cRuRfRv+Vn41+aXOli7M WcwOquKf3EEVUm3mlfeWRdTMu28Ubl3wgY/pcYqoZ+eJ6NUDeukoATYvgXCVlZk+++ 8wNPJPlUEI6WL7nDCzYT8Uiqyfxcc4lk+aDl7PE4hpIc/lxU0ne8g8BqSSOn3hXJHl GoEroYnTeUH91xNuEN0nahJgHLetOeQlQvgvhY1YuTTmh9pIczJbBXNoXgeqApeHHW EvVnAqIx5sSPbxXNjgMxdQ9xcxAt7DiUCHr/8pn5kd1ke5hmT72umZrVczbOrtK0OR y92HvrN0jR6FA== X-Nifty-SrcIP: [209.85.217.53] Received: by mail-vs1-f53.google.com with SMTP id z11so6009755vsq.9; Fri, 17 May 2019 23:30:58 -0700 (PDT) X-Gm-Message-State: APjAAAVXsSCvuV4xz2GE0rGMxYSSktsqRHx12t94QSjYjKcQf7uGCK0i DvhfgpILedSBTtxnJ2tOQ7aIKm2xMQSB3TEvBCY= X-Received: by 2002:a67:fc4:: with SMTP id 187mr8390761vsp.215.1558161056885; Fri, 17 May 2019 23:30:56 -0700 (PDT) MIME-Version: 1.0 References: <1558122142-10683-1-git-send-email-alex.popov@linux.com> In-Reply-To: <1558122142-10683-1-git-send-email-alex.popov@linux.com> From: Masahiro Yamada Date: Sat, 18 May 2019 15:30:20 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [v3 1/1] kconfig: Terminate menu blocks with a comment in the generated config To: Alexander Popov Cc: Kees Cook , Michal Marek , Linux Kbuild mailing list , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 18, 2019 at 4:42 AM Alexander Popov wrote: > > Currently menu blocks start with a pretty header but end with nothing in > the generated config. So next config options stick together with the > options from the menu block. > > Let's terminate menu blocks in the generated config with a comment and > a newline if needed. Example: > > ... > CONFIG_BPF_STREAM_PARSER=y > CONFIG_NET_FLOW_LIMIT=y > > # > # Network testing > # > CONFIG_NET_PKTGEN=y > CONFIG_NET_DROP_MONITOR=y > # end of Network testing > # end of Networking options > > CONFIG_HAMRADIO=y > ... > > Signed-off-by: Alexander Popov Applied to linux-kbuild. Thanks. > --- > > v3 changes: > - rebase onto the recent rc; > - don't print the end comment for the rootmenu to avoid breaking > 'make testconfig' (thanks to Masahiro Yamada). > > --- > scripts/kconfig/confdata.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c > index 492ac34..6006154 100644 > --- a/scripts/kconfig/confdata.c > +++ b/scripts/kconfig/confdata.c > @@ -867,6 +867,7 @@ int conf_write(const char *name) > const char *str; > char tmpname[PATH_MAX + 1], oldname[PATH_MAX + 1]; > char *env; > + bool need_newline = false; > > if (!name) > name = conf_get_configname(); > @@ -912,12 +913,16 @@ int conf_write(const char *name) > "#\n" > "# %s\n" > "#\n", str); > + need_newline = false; > } else if (!(sym->flags & SYMBOL_CHOICE)) { > sym_calc_value(sym); > if (!(sym->flags & SYMBOL_WRITE)) > goto next; > + if (need_newline) { > + fprintf(out, "\n"); > + need_newline = false; > + } > sym->flags &= ~SYMBOL_WRITE; > - > conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); > } > > @@ -929,6 +934,12 @@ int conf_write(const char *name) > if (menu->next) > menu = menu->next; > else while ((menu = menu->parent)) { > + if (!menu->sym && menu_is_visible(menu) && > + menu != &rootmenu) { > + str = menu_get_prompt(menu); > + fprintf(out, "# end of %s\n", str); > + need_newline = true; > + } > if (menu->next) { > menu = menu->next; > break; > -- > 2.7.4 > -- Best Regards Masahiro Yamada