Skip to content

Commit aff11cd

Browse files
a13xp0p0vmasahir0y
authored andcommitted
kconfig: Terminate menu blocks with a comment in the generated config
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 <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 233c741 commit aff11cd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

scripts/kconfig/confdata.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,7 @@ int conf_write(const char *name)
867867
const char *str;
868868
char tmpname[PATH_MAX + 1], oldname[PATH_MAX + 1];
869869
char *env;
870+
bool need_newline = false;
870871

871872
if (!name)
872873
name = conf_get_configname();
@@ -912,12 +913,16 @@ int conf_write(const char *name)
912913
"#\n"
913914
"# %s\n"
914915
"#\n", str);
916+
need_newline = false;
915917
} else if (!(sym->flags & SYMBOL_CHOICE)) {
916918
sym_calc_value(sym);
917919
if (!(sym->flags & SYMBOL_WRITE))
918920
goto next;
921+
if (need_newline) {
922+
fprintf(out, "\n");
923+
need_newline = false;
924+
}
919925
sym->flags &= ~SYMBOL_WRITE;
920-
921926
conf_write_symbol(out, sym, &kconfig_printer_cb, NULL);
922927
}
923928

@@ -929,6 +934,12 @@ int conf_write(const char *name)
929934
if (menu->next)
930935
menu = menu->next;
931936
else while ((menu = menu->parent)) {
937+
if (!menu->sym && menu_is_visible(menu) &&
938+
menu != &rootmenu) {
939+
str = menu_get_prompt(menu);
940+
fprintf(out, "# end of %s\n", str);
941+
need_newline = true;
942+
}
932943
if (menu->next) {
933944
menu = menu->next;
934945
break;

0 commit comments

Comments
 (0)