From: Masahiro Yamada Date: Sun, 10 Mar 2024 13:45:15 +0000 (+0900) Subject: kconfig: check prompt for choice while parsing X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=4957515b9c3aa3d32a1ee44ab77f0a44f29263dc;p=linux.git kconfig: check prompt for choice while parsing This can be checked on-the-fly. Signed-off-by: Masahiro Yamada --- diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 840ce642ec439..8498481e6afe3 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -561,9 +561,6 @@ void menu_finalize(struct menu *parent) if (sym->type == S_UNKNOWN) menu_warn(parent, "config symbol defined without type"); - if (sym_is_choice(sym) && !parent->prompt) - menu_warn(parent, "choice must have a prompt"); - /* Check properties connected to this symbol */ sym_check_prop(sym); sym->flags |= SYMBOL_WARNED; diff --git a/scripts/kconfig/parser.y b/scripts/kconfig/parser.y index 22f616334585b..b45bfaf0a02b1 100644 --- a/scripts/kconfig/parser.y +++ b/scripts/kconfig/parser.y @@ -233,6 +233,12 @@ choice: T_CHOICE T_EOL choice_entry: choice choice_option_list { + if (!current_entry->prompt) { + fprintf(stderr, "%s:%d: error: choice must have a prompt\n", + current_entry->filename, current_entry->lineno); + yynerrs++; + } + $$ = menu_add_menu(); };