summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAlexander Popov <alex.popov@linux.com>2019-05-17 15:42:22 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-05-18 02:31:24 -0400
commitaff11cd983ec0850651ee9b1c2a88b33358cb2f2 (patch)
treedb795d685f504d0c49bb2fcec043e3d967ead739 /scripts
parent233c741dcbb135aeaeab89b74ab9681e4ca2e921 (diff)
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 <alex.popov@linux.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/confdata.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 492ac3410147..6006154d36bd 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -867,6 +867,7 @@ int conf_write(const char *name)
867 const char *str; 867 const char *str;
868 char tmpname[PATH_MAX + 1], oldname[PATH_MAX + 1]; 868 char tmpname[PATH_MAX + 1], oldname[PATH_MAX + 1];
869 char *env; 869 char *env;
870 bool need_newline = false;
870 871
871 if (!name) 872 if (!name)
872 name = conf_get_configname(); 873 name = conf_get_configname();
@@ -912,12 +913,16 @@ int conf_write(const char *name)
912 "#\n" 913 "#\n"
913 "# %s\n" 914 "# %s\n"
914 "#\n", str); 915 "#\n", str);
916 need_newline = false;
915 } else if (!(sym->flags & SYMBOL_CHOICE)) { 917 } else if (!(sym->flags & SYMBOL_CHOICE)) {
916 sym_calc_value(sym); 918 sym_calc_value(sym);
917 if (!(sym->flags & SYMBOL_WRITE)) 919 if (!(sym->flags & SYMBOL_WRITE))
918 goto next; 920 goto next;
921 if (need_newline) {
922 fprintf(out, "\n");
923 need_newline = false;
924 }
919 sym->flags &= ~SYMBOL_WRITE; 925 sym->flags &= ~SYMBOL_WRITE;
920
921 conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); 926 conf_write_symbol(out, sym, &kconfig_printer_cb, NULL);
922 } 927 }
923 928
@@ -929,6 +934,12 @@ next:
929 if (menu->next) 934 if (menu->next)
930 menu = menu->next; 935 menu = menu->next;
931 else while ((menu = menu->parent)) { 936 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 }
932 if (menu->next) { 943 if (menu->next) {
933 menu = menu->next; 944 menu = menu->next;
934 break; 945 break;