Skip to content

Commit 4957515

Browse files
committed
kconfig: check prompt for choice while parsing
This can be checked on-the-fly. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
1 parent c33a431 commit 4957515

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

scripts/kconfig/menu.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,6 @@ void menu_finalize(struct menu *parent)
561561
if (sym->type == S_UNKNOWN)
562562
menu_warn(parent, "config symbol defined without type");
563563

564-
if (sym_is_choice(sym) && !parent->prompt)
565-
menu_warn(parent, "choice must have a prompt");
566-
567564
/* Check properties connected to this symbol */
568565
sym_check_prop(sym);
569566
sym->flags |= SYMBOL_WARNED;

scripts/kconfig/parser.y

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@ choice: T_CHOICE T_EOL
233233

234234
choice_entry: choice choice_option_list
235235
{
236+
if (!current_entry->prompt) {
237+
fprintf(stderr, "%s:%d: error: choice must have a prompt\n",
238+
current_entry->filename, current_entry->lineno);
239+
yynerrs++;
240+
}
241+
236242
$$ = menu_add_menu();
237243
};
238244

0 commit comments

Comments
 (0)