kconfig: drop 'boolean' keyword
[carl9170fw.git] / config / zconf.y
index 7ca795404d38e2860f8c3cb046c2bbaea7c506e4..f2b97443142dbc734efacd913a274a89f1167f16 100644 (file)
@@ -109,7 +109,27 @@ static struct menu *current_menu, *current_entry;
 %%
 input: nl start | start;
 
-start: mainmenu_stmt stmt_list | stmt_list;
+start: mainmenu_stmt stmt_list | no_mainmenu_stmt stmt_list;
+
+/* mainmenu entry */
+
+mainmenu_stmt: T_MAINMENU prompt nl
+{
+       menu_add_prompt(P_MENU, $2, NULL);
+};
+
+/* Default main menu, if there's no mainmenu entry */
+
+no_mainmenu_stmt: /* empty */
+{
+       /*
+        * Hack: Keep the main menu title on the heap so we can safely free it
+        * later regardless of whether it comes from the 'prompt' in
+        * mainmenu_stmt or here
+        */
+       menu_add_prompt(P_MENU, strdup("Linux Kernel Configuration"), NULL);
+};
+
 
 stmt_list:
          /* empty */
@@ -155,7 +175,6 @@ config_entry_start: T_CONFIG nonconst_symbol T_EOL
 
 config_stmt: config_entry_start config_option_list
 {
-       menu_end_entry();
        printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
 };
 
@@ -172,7 +191,6 @@ menuconfig_stmt: menuconfig_entry_start config_option_list
                current_entry->prompt->type = P_MENU;
        else
                zconfprint("warning: menuconfig statement without prompt");
-       menu_end_entry();
        printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
 };
 
@@ -236,8 +254,10 @@ symbol_option_list:
        | symbol_option_list T_WORD symbol_option_arg
 {
        const struct kconf_id *id = kconf_id_lookup($2, strlen($2));
-       if (id && id->flags & TF_OPTION)
+       if (id && id->flags & TF_OPTION) {
                menu_add_option(id->token, $3);
+               free($3);
+       }
        else
                zconfprint("warning: ignoring unknown option %s", $2);
        free($2);
@@ -350,13 +370,6 @@ if_block:
        | if_block choice_stmt
 ;
 
-/* mainmenu entry */
-
-mainmenu_stmt: T_MAINMENU prompt nl
-{
-       menu_add_prompt(P_MENU, $2, NULL);
-};
-
 /* menu entry */
 
 menu: T_MENU prompt T_EOL
@@ -406,9 +419,7 @@ comment: T_COMMENT prompt T_EOL
 };
 
 comment_stmt: comment depends_list
-{
-       menu_end_entry();
-};
+;
 
 /* help option */
 
@@ -505,6 +516,7 @@ word_opt: /* empty */                       { $$ = NULL; }
 
 void conf_parse(const char *name)
 {
+       const char *tmp;
        struct symbol *sym;
        int i;
 
@@ -522,8 +534,10 @@ void conf_parse(const char *name)
        if (!modules_sym)
                modules_sym = sym_find( "n" );
 
+       tmp = rootmenu.prompt->text;
        rootmenu.prompt->text = _(rootmenu.prompt->text);
        rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
+       free((char*)tmp);
 
        menu_finalize(&rootmenu);
        for_all_symbols(i, sym) {
@@ -626,7 +640,7 @@ static void print_symbol(FILE *out, struct menu *menu)
                fprintf(out, "\nconfig %s\n", sym->name);
        switch (sym->type) {
        case S_BOOLEAN:
-               fputs("  boolean\n", out);
+               fputs("  bool\n", out);
                break;
        case S_TRISTATE:
                fputs("  tristate\n", out);