[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211213100043.45645-3-arielmarcovitch@gmail.com>
Date: Mon, 13 Dec 2021 12:00:43 +0200
From: Ariel Marcovitch <arielmarcovitch@...il.com>
To: masahiroy@...nel.org
Cc: linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
Ariel Marcovitch <arielmarcovitch@...il.com>
Subject: [PATCH 2/2] kconfig: Make comments look different than menus in .config
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@...il.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
Powered by blists - more mailing lists