summaryrefslogtreecommitdiff
path: root/scripts/kconfig
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2022-02-14 06:19:18 +0300
committerMasahiro Yamada <masahiroy@kernel.org>2022-02-18 05:36:17 +0300
commita7d4f58e99dd3f6067606115ce147c15c17b6e93 (patch)
treedc0b210afb7fd50abc984506a43e419eb91e41cd /scripts/kconfig
parent868653f421cd37e8ec3880da19f0aac93f5c46cc (diff)
downloadlinux-a7d4f58e99dd3f6067606115ce147c15c17b6e93.tar.xz
kconfig: fix missing '# end of' for empty menu
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>
Diffstat (limited to 'scripts/kconfig')
-rw-r--r--scripts/kconfig/confdata.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 94dcec2cc803..901835a56e89 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -903,19 +903,20 @@ next:
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);