提交 f05c463b 编写于 作者: L Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild

* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild:
  kconfig: add named choice group
  kconfig: fix choice dependency check
  kconifg: 'select' considered less evil
  dontdiff: ignore timeconst.h
  dontdiff: add modules.order
  kbuild: fix unportability in gen_initramfs_list.sh
  kbuild: fix help output to show correct arch
  kbuild: show defconfig subdirs in make help
  kconfig: reversed borderlines in inputbox
...@@ -141,6 +141,7 @@ mkprep ...@@ -141,6 +141,7 @@ mkprep
mktables mktables
mktree mktree
modpost modpost
modules.order
modversions.h* modversions.h*
offset.h offset.h
offsets.h offsets.h
...@@ -171,6 +172,7 @@ sm_tbl* ...@@ -171,6 +172,7 @@ sm_tbl*
split-include split-include
tags tags
tftpboot.img tftpboot.img
timeconst.h
times.h* times.h*
tkparse tkparse
trix_boot.h trix_boot.h
......
...@@ -104,14 +104,15 @@ applicable everywhere (see syntax). ...@@ -104,14 +104,15 @@ applicable everywhere (see syntax).
Reverse dependencies can only be used with boolean or tristate Reverse dependencies can only be used with boolean or tristate
symbols. symbols.
Note: Note:
select is evil.... select will by brute force set a symbol select should be used with care. select will force
equal to 'y' without visiting the dependencies. So abusing a symbol to a value without visiting the dependencies.
select you are able to select a symbol FOO even if FOO depends By abusing select you are able to select a symbol FOO even
on BAR that is not set. In general use select only for if FOO depends on BAR that is not set.
non-visible symbols (no prompts anywhere) and for symbols with In general use select only for non-visible symbols
no dependencies. That will limit the usefulness but on the (no prompts anywhere) and for symbols with no dependencies.
other hand avoid the illegal configurations all over. kconfig That will limit the usefulness but on the other hand avoid
should one day warn about such things. the illegal configurations all over.
kconfig should one day warn about such things.
- numerical ranges: "range" <symbol> <symbol> ["if" <expr>] - numerical ranges: "range" <symbol> <symbol> ["if" <expr>]
This allows to limit the range of possible input values for int This allows to limit the range of possible input values for int
......
...@@ -1174,8 +1174,10 @@ rpm: include/config/kernel.release FORCE ...@@ -1174,8 +1174,10 @@ rpm: include/config/kernel.release FORCE
# Brief documentation of the typical targets used # Brief documentation of the typical targets used
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
boards := $(wildcard $(srctree)/arch/$(ARCH)/configs/*_defconfig) boards := $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*_defconfig)
boards := $(notdir $(boards)) boards := $(notdir $(boards))
board-dirs := $(dir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*/*_defconfig))
board-dirs := $(sort $(notdir $(board-dirs:/=)))
help: help:
@echo 'Cleaning targets:' @echo 'Cleaning targets:'
...@@ -1221,14 +1223,19 @@ help: ...@@ -1221,14 +1223,19 @@ help:
@echo 'Documentation targets:' @echo 'Documentation targets:'
@$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp @$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp
@echo '' @echo ''
@echo 'Architecture specific targets ($(ARCH)):' @echo 'Architecture specific targets ($(SRCARCH)):'
@$(if $(archhelp),$(archhelp),\ @$(if $(archhelp),$(archhelp),\
echo ' No architecture specific help defined for $(ARCH)') echo ' No architecture specific help defined for $(SRCARCH)')
@echo '' @echo ''
@$(if $(boards), \ @$(if $(boards), \
$(foreach b, $(boards), \ $(foreach b, $(boards), \
printf " %-24s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \ printf " %-24s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \
echo '') echo '')
@$(if $(board-dirs), \
$(foreach b, $(board-dirs), \
printf " %-16s - Show %s-specific targets\\n" help-$(b) $(b);) \
printf " %-16s - Show all of the above\\n" help-boards; \
echo '')
@echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
@echo ' make V=2 [targets] 2 => give reason for rebuild of target' @echo ' make V=2 [targets] 2 => give reason for rebuild of target'
...@@ -1240,6 +1247,20 @@ help: ...@@ -1240,6 +1247,20 @@ help:
@echo 'For further info see the ./README file' @echo 'For further info see the ./README file'
help-board-dirs := $(addprefix help-,$(board-dirs))
help-boards: $(help-board-dirs)
boards-per-dir = $(notdir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/$*/*_defconfig))
$(help-board-dirs): help-%:
@echo 'Architecture specific targets ($(SRCARCH) $*):'
@$(if $(boards-per-dir), \
$(foreach b, $(boards-per-dir), \
printf " %-24s - Build for %s\\n" $*/$(b) $(subst _defconfig,,$(b));) \
echo '')
# Documentation targets # Documentation targets
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
%docs: scripts_basic FORCE %docs: scripts_basic FORCE
......
...@@ -135,7 +135,7 @@ parse() { ...@@ -135,7 +135,7 @@ parse() {
str="${ftype} ${name} ${str} ${dev} ${maj} ${min}" str="${ftype} ${name} ${str} ${dev} ${maj} ${min}"
;; ;;
"slink") "slink")
local target=`field 11 $(LC_ALL=C ls -l "${location}")` local target=`readlink "${location}"`
str="${ftype} ${name} ${target} ${str}" str="${ftype} ${name} ${target} ${str}"
;; ;;
*) *)
......
...@@ -5,25 +5,6 @@ ...@@ -5,25 +5,6 @@
/* A lexical scanner generated by flex */ /* A lexical scanner generated by flex */
#define yy_create_buffer zconf_create_buffer
#define yy_delete_buffer zconf_delete_buffer
#define yy_flex_debug zconf_flex_debug
#define yy_init_buffer zconf_init_buffer
#define yy_flush_buffer zconf_flush_buffer
#define yy_load_buffer_state zconf_load_buffer_state
#define yy_switch_to_buffer zconf_switch_to_buffer
#define yyin zconfin
#define yyleng zconfleng
#define yylex zconflex
#define yylineno zconflineno
#define yyout zconfout
#define yyrestart zconfrestart
#define yytext zconftext
#define yywrap zconfwrap
#define yyalloc zconfalloc
#define yyrealloc zconfrealloc
#define yyfree zconffree
#define FLEX_SCANNER #define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_MINOR_VERSION 5
...@@ -354,7 +335,7 @@ void zconffree (void * ); ...@@ -354,7 +335,7 @@ void zconffree (void * );
/* Begin user sect3 */ /* Begin user sect3 */
#define zconfwrap(n) 1 #define zconfwrap() 1
#define YY_SKIP_YYWRAP #define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR; typedef unsigned char YY_CHAR;
...@@ -1535,7 +1516,7 @@ static int yy_get_next_buffer (void) ...@@ -1535,7 +1516,7 @@ static int yy_get_next_buffer (void)
/* Read in more data. */ /* Read in more data. */
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
(yy_n_chars), num_to_read ); (yy_n_chars), (size_t) num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
} }
...@@ -2007,7 +1988,7 @@ YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size ) ...@@ -2007,7 +1988,7 @@ YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
/** Setup the input buffer state to scan a string. The next call to zconflex() will /** Setup the input buffer state to scan a string. The next call to zconflex() will
* scan from a @e copy of @a str. * scan from a @e copy of @a str.
* @param str a NUL-terminated string to scan * @param yystr a NUL-terminated string to scan
* *
* @return the newly allocated buffer state object. * @return the newly allocated buffer state object.
* @note If you want to scan bytes that may contain NUL values, then use * @note If you want to scan bytes that may contain NUL values, then use
......
...@@ -21,7 +21,7 @@ P(menu_get_help,const char *,(struct menu *menu)); ...@@ -21,7 +21,7 @@ P(menu_get_help,const char *,(struct menu *menu));
/* symbol.c */ /* symbol.c */
P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
P(sym_lookup,struct symbol *,(const char *name, int isconst)); P(sym_lookup,struct symbol *,(const char *name, int flags));
P(sym_find,struct symbol *,(const char *name)); P(sym_find,struct symbol *,(const char *name));
P(sym_re_search,struct symbol **,(const char *pattern)); P(sym_re_search,struct symbol **,(const char *pattern));
P(sym_type_name,const char *,(enum symbol_type type)); P(sym_type_name,const char *,(enum symbol_type type));
......
...@@ -89,7 +89,7 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width ...@@ -89,7 +89,7 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
box_y = y + 2; box_y = y + 2;
box_x = (width - box_width) / 2; box_x = (width - box_width) / 2;
draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2, draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2,
dlg.border.atr, dlg.dialog.atr); dlg.dialog.atr, dlg.border.atr);
print_buttons(dialog, height, width, 0); print_buttons(dialog, height, width, 0);
......
...@@ -235,18 +235,22 @@ void menu_finalize(struct menu *parent) ...@@ -235,18 +235,22 @@ void menu_finalize(struct menu *parent)
sym = parent->sym; sym = parent->sym;
if (parent->list) { if (parent->list) {
if (sym && sym_is_choice(sym)) { if (sym && sym_is_choice(sym)) {
/* find the first choice value and find out choice type */ if (sym->type == S_UNKNOWN) {
for (menu = parent->list; menu; menu = menu->next) { /* find the first choice value to find out choice type */
if (menu->sym) { current_entry = parent;
current_entry = parent; for (menu = parent->list; menu; menu = menu->next) {
if (sym->type == S_UNKNOWN) if (menu->sym && menu->sym->type != S_UNKNOWN) {
menu_set_type(menu->sym->type); menu_set_type(menu->sym->type);
current_entry = menu; break;
if (menu->sym->type == S_UNKNOWN) }
menu_set_type(sym->type);
break;
} }
} }
/* set the type of the remaining choice values */
for (menu = parent->list; menu; menu = menu->next) {
current_entry = menu;
if (menu->sym && menu->sym->type == S_UNKNOWN)
menu_set_type(sym->type);
}
parentdep = expr_alloc_symbol(sym); parentdep = expr_alloc_symbol(sym);
} else if (parent->prompt) } else if (parent->prompt)
parentdep = parent->prompt->visible.expr; parentdep = parent->prompt->visible.expr;
...@@ -313,50 +317,36 @@ void menu_finalize(struct menu *parent) ...@@ -313,50 +317,36 @@ void menu_finalize(struct menu *parent)
} }
} }
for (menu = parent->list; menu; menu = menu->next) { for (menu = parent->list; menu; menu = menu->next) {
if (sym && sym_is_choice(sym) && menu->sym) { if (sym && sym_is_choice(sym) &&
menu->sym && !sym_is_choice_value(menu->sym)) {
current_entry = menu;
menu->sym->flags |= SYMBOL_CHOICEVAL; menu->sym->flags |= SYMBOL_CHOICEVAL;
if (!menu->prompt) if (!menu->prompt)
menu_warn(menu, "choice value must have a prompt"); menu_warn(menu, "choice value must have a prompt");
for (prop = menu->sym->prop; prop; prop = prop->next) { for (prop = menu->sym->prop; prop; prop = prop->next) {
if (prop->type == P_PROMPT && prop->menu != menu) {
prop_warn(prop, "choice values "
"currently only support a "
"single prompt");
}
if (prop->type == P_DEFAULT) if (prop->type == P_DEFAULT)
prop_warn(prop, "defaults for choice " prop_warn(prop, "defaults for choice "
"values not supported"); "values not supported");
if (prop->menu == menu)
continue;
if (prop->type == P_PROMPT &&
prop->menu->parent->sym != sym)
prop_warn(prop, "choice value used outside its choice group");
} }
current_entry = menu;
if (menu->sym->type == S_UNKNOWN)
menu_set_type(sym->type);
/* Non-tristate choice values of tristate choices must /* Non-tristate choice values of tristate choices must
* depend on the choice being set to Y. The choice * depend on the choice being set to Y. The choice
* values' dependencies were propagated to their * values' dependencies were propagated to their
* properties above, so the change here must be re- * properties above, so the change here must be re-
* propagated. */ * propagated.
*/
if (sym->type == S_TRISTATE && menu->sym->type != S_TRISTATE) { if (sym->type == S_TRISTATE && menu->sym->type != S_TRISTATE) {
basedep = expr_alloc_comp(E_EQUAL, sym, &symbol_yes); basedep = expr_alloc_comp(E_EQUAL, sym, &symbol_yes);
basedep = expr_alloc_and(basedep, menu->dep); menu->dep = expr_alloc_and(basedep, menu->dep);
basedep = expr_eliminate_dups(basedep);
menu->dep = basedep;
for (prop = menu->sym->prop; prop; prop = prop->next) { for (prop = menu->sym->prop; prop; prop = prop->next) {
if (prop->menu != menu) if (prop->menu != menu)
continue; continue;
dep = expr_alloc_and(expr_copy(basedep), prop->visible.expr = expr_alloc_and(expr_copy(basedep),
prop->visible.expr); prop->visible.expr);
dep = expr_eliminate_dups(dep);
dep = expr_trans_bool(dep);
prop->visible.expr = dep;
if (prop->type == P_SELECT) {
struct symbol *es = prop_get_symbol(prop);
dep2 = expr_alloc_symbol(menu->sym);
dep = expr_alloc_and(dep2,
expr_copy(dep));
dep = expr_alloc_or(es->rev_dep.expr, dep);
dep = expr_eliminate_dups(dep);
es->rev_dep.expr = dep;
}
} }
} }
menu_add_symbol(P_CHOICE, sym, NULL); menu_add_symbol(P_CHOICE, sym, NULL);
......
...@@ -40,7 +40,7 @@ void sym_add_default(struct symbol *sym, const char *def) ...@@ -40,7 +40,7 @@ void sym_add_default(struct symbol *sym, const char *def)
{ {
struct property *prop = prop_alloc(P_DEFAULT, sym); struct property *prop = prop_alloc(P_DEFAULT, sym);
prop->expr = expr_alloc_symbol(sym_lookup(def, 1)); prop->expr = expr_alloc_symbol(sym_lookup(def, SYMBOL_CONST));
} }
void sym_init(void) void sym_init(void)
...@@ -350,9 +350,6 @@ void sym_calc_value(struct symbol *sym) ...@@ -350,9 +350,6 @@ void sym_calc_value(struct symbol *sym)
; ;
} }
if (sym->flags & SYMBOL_AUTO)
sym->flags &= ~SYMBOL_WRITE;
sym->curr = newval; sym->curr = newval;
if (sym_is_choice(sym) && newval.tri == yes) if (sym_is_choice(sym) && newval.tri == yes)
sym->curr.val = sym_calc_choice(sym); sym->curr.val = sym_calc_choice(sym);
...@@ -377,6 +374,9 @@ void sym_calc_value(struct symbol *sym) ...@@ -377,6 +374,9 @@ void sym_calc_value(struct symbol *sym)
sym_set_changed(choice_sym); sym_set_changed(choice_sym);
} }
} }
if (sym->flags & SYMBOL_AUTO)
sym->flags &= ~SYMBOL_WRITE;
} }
void sym_clear_all_valid(void) void sym_clear_all_valid(void)
...@@ -651,7 +651,7 @@ bool sym_is_changable(struct symbol *sym) ...@@ -651,7 +651,7 @@ bool sym_is_changable(struct symbol *sym)
return sym->visible > sym->rev_dep.tri; return sym->visible > sym->rev_dep.tri;
} }
struct symbol *sym_lookup(const char *name, int isconst) struct symbol *sym_lookup(const char *name, int flags)
{ {
struct symbol *symbol; struct symbol *symbol;
const char *ptr; const char *ptr;
...@@ -671,11 +671,10 @@ struct symbol *sym_lookup(const char *name, int isconst) ...@@ -671,11 +671,10 @@ struct symbol *sym_lookup(const char *name, int isconst)
hash &= 0xff; hash &= 0xff;
for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) { for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) {
if (!strcmp(symbol->name, name)) { if (!strcmp(symbol->name, name) &&
if ((isconst && symbol->flags & SYMBOL_CONST) || (flags ? symbol->flags & flags
(!isconst && !(symbol->flags & SYMBOL_CONST))) : !(symbol->flags & (SYMBOL_CONST|SYMBOL_CHOICE))))
return symbol; return symbol;
}
} }
new_name = strdup(name); new_name = strdup(name);
} else { } else {
...@@ -687,8 +686,7 @@ struct symbol *sym_lookup(const char *name, int isconst) ...@@ -687,8 +686,7 @@ struct symbol *sym_lookup(const char *name, int isconst)
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;
if (isconst) symbol->flags |= flags;
symbol->flags |= SYMBOL_CONST;
symbol->next = symbol_hash[hash]; symbol->next = symbol_hash[hash];
symbol_hash[hash] = symbol; symbol_hash[hash] = symbol;
...@@ -762,8 +760,6 @@ struct symbol **sym_re_search(const char *pattern) ...@@ -762,8 +760,6 @@ struct symbol **sym_re_search(const char *pattern)
} }
struct symbol *sym_check_deps(struct symbol *sym);
static struct symbol *sym_check_expr_deps(struct expr *e) static struct symbol *sym_check_expr_deps(struct expr *e)
{ {
struct symbol *sym; struct symbol *sym;
...@@ -795,40 +791,100 @@ static struct symbol *sym_check_expr_deps(struct expr *e) ...@@ -795,40 +791,100 @@ static struct symbol *sym_check_expr_deps(struct expr *e)
} }
/* return NULL when dependencies are OK */ /* return NULL when dependencies are OK */
struct symbol *sym_check_deps(struct symbol *sym) static struct symbol *sym_check_sym_deps(struct symbol *sym)
{ {
struct symbol *sym2; struct symbol *sym2;
struct property *prop; struct property *prop;
if (sym->flags & SYMBOL_CHECK) {
fprintf(stderr, "%s:%d:error: found recursive dependency: %s",
sym->prop->file->name, sym->prop->lineno, sym->name);
return sym;
}
if (sym->flags & SYMBOL_CHECKED)
return NULL;
sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
sym2 = sym_check_expr_deps(sym->rev_dep.expr); sym2 = sym_check_expr_deps(sym->rev_dep.expr);
if (sym2) if (sym2)
goto out; return sym2;
for (prop = sym->prop; prop; prop = prop->next) { for (prop = sym->prop; prop; prop = prop->next) {
if (prop->type == P_CHOICE || prop->type == P_SELECT) if (prop->type == P_CHOICE || prop->type == P_SELECT)
continue; continue;
sym2 = sym_check_expr_deps(prop->visible.expr); sym2 = sym_check_expr_deps(prop->visible.expr);
if (sym2) if (sym2)
goto out; break;
if (prop->type != P_DEFAULT || sym_is_choice(sym)) if (prop->type != P_DEFAULT || sym_is_choice(sym))
continue; continue;
sym2 = sym_check_expr_deps(prop->expr); sym2 = sym_check_expr_deps(prop->expr);
if (sym2) if (sym2)
goto out; break;
} }
out:
return sym2;
}
static struct symbol *sym_check_choice_deps(struct symbol *choice)
{
struct symbol *sym, *sym2;
struct property *prop;
struct expr *e;
prop = sym_get_choice_prop(choice);
expr_list_for_each_sym(prop->expr, e, sym)
sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
choice->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
sym2 = sym_check_sym_deps(choice);
choice->flags &= ~SYMBOL_CHECK;
if (sym2) if (sym2)
fprintf(stderr, " -> %s%s", sym->name, sym2 == sym? "\n": ""); goto out;
sym->flags &= ~SYMBOL_CHECK;
expr_list_for_each_sym(prop->expr, e, sym) {
sym2 = sym_check_sym_deps(sym);
if (sym2) {
fprintf(stderr, " -> %s", sym->name);
break;
}
}
out:
expr_list_for_each_sym(prop->expr, e, sym)
sym->flags &= ~SYMBOL_CHECK;
if (sym2 && sym_is_choice_value(sym2) &&
prop_get_symbol(sym_get_choice_prop(sym2)) == choice)
sym2 = choice;
return sym2;
}
struct symbol *sym_check_deps(struct symbol *sym)
{
struct symbol *sym2;
struct property *prop;
if (sym->flags & SYMBOL_CHECK) {
fprintf(stderr, "%s:%d:error: found recursive dependency: %s",
sym->prop->file->name, sym->prop->lineno,
sym->name ? sym->name : "<choice>");
return sym;
}
if (sym->flags & SYMBOL_CHECKED)
return NULL;
if (sym_is_choice_value(sym)) {
/* for choice groups start the check with main choice symbol */
prop = sym_get_choice_prop(sym);
sym2 = sym_check_deps(prop_get_symbol(prop));
} else if (sym_is_choice(sym)) {
sym2 = sym_check_choice_deps(sym);
} else {
sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
sym2 = sym_check_sym_deps(sym);
sym->flags &= ~SYMBOL_CHECK;
}
if (sym2) {
fprintf(stderr, " -> %s", sym->name ? sym->name : "<choice>");
if (sym2 == sym) {
fprintf(stderr, "\n");
zconfnerrs++;
sym2 = NULL;
}
}
return sym2; return sym2;
} }
...@@ -904,7 +960,7 @@ void prop_add_env(const char *env) ...@@ -904,7 +960,7 @@ void prop_add_env(const char *env)
} }
prop = prop_alloc(P_ENV, sym); prop = prop_alloc(P_ENV, sym);
prop->expr = expr_alloc_symbol(sym_lookup(env, 1)); prop->expr = expr_alloc_symbol(sym_lookup(env, SYMBOL_CONST));
sym_env_list = expr_alloc_one(E_LIST, sym_env_list); sym_env_list = expr_alloc_one(E_LIST, sym_env_list);
sym_env_list->right.sym = sym; sym_env_list->right.sym = sym;
......
此差异已折叠。
...@@ -91,7 +91,7 @@ static struct menu *current_menu, *current_entry; ...@@ -91,7 +91,7 @@ static struct menu *current_menu, *current_entry;
%type <id> end %type <id> end
%type <id> option_name %type <id> option_name
%type <menu> if_entry menu_entry choice_entry %type <menu> if_entry menu_entry choice_entry
%type <string> symbol_option_arg %type <string> symbol_option_arg word_opt
%destructor { %destructor {
fprintf(stderr, "%s:%d: missing end statement for this entry\n", fprintf(stderr, "%s:%d: missing end statement for this entry\n",
...@@ -239,10 +239,10 @@ symbol_option_arg: ...@@ -239,10 +239,10 @@ symbol_option_arg:
/* choice entry */ /* choice entry */
choice: T_CHOICE T_EOL choice: T_CHOICE word_opt T_EOL
{ {
struct symbol *sym = sym_lookup(NULL, 0); struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE);
sym->flags |= SYMBOL_CHOICE; sym->flags |= SYMBOL_AUTO;
menu_add_entry(sym); menu_add_entry(sym);
menu_add_expr(P_CHOICE, NULL, NULL); menu_add_expr(P_CHOICE, NULL, NULL);
printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
...@@ -456,9 +456,12 @@ expr: symbol { $$ = expr_alloc_symbol($1); } ...@@ -456,9 +456,12 @@ expr: symbol { $$ = expr_alloc_symbol($1); }
; ;
symbol: T_WORD { $$ = sym_lookup($1, 0); free($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) void conf_parse(const char *name)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册