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 <judge.packham@gmail.com>
This commit is contained in:
Chris Packham 2021-02-01 20:14:11 +13:00
parent 30bffa96b2
commit 5263bf8339
3 changed files with 20 additions and 23 deletions

View File

@ -65,7 +65,8 @@ void menu_add_entry(struct symbol *sym)
struct menu *menu_add_menu(void) struct menu *menu_add_menu(void)
{ {
last_entry_ptr = &current_entry->list; last_entry_ptr = &current_entry->list;
return current_menu = current_entry; current_menu = current_entry;
return current_menu;
} }
void menu_end_menu(void) 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); struct property *prop = menu_add_prop(type, NULL, dep);
/* For crostool-NG, a leading pipe followed with spaces if (isspace(*prompt)) {
* means that pipe shall be removed, and the spaces should
* not be trimmed.
*/
if (*prompt == '|')
prompt++;
else if (isspace(*prompt)) {
prop_warn(prop, "leading whitespace ignored"); prop_warn(prop, "leading whitespace ignored");
while (isspace(*prompt)) while (isspace(*prompt))
prompt++; prompt++;

View File

@ -119,20 +119,24 @@ mainmenu_stmt: T_MAINMENU T_WORD_QUOTE T_EOL
stmt_list: stmt_list:
/* empty */ /* empty */
| stmt_list common_stmt | stmt_list assignment_stmt
| stmt_list choice_stmt | stmt_list choice_stmt
| stmt_list comment_stmt
| stmt_list config_stmt
| stmt_list if_stmt
| stmt_list menu_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 T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); }
| stmt_list error T_EOL { zconf_error("invalid statement"); } | stmt_list error T_EOL { zconf_error("invalid statement"); }
; ;
common_stmt: stmt_list_in_choice:
if_stmt /* empty */
| comment_stmt | stmt_list_in_choice comment_stmt
| config_stmt | stmt_list_in_choice config_stmt
| menuconfig_stmt | stmt_list_in_choice if_stmt_in_choice
| source_stmt | stmt_list_in_choice error T_EOL { zconf_error("invalid statement"); }
| assignment_stmt
; ;
/* config/menuconfig entry */ /* 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: choice_option_list:
@ -305,11 +309,6 @@ default:
| T_DEF_BOOL { $$ = S_BOOLEAN; } | T_DEF_BOOL { $$ = S_BOOLEAN; }
| T_DEF_TRISTATE { $$ = S_TRISTATE; } | T_DEF_TRISTATE { $$ = S_TRISTATE; }
choice_block:
/* empty */
| choice_block common_stmt
;
/* if entry */ /* if entry */
if_entry: T_IF expr T_EOL if_entry: T_IF expr T_EOL
@ -331,6 +330,9 @@ if_end: end
if_stmt: if_entry stmt_list if_end if_stmt: if_entry stmt_list if_end
; ;
if_stmt_in_choice: if_entry stmt_list_in_choice if_end
;
/* menu entry */ /* menu entry */
menu: T_MENU T_WORD_QUOTE T_EOL menu: T_MENU T_WORD_QUOTE T_EOL

View File

@ -831,7 +831,7 @@ struct symbol *sym_lookup(const char *name, int flags)
memset(symbol, 0, sizeof(*symbol)); memset(symbol, 0, sizeof(*symbol));
symbol->name = new_name; symbol->name = new_name;
symbol->type = S_UNKNOWN; symbol->type = S_UNKNOWN;
symbol->flags |= flags; symbol->flags = flags;
symbol->next = symbol_hash[hash]; symbol->next = symbol_hash[hash];
symbol_hash[hash] = symbol; symbol_hash[hash] = symbol;