summaryrefslogtreecommitdiff
path: root/util/kconfig/zconf.y
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2008-02-29 05:11:50 +0100
committerRonald G. Minnich <rminnich@gmail.com>2013-05-26 11:49:12 +0200
commit543aa7ba7bcc367d420f910141c33068154e5b3a (patch)
treed6d0b8d512978ac68fb03334776031b124dcf726 /util/kconfig/zconf.y
parent5750fddcba16101e39bf9ec739d9a8bc8e2c0ae9 (diff)
downloadcoreboot-543aa7ba7bcc367d420f910141c33068154e5b3a.tar.xz
kconfig: add named choice group
As choice dependency are now fully checked, it's quite easy to add support for named choices. This lifts the restriction that a choice value can only appear once, although it still has to be within the same group, but multiple choices can be joined by giving them a name. While at it I cleaned up a little the choice type logic to simplify it a bit. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> ======= Cherry-picked from the Linux kernel. Change-Id: If0f00d1783907d606220cda5307b8960d3bfc38d Signed-off-by: Gabe Black <gabeblack@chromium.org> Reviewed-on: http://review.coreboot.org/3291 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'util/kconfig/zconf.y')
-rw-r--r--util/kconfig/zconf.y13
1 files changed, 8 insertions, 5 deletions
diff --git a/util/kconfig/zconf.y b/util/kconfig/zconf.y
index eac13c326d..fbd9120ad6 100644
--- a/util/kconfig/zconf.y
+++ b/util/kconfig/zconf.y
@@ -91,7 +91,7 @@ static struct menu *current_menu, *current_entry;
%type <id> end
%type <id> option_name
%type <menu> if_entry menu_entry choice_entry
-%type <string> symbol_option_arg
+%type <string> symbol_option_arg word_opt
%destructor {
fprintf(stderr, "%s:%d: missing end statement for this entry\n",
@@ -239,10 +239,10 @@ symbol_option_arg:
/* choice entry */
-choice: T_CHOICE T_EOL
+choice: T_CHOICE word_opt T_EOL
{
- struct symbol *sym = sym_lookup(NULL, 0);
- sym->flags |= SYMBOL_CHOICE;
+ struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE);
+ sym->flags |= SYMBOL_AUTO;
menu_add_entry(sym);
menu_add_expr(P_CHOICE, NULL, NULL);
printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
@@ -456,9 +456,12 @@ expr: symbol { $$ = expr_alloc_symbol($1); }
;
symbol: T_WORD { $$ = sym_lookup($1, 0); free($1); }
- | T_WORD_QUOTE { $$ = sym_lookup($1, 1); free($1); }
+ | T_WORD_QUOTE { $$ = sym_lookup($1, SYMBOL_CONST); free($1); }
;
+word_opt: /* empty */ { $$ = NULL; }
+ | T_WORD
+
%%
void conf_parse(const char *name)