From: Ariel Marcovitch <arielmarcovitch@gmail.com>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] kconfig: Make comments look different than menus in .config
Date: Fri, 18 Feb 2022 20:55:49 +0200 [thread overview]
Message-ID: <8043765d-2aa5-16ad-cc03-127398451e93@gmail.com> (raw)
In-Reply-To: <CAK7LNAQb8ivsQX-0YDNx6B_ZTBUq9v7SSG+m8=e1GsGL-DuBsg@mail.gmail.com>
On 18/01/2022 20:25, Masahiro Yamada wrote:
> On Mon, Dec 13, 2021 at 7:01 PM Ariel Marcovitch
> <arielmarcovitch@gmail.com> wrote:
>> Currently, the same code that handles menus in the write to .config
>> handles comments as well. That's why comments look exactly like menus in
>> the .config except for the 'end of menu' comments that appear only for
>> menus. This makes sense because sometimes comments are used as sort of
>> submenus. However for the other cases, it looks kinda weird because one
>> might attempt to look for the 'end of menu' for comments as well and be
>> very confused.
>>
>> Make comments look different than menus. For the following:
>> ```kconfig
>> menu "Stuff"
>>
>> config FOO
>> def_bool y
>>
>> comment "Some comment"
>>
>> config BAR
>> def_bool n
>>
>> endmenu
>> ```
>>
>> The .config will look like this:
>> ```
>> #
>> # Stuff
>> #
>> CONFIG_FOO=y
>>
>> ### Some comment
>> # CONFIG_BAR is not defined
>> # end of Stuff
>>
>> ```
>>
>> Signed-off-by: Ariel Marcovitch <arielmarcovitch@gmail.com>
>> ---
>> scripts/kconfig/confdata.c | 14 ++++++++++----
>> 1 file changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
>> index 9f2c22f46ee0..d3ec1ad67d92 100644
>> --- a/scripts/kconfig/confdata.c
>> +++ b/scripts/kconfig/confdata.c
>> @@ -880,10 +880,16 @@ int conf_write(const char *name)
>>
>> if (type == P_MENU || type == P_COMMENT) {
>> str = menu_get_prompt(menu);
>> - fprintf(out, "\n"
>> - "#\n"
>> - "# %s\n"
>> - "#\n", str);
>> +
>> + if (type == P_MENU)
>> + fprintf(out, "\n"
>> + "#\n"
>> + "# %s\n"
>> + "#\n", str);
>> + else
>> + fprintf(out, "\n"
>> + "### %s\n", str);
>> +
>> need_newline = false;
>> }
>> }
>> --
>> 2.25.1
>>
>
> Since "# CONFIG... is not set" looks like a comment,
> I am not sure if this improves the visibility.
I agree that adding another '#' signs to the real comments doesn't solve
the real
problem here, being that kconfig uses comments to save actual information
I guess this is for being able to check for a config in shell script
with [[ -n $CONFIG_FOO ]]?
Although if that's the case, leaving the config empty has the same
effect, no? And then
we can add a comment to the end of the definition stating that the
config is unset.
Something like this:
CONFIG_FOO=y
CONFIG_BAR= # is not set
It may break scripts doing something like this:
: ${CONFIG_FOO=?Config FOO must be defined}
But they can be changed to use ':?' instead (which checks for non-zero
length string
rather than whether the variable is defined or not)
Actually, now that I think of it, it might even be an improvement for
scripts to be able to tell whether a config isn't defined or whether it
has an 'n' value
Anyway, I'm absolutely fine with delaying this patch until we find a
solution
>
> I will not pick up this until I find out what a really good format is.
Thanks!
next prev parent reply other threads:[~2022-02-18 18:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-13 10:00 [PATCH 0/2] kconfig: Improve comment blocks in the .config file Ariel Marcovitch
2021-12-13 10:00 ` [PATCH 1/2] kconfig: Show menuconfigs as menus " Ariel Marcovitch
2022-01-18 18:20 ` Masahiro Yamada
2022-02-18 18:39 ` Ariel Marcovitch
2022-02-20 2:23 ` Masahiro Yamada
2021-12-13 10:00 ` [PATCH 2/2] kconfig: Make comments look different than menus in .config Ariel Marcovitch
2022-01-18 18:25 ` Masahiro Yamada
2022-02-18 18:55 ` Ariel Marcovitch [this message]
2022-02-20 4:17 ` Masahiro Yamada
2021-12-13 11:47 ` [PATCH 0/2] kconfig: Improve comment blocks in the .config file Boris Kolpackov
2021-12-14 8:27 ` Ariel Marcovitch
2022-01-15 13:58 ` Ariel Marcovitch
2022-01-15 13:58 ` Ariel Marcovitch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8043765d-2aa5-16ad-cc03-127398451e93@gmail.com \
--to=arielmarcovitch@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox