Commit 9b114520 authored by Masahiro Yamada's avatar Masahiro Yamada

kconfig: remember the current choice while parsing the choice block

Instead of the boolean flag, it will be more useful to remember the
current choice being parsed.
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent bd988e7c
...@@ -28,9 +28,7 @@ static void zconf_error(const char *err, ...); ...@@ -28,9 +28,7 @@ static void zconf_error(const char *err, ...);
static bool zconf_endtoken(const char *tokenname, static bool zconf_endtoken(const char *tokenname,
const char *expected_tokenname); const char *expected_tokenname);
struct menu *current_menu, *current_entry; struct menu *current_menu, *current_entry, *current_choice;
static bool inside_choice = false;
%} %}
...@@ -147,7 +145,7 @@ config_entry_start: T_CONFIG nonconst_symbol T_EOL ...@@ -147,7 +145,7 @@ config_entry_start: T_CONFIG nonconst_symbol T_EOL
config_stmt: config_entry_start config_option_list config_stmt: config_entry_start config_option_list
{ {
if (inside_choice) { if (current_choice) {
if (!current_entry->prompt) { if (!current_entry->prompt) {
fprintf(stderr, "%s:%d: error: choice member must have a prompt\n", fprintf(stderr, "%s:%d: error: choice member must have a prompt\n",
current_entry->filename, current_entry->lineno); current_entry->filename, current_entry->lineno);
...@@ -256,12 +254,12 @@ choice_entry: choice choice_option_list ...@@ -256,12 +254,12 @@ choice_entry: choice choice_option_list
$$ = menu_add_menu(); $$ = menu_add_menu();
inside_choice = true; current_choice = current_entry;
}; };
choice_end: end choice_end: end
{ {
inside_choice = false; current_choice = NULL;
if (zconf_endtoken($1, "choice")) { if (zconf_endtoken($1, "choice")) {
menu_end_menu(); menu_end_menu();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment