* [PATCH] kconfig: fix missing '# end of' for empty menu
@ 2022-02-14 3:19 Masahiro Yamada
0 siblings, 0 replies; only message in thread
From: Masahiro Yamada @ 2022-02-14 3:19 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel, Masahiro Yamada
Currently, "# end of ..." is inserted when the menu goes back to its
parent.
Hence, an empty menu:
menu "Foo"
endmenu
... ends up with unbalanced menu comments, like this:
#
# Foo
#
Let's close the menu comments properly:
#
# Foo
#
# end of Foo
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/kconfig/confdata.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index d3c3a61308ad..36fd254fcaa1 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -903,19 +903,20 @@ int conf_write(const char *name)
menu = menu->list;
continue;
}
- if (menu->next)
+
+end_check:
+ if (!menu->sym && menu_is_visible(menu) && menu != &rootmenu &&
+ menu->prompt->type == P_MENU) {
+ fprintf(out, "# end of %s\n", menu_get_prompt(menu));
+ need_newline = true;
+ }
+
+ 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;
- }
+ } else {
+ menu = menu->parent;
+ if (menu)
+ goto end_check;
}
}
fclose(out);
--
2.32.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-14 3:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14 3:19 [PATCH] kconfig: fix missing '# end of' for empty menu Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®