Skip to content

Commit 9b11452

Browse files
committed
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: Masahiro Yamada <[email protected]>
1 parent bd988e7 commit 9b11452

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

scripts/kconfig/parser.y

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ static void zconf_error(const char *err, ...);
2828
static bool zconf_endtoken(const char *tokenname,
2929
const char *expected_tokenname);
3030

31-
struct menu *current_menu, *current_entry;
32-
33-
static bool inside_choice = false;
31+
struct menu *current_menu, *current_entry, *current_choice;
3432

3533
%}
3634

@@ -147,7 +145,7 @@ config_entry_start: T_CONFIG nonconst_symbol T_EOL
147145

148146
config_stmt: config_entry_start config_option_list
149147
{
150-
if (inside_choice) {
148+
if (current_choice) {
151149
if (!current_entry->prompt) {
152150
fprintf(stderr, "%s:%d: error: choice member must have a prompt\n",
153151
current_entry->filename, current_entry->lineno);
@@ -256,12 +254,12 @@ choice_entry: choice choice_option_list
256254

257255
$$ = menu_add_menu();
258256

259-
inside_choice = true;
257+
current_choice = current_entry;
260258
};
261259

262260
choice_end: end
263261
{
264-
inside_choice = false;
262+
current_choice = NULL;
265263

266264
if (zconf_endtoken($1, "choice")) {
267265
menu_end_menu();

0 commit comments

Comments
 (0)