From 5263bf8339a07a967f0a923d237e8a36d20439fc Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Mon, 1 Feb 2021 20:14:11 +1300 Subject: kconfig: Sync with upstream v5.8 09d5873e4d1f kconfig: allow only 'config', 'comment', and 'if' inside 'choice' 644a4b6cecc2 kconfig: do not assign a variable in the return statement cfc6eea9f6af kconfig: do not use OR-assignment for zero-cleared structure Signed-off-by: Chris Packham diff --git a/kconfig/menu.c b/kconfig/menu.c index bfd7800..a5fbd6c 100644 --- a/kconfig/menu.c +++ b/kconfig/menu.c @@ -65,7 +65,8 @@ void menu_add_entry(struct symbol *sym) struct menu *menu_add_menu(void) { last_entry_ptr = ¤t_entry->list; - return current_menu = current_entry; + current_menu = current_entry; + return current_menu; } void menu_end_menu(void) @@ -157,13 +158,7 @@ struct property *menu_add_prompt(enum prop_type type, char *prompt, { struct property *prop = menu_add_prop(type, NULL, dep); - /* For crostool-NG, a leading pipe followed with spaces - * means that pipe shall be removed, and the spaces should - * not be trimmed. - */ - if (*prompt == '|') - prompt++; - else if (isspace(*prompt)) { + if (isspace(*prompt)) { prop_warn(prop, "leading whitespace ignored"); while (isspace(*prompt)) prompt++; diff --git a/kconfig/parser.y b/kconfig/parser.y index 708b6c4..190f111 100644 --- a/kconfig/parser.y +++ b/kconfig/parser.y @@ -119,20 +119,24 @@ mainmenu_stmt: T_MAINMENU T_WORD_QUOTE T_EOL stmt_list: /* empty */ - | stmt_list common_stmt + | stmt_list assignment_stmt | stmt_list choice_stmt + | stmt_list comment_stmt + | stmt_list config_stmt + | stmt_list if_stmt | stmt_list menu_stmt + | stmt_list menuconfig_stmt + | stmt_list source_stmt | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); } | stmt_list error T_EOL { zconf_error("invalid statement"); } ; -common_stmt: - if_stmt - | comment_stmt - | config_stmt - | menuconfig_stmt - | source_stmt - | assignment_stmt +stmt_list_in_choice: + /* empty */ + | stmt_list_in_choice comment_stmt + | stmt_list_in_choice config_stmt + | stmt_list_in_choice if_stmt_in_choice + | stmt_list_in_choice error T_EOL { zconf_error("invalid statement"); } ; /* config/menuconfig entry */ @@ -254,7 +258,7 @@ choice_end: end } }; -choice_stmt: choice_entry choice_block choice_end +choice_stmt: choice_entry stmt_list_in_choice choice_end ; choice_option_list: @@ -305,11 +309,6 @@ default: | T_DEF_BOOL { $$ = S_BOOLEAN; } | T_DEF_TRISTATE { $$ = S_TRISTATE; } -choice_block: - /* empty */ - | choice_block common_stmt -; - /* if entry */ if_entry: T_IF expr T_EOL @@ -331,6 +330,9 @@ if_end: end if_stmt: if_entry stmt_list if_end ; +if_stmt_in_choice: if_entry stmt_list_in_choice if_end +; + /* menu entry */ menu: T_MENU T_WORD_QUOTE T_EOL diff --git a/kconfig/symbol.c b/kconfig/symbol.c index 3dc8139..9363e37 100644 --- a/kconfig/symbol.c +++ b/kconfig/symbol.c @@ -831,7 +831,7 @@ struct symbol *sym_lookup(const char *name, int flags) memset(symbol, 0, sizeof(*symbol)); symbol->name = new_name; symbol->type = S_UNKNOWN; - symbol->flags |= flags; + symbol->flags = flags; symbol->next = symbol_hash[hash]; symbol_hash[hash] = symbol; -- cgit v0.10.2-6-g49f6