diff options
Diffstat (limited to 'adk')
-rw-r--r-- | adk/config/Makefile | 4 | ||||
-rw-r--r-- | adk/config/expr.h | 9 | ||||
-rw-r--r-- | adk/config/kconfig-language.txt (renamed from adk/config/Kconfig-language.txt) | 7 | ||||
-rw-r--r-- | adk/config/lex.zconf.c_shipped | 137 | ||||
-rw-r--r-- | adk/config/lkc.h | 1 | ||||
-rw-r--r-- | adk/config/menu.c | 70 | ||||
-rw-r--r-- | adk/config/symbol.c | 88 | ||||
-rw-r--r-- | adk/config/zconf.hash.c_shipped | 303 | ||||
-rw-r--r-- | adk/config/zconf.tab.c_shipped | 543 | ||||
-rw-r--r-- | adk/config/zconf.tab.h_shipped | 107 | ||||
-rw-r--r-- | adk/config/zconf.y | 17 |
11 files changed, 806 insertions, 480 deletions
diff --git a/adk/config/Makefile b/adk/config/Makefile index 7e91da1bf..b6c253f18 100644 --- a/adk/config/Makefile +++ b/adk/config/Makefile @@ -78,7 +78,7 @@ lkc_defs.h: lkc_proto.h # The following requires flex/bison # By default we use the _shipped versions, uncomment the # following line if you are modifying the flex/bison src. -#LKC_GENPARSER:= 1 +# LKC_GENPARSER:= 1 ifdef LKC_GENPARSER @@ -86,7 +86,7 @@ ifdef LKC_GENPARSER bison -t -d -v -b $* -p $(notdir $*) $< %.hash.c: %.gperf - gperf < $< > $@ + gperf -t --output-file zconf.hash.c -a -C -E -g -k '1,3,$$' -p -t zconf.gperf lex.%.c: %.l flex -P$(notdir $*) -o$@ $< diff --git a/adk/config/expr.h b/adk/config/expr.h index 412ea8a2a..94d891937 100644 --- a/adk/config/expr.h +++ b/adk/config/expr.h @@ -54,6 +54,13 @@ struct expr_value { tristate tri; }; +struct expr_select_value { + struct expr *expr; + tristate tri; + struct expr *value; + struct expr_select_value *next; +}; + struct symbol_value { void *val; tristate tri; @@ -83,6 +90,7 @@ struct symbol { struct property *prop; struct expr_value dir_dep; struct expr_value rev_dep; + struct expr_select_value *val_dep; }; #define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER) @@ -151,6 +159,7 @@ struct property { * P_PROMPT, P_DEFAULT, P_MENU, P_COMMENT */ struct file *file; /* what file was this property defined */ int lineno; /* what lineno was this property defined */ + struct expr *value; /* the optional P_SELECT value */ }; #define for_all_properties(sym, st, tok) \ diff --git a/adk/config/Kconfig-language.txt b/adk/config/kconfig-language.txt index c412c2458..68ec5d1f9 100644 --- a/adk/config/Kconfig-language.txt +++ b/adk/config/kconfig-language.txt @@ -95,14 +95,15 @@ applicable everywhere (see syntax). bool "foo" default y -- reverse dependencies: "select" <symbol> ["if" <expr>] +- reverse dependencies: "select" <symbol> [<expr>] ["if" <expr>] While normal dependencies reduce the upper limit of a symbol (see below), reverse dependencies can be used to force a lower limit of another symbol. The value of the current menu symbol is used as the minimal value <symbol> can be set to. If <symbol> is selected multiple times, the limit is set to the largest selection. - Reverse dependencies can only be used with boolean or tristate - symbols. + Reverse dependencies without the optional <expr> can only be used with + boolean or tristate symbols. If the optional <expr> is supplied, + the <symbol> will be set to that value if possible. Note: select should be used with care. select will force a symbol to a value without visiting the dependencies. diff --git a/adk/config/lex.zconf.c_shipped b/adk/config/lex.zconf.c_shipped index dc3e81807..069e44b77 100644 --- a/adk/config/lex.zconf.c_shipped +++ b/adk/config/lex.zconf.c_shipped @@ -1,5 +1,6 @@ +#line 2 "lex.zconf.c" -#line 3 "scripts/kconfig/lex.zconf.c" +#line 4 "lex.zconf.c" #define YY_INT_ALIGNED short int @@ -160,7 +161,15 @@ typedef unsigned int flex_uint32_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -764,8 +773,10 @@ int zconf_flex_debug = 0; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *zconftext; +#line 1 "zconf.l" #define YY_NO_INPUT 1 +#line 6 "zconf.l" /* * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> * Released under the terms of the GNU GPL v2.0. @@ -777,7 +788,6 @@ char *zconftext; #include <string.h> #include <unistd.h> -#define LKC_DIRECT_LINK #include "lkc.h" #define START_STRSIZE 16 @@ -791,8 +801,8 @@ static char *text; static int text_size, text_asize; struct buffer { - struct buffer *parent; - YY_BUFFER_STATE state; + struct buffer *parent; + YY_BUFFER_STATE state; }; struct buffer *current_buf; @@ -802,15 +812,15 @@ static int last_ts, first_ts; static void zconf_endhelp(void); static void zconf_endfile(void); -void new_string(void) +static void new_string(void) { - text = malloc(START_STRSIZE); + text = xmalloc(START_STRSIZE); text_asize = START_STRSIZE; text_size = 0; *text = 0; } -void append_string(const char *str, int size) +static void append_string(const char *str, int size) { int new_size = text_size + size + 1; if (new_size > text_asize) { @@ -824,12 +834,13 @@ void append_string(const char *str, int size) text[text_size] = 0; } -void alloc_string(const char *str, int size) +static void alloc_string(const char *str, int size) { - text = malloc(size + 1); + text = xmalloc(size + 1); memcpy(text, str, size); text[size] = 0; } +#line 844 "lex.zconf.c" #define INITIAL 0 #define COMMAND 1 @@ -914,7 +925,12 @@ static int input (void ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -922,7 +938,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( zconftext, zconfleng, 1, zconfout ) +#define ECHO do { if (fwrite( zconftext, zconfleng, 1, zconfout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -999,9 +1015,13 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; +#line 73 "zconf.l" + int str = 0; int ts, i; +#line 1024 "lex.zconf.c" + if ( !(yy_init) ) { (yy_init) = 1; @@ -1058,9 +1078,11 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: /* rule 1 can match eol */ +#line 78 "zconf.l" case 2: /* rule 2 can match eol */ YY_RULE_SETUP +#line 78 "zconf.l" { current_file->lineno++; return T_EOL; @@ -1068,16 +1090,19 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP +#line 82 "zconf.l" YY_BREAK case 4: YY_RULE_SETUP +#line 85 "zconf.l" { BEGIN(COMMAND); } YY_BREAK case 5: YY_RULE_SETUP +#line 89 "zconf.l" { unput(zconftext[0]); BEGIN(COMMAND); @@ -1086,8 +1111,9 @@ YY_RULE_SETUP case 6: YY_RULE_SETUP +#line 96 "zconf.l" { - struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); + const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); BEGIN(PARAM); current_pos.file = current_file; current_pos.lineno = current_file->lineno; @@ -1102,11 +1128,13 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP +#line 109 "zconf.l" YY_BREAK case 8: /* rule 8 can match eol */ YY_RULE_SETUP +#line 110 "zconf.l" { BEGIN(INITIAL); current_file->lineno++; @@ -1114,36 +1142,45 @@ YY_RULE_SETUP } YY_BREAK + case 9: YY_RULE_SETUP +#line 118 "zconf.l" return T_AND; YY_BREAK case 10: YY_RULE_SETUP +#line 119 "zconf.l" return T_OR; YY_BREAK case 11: YY_RULE_SETUP +#line 120 "zconf.l" return T_OPEN_PAREN; YY_BREAK case 12: YY_RULE_SETUP +#line 121 "zconf.l" return T_CLOSE_PAREN; YY_BREAK case 13: YY_RULE_SETUP +#line 122 "zconf.l" return T_NOT; YY_BREAK case 14: YY_RULE_SETUP +#line 123 "zconf.l" return T_EQUAL; YY_BREAK case 15: YY_RULE_SETUP +#line 124 "zconf.l" return T_UNEQUAL; YY_BREAK case 16: YY_RULE_SETUP +#line 125 "zconf.l" { str = zconftext[0]; new_string(); @@ -1153,16 +1190,19 @@ YY_RULE_SETUP case 17: /* rule 17 can match eol */ YY_RULE_SETUP +#line 130 "zconf.l" BEGIN(INITIAL); current_file->lineno++; return T_EOL; YY_BREAK case 18: YY_RULE_SETUP +#line 131 "zconf.l" /* ignore */ YY_BREAK case 19: YY_RULE_SETUP +#line 132 "zconf.l" { - struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); + const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); if (id && id->flags & TF_PARAM) { zconflval.id = id; return id->token; @@ -1174,29 +1214,35 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP +#line 142 "zconf.l" /* comment */ YY_BREAK case 21: /* rule 21 can match eol */ YY_RULE_SETUP +#line 143 "zconf.l" current_file->lineno++; YY_BREAK case 22: YY_RULE_SETUP +#line 144 "zconf.l" YY_BREAK case YY_STATE_EOF(PARAM): +#line 145 "zconf.l" { BEGIN(INITIAL); } YY_BREAK + case 23: /* rule 23 can match eol */ *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up zconftext again */ YY_RULE_SETUP +#line 151 "zconf.l" { append_string(zconftext, zconfleng); zconflval.string = text; @@ -1205,6 +1251,7 @@ YY_RULE_SETUP YY_BREAK case 24: YY_RULE_SETUP +#line 156 "zconf.l" { append_string(zconftext, zconfleng); } @@ -1215,6 +1262,7 @@ case 25: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up zconftext again */ YY_RULE_SETUP +#line 159 "zconf.l" { append_string(zconftext + 1, zconfleng - 1); zconflval.string = text; @@ -1223,12 +1271,14 @@ YY_RULE_SETUP YY_BREAK case 26: YY_RULE_SETUP +#line 164 "zconf.l" { append_string(zconftext + 1, zconfleng - 1); } YY_BREAK case 27: YY_RULE_SETUP +#line 167 "zconf.l" { if (str == zconftext[0]) { BEGIN(PARAM); @@ -1241,6 +1291,7 @@ YY_RULE_SETUP case 28: /* rule 28 can match eol */ YY_RULE_SETUP +#line 175 "zconf.l" { printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); current_file->lineno++; @@ -1249,13 +1300,16 @@ YY_RULE_SETUP } YY_BREAK case YY_STATE_EOF(STRING): +#line 181 "zconf.l" { BEGIN(INITIAL); } YY_BREAK + case 29: YY_RULE_SETUP +#line 187 "zconf.l" { ts = 0; for (i = 0; i < zconfleng; i++) { @@ -1285,6 +1339,7 @@ case 30: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up zconftext again */ YY_RULE_SETUP +#line 209 "zconf.l" { current_file->lineno++; zconf_endhelp(); @@ -1294,6 +1349,7 @@ YY_RULE_SETUP case 31: /* rule 31 can match eol */ YY_RULE_SETUP +#line 214 "zconf.l" { current_file->lineno++; append_string("\n", 1); @@ -1301,6 +1357,7 @@ YY_RULE_SETUP YY_BREAK case 32: YY_RULE_SETUP +#line 218 "zconf.l" { while (zconfleng) { if ((zconftext[zconfleng-1] != ' ') && (zconftext[zconfleng-1] != '\t')) @@ -1313,6 +1370,7 @@ YY_RULE_SETUP } YY_BREAK case YY_STATE_EOF(HELP): +#line 228 "zconf.l" { zconf_endhelp(); return T_HELPTEXT; @@ -1321,6 +1379,7 @@ case YY_STATE_EOF(HELP): case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(COMMAND): +#line 234 "zconf.l" { if (current_file) { zconf_endfile(); @@ -1332,8 +1391,10 @@ case YY_STATE_EOF(COMMAND): YY_BREAK case 33: YY_RULE_SETUP +#line 243 "zconf.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK +#line 1398 "lex.zconf.c" case YY_END_OF_BUFFER: { @@ -2060,8 +2121,8 @@ YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr ) /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ @@ -2300,6 +2361,9 @@ void zconffree (void * ptr ) #define YYTABLES_NAME "yytables" +#line 243 "zconf.l" + + void zconf_starthelp(void) { new_string(); @@ -2313,6 +2377,7 @@ static void zconf_endhelp(void) BEGIN(INITIAL); } + /* * Try to open specified file with following names: * ./name @@ -2345,42 +2410,50 @@ void zconf_initscan(const char *name) exit(1); } - current_buf = malloc(sizeof(*current_buf)); + current_buf = xmalloc(sizeof(*current_buf)); memset(current_buf, 0, sizeof(*current_buf)); current_file = file_lookup(name); current_file->lineno = 1; - current_file->flags = FILE_BUSY; } void zconf_nextfile(const char *name) { + struct file *iter; struct file *file = file_lookup(name); - struct buffer *buf = malloc(sizeof(*buf)); + struct buffer *buf = xmalloc(sizeof(*buf)); memset(buf, 0, sizeof(*buf)); current_buf->state = YY_CURRENT_BUFFER; - zconfin = zconf_fopen(name); + zconfin = zconf_fopen(file->name); if (!zconfin) { - printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name); + printf("%s:%d: can't open file \"%s\"\n", + zconf_curname(), zconf_lineno(), file->name); exit(1); } zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE)); buf->parent = current_buf; current_buf = buf; - if (file->flags & FILE_BUSY) { - printf("%s:%d: do not source '%s' from itself\n", - zconf_curname(), zconf_lineno(), name); - exit(1); - } - if (file->flags & FILE_SCANNED) { - printf("%s:%d: file '%s' is already sourced from '%s'\n", - zconf_curname(), zconf_lineno(), name, - file->parent->name); - exit(1); + for (iter = current_file->parent; iter; iter = iter->parent ) { + if (!strcmp(current_file->name,iter->name) ) { + printf("%s:%d: recursive inclusion detected. " + "Inclusion path:\n current file : '%s'\n", + zconf_curname(), zconf_lineno(), + zconf_curname()); + iter = current_file->parent; + while (iter && \ + strcmp(iter->name,current_file->name)) { + printf(" included from: '%s:%d'\n", + iter->name, iter->lineno-1); + iter = iter->parent; + } + if (iter) + printf(" included from: '%s:%d'\n", + iter->name, iter->lineno+1); + exit(1); + } } - file->flags |= FILE_BUSY; file->lineno = 1; file->parent = current_file; current_file = file; @@ -2390,8 +2463,6 @@ static void zconf_endfile(void) { struct buffer *parent; - current_file->flags |= FILE_SCANNED; - current_file->flags &= ~FILE_BUSY; current_file = current_file->parent; parent = current_buf->parent; @@ -2409,7 +2480,7 @@ int zconf_lineno(void) return current_pos.lineno; } -char *zconf_curname(void) +const char *zconf_curname(void) { return current_pos.file ? current_pos.file->name : "<none>"; } diff --git a/adk/config/lkc.h b/adk/config/lkc.h index 3af99579b..f53f5d446 100644 --- a/adk/config/lkc.h +++ b/adk/config/lkc.h @@ -117,6 +117,7 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); +void menu_add_select(struct symbol *sym, struct expr *value, struct expr *dep); void menu_add_option(int token, char *arg); void menu_finalize(struct menu *parent); void menu_set_type(int type); diff --git a/adk/config/menu.c b/adk/config/menu.c index a26cc5d2a..cd3a75451 100644 --- a/adk/config/menu.c +++ b/adk/config/menu.c @@ -196,6 +196,14 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep) menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep); } +void menu_add_select(struct symbol *sym, struct expr *value, struct expr *dep) +{ + struct property *p; + + p = menu_add_prop(P_SELECT, NULL, expr_alloc_symbol(sym), dep); + p->value = value; +} + void menu_add_option(int token, char *arg) { switch (token) { @@ -257,13 +265,22 @@ static void sym_check_prop(struct symbol *sym) prop_warn(prop, "config symbol '%s' uses select, but is " "not boolean or tristate", sym->name); - else if (sym2->type != S_UNKNOWN && + else if (prop->value == NULL && + sym2->type != S_UNKNOWN && sym2->type != S_BOOLEAN && sym2->type != S_TRISTATE) prop_warn(prop, - "'%s' has wrong type. 'select' only " - "accept arguments of boolean and " - "tristate type", sym2->name); + "'%s' has wrong type. 'select' without a " + "value only accepts arguments of boolean " + "and tristate type", sym2->name); + else if (prop->value != NULL && + (sym2->type == S_INT || + sym2->type == S_HEX || + sym2->type == S_STRING) && + prop->value->type != E_SYMBOL) + prop_warn(prop, + "select value for config symbol '%s'" + " must be a single symbol", sym2->name); break; case P_RANGE: if (sym->type != S_INT && sym->type != S_HEX) @@ -279,6 +296,25 @@ static void sym_check_prop(struct symbol *sym) } } +static void finalize_select(struct symbol *sym, struct property *prop, + struct expr *dep) +{ + struct symbol *es = prop_get_symbol(prop); + struct expr_select_value *esv; + + if (prop->value) { + esv = malloc(sizeof *esv); + esv->expr = expr_alloc_and(expr_alloc_symbol(sym), + expr_copy(dep)); + esv->value = prop->value; + esv->next = es->val_dep; + es->val_dep = esv; + } else { + es->rev_dep.expr = expr_alloc_or(es->rev_dep.expr, + expr_alloc_and(expr_alloc_symbol(sym), expr_copy(dep))); + } +} + void menu_finalize(struct menu *parent) { struct menu *menu, *last_menu; @@ -329,11 +365,8 @@ void menu_finalize(struct menu *parent) if (menu->sym && menu->sym->type != S_TRISTATE) dep = expr_trans_bool(dep); prop->visible.expr = dep; - if (prop->type == P_SELECT) { - struct symbol *es = prop_get_symbol(prop); - es->rev_dep.expr = expr_alloc_or(es->rev_dep.expr, - expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep))); - } + if (prop->type == P_SELECT) + finalize_select(menu->sym, prop, dep); } } for (menu = parent->list; menu; menu = menu->next) @@ -437,9 +470,15 @@ void menu_finalize(struct menu *parent) } if (sym && !sym_is_optional(sym) && parent->prompt) { + struct expr_select_value *esv; + sym->rev_dep.expr = expr_alloc_or(sym->rev_dep.expr, expr_alloc_and(parent->prompt->visible.expr, expr_alloc_symbol(&symbol_mod))); + for (esv = sym->val_dep; esv; esv = esv->next) + esv->expr = expr_alloc_or(esv->expr, + expr_alloc_and(parent->prompt->visible.expr, + expr_alloc_symbol(&symbol_mod))); } } @@ -620,6 +659,7 @@ void get_symbol_str(struct gstr *r, struct symbol *sym, { bool hit; struct property *prop; + struct expr_select_value *esv; if (sym && sym->name) { str_printf(r, "Symbol: %s [=%s]\n", sym->name, @@ -656,6 +696,11 @@ void get_symbol_str(struct gstr *r, struct symbol *sym, } else str_printf(r, " && "); expr_gstr_print(prop->expr, r); + if (prop->value) { + str_printf(r, " (value="); + expr_gstr_print(prop->value, r); + str_printf(r, ")"); + } } if (hit) str_append(r, "\n"); @@ -664,6 +709,13 @@ void get_symbol_str(struct gstr *r, struct symbol *sym, expr_gstr_print(sym->rev_dep.expr, r); str_append(r, "\n"); } + for (esv = sym->val_dep; esv; esv = esv->next) { + str_append(r, " Selected by: "); + expr_gstr_print(esv->expr, r); + str_append(r, " with value: "); + expr_gstr_print(esv->value, r); + str_append(r, "\n"); + } str_append(r, "\n\n"); } diff --git a/adk/config/symbol.c b/adk/config/symbol.c index af1deb2be..27f8117d4 100644 --- a/adk/config/symbol.c +++ b/adk/config/symbol.c @@ -190,6 +190,7 @@ static void sym_calc_visibility(struct symbol *sym) { struct property *prop; tristate tri; + struct expr_select_value *esv; /* any prompt visible? */ tri = no; @@ -222,6 +223,15 @@ static void sym_calc_visibility(struct symbol *sym) sym->rev_dep.tri = tri; sym_set_changed(sym); } + for (esv = sym->val_dep; esv; esv = esv->next) { + tri = expr_calc_value(esv->expr); + if (tri == mod && sym_get_type(sym) == S_BOOLEAN) + tri = yes; + if (esv->tri != tri) { + esv->tri = tri; + sym_set_changed(sym); + } + } } /* @@ -307,6 +317,8 @@ void sym_calc_value(struct symbol *sym) struct symbol_value newval, oldval; struct property *prop; struct expr *e; + struct expr_select_value *esv; + int got_sel_val; if (!sym) return; @@ -368,6 +380,9 @@ void sym_calc_value(struct symbol *sym) } if (sym->rev_dep.tri != no) sym->flags |= SYMBOL_WRITE; + for (esv = sym->val_dep; esv; esv = esv->next) + if (esv->tri != no) + sym->flags |= SYMBOL_WRITE; if (!sym_is_choice(sym)) { prop = sym_get_default_prop(sym); if (prop) { @@ -377,19 +392,34 @@ void sym_calc_value(struct symbol *sym) } } calc_newval: - if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) { - struct expr *e; - e = expr_simplify_unmet_dep(sym->rev_dep.expr, - sym->dir_dep.expr); - fprintf(stderr, "warning: ("); - expr_fprint(e, stderr); - fprintf(stderr, ") selects %s which has unmet direct dependencies (", - sym->name); - expr_fprint(sym->dir_dep.expr, stderr); - fprintf(stderr, ")\n"); - expr_free(e); + if (sym->dir_dep.tri == no) { + if (sym->rev_dep.tri != no) { + fprintf(stderr, "warning: ("); + expr_fprint(sym->rev_dep.expr, stderr); + fprintf(stderr, ") selects %s which has unmet direct dependencies (", + sym->name); + expr_fprint(sym->dir_dep.expr, stderr); + fprintf(stderr, ")\n"); + } + for (esv = sym->val_dep; esv; esv = esv->next) { + if ((esv->tri != no) && + (expr_calc_value(esv->value) != no)) { + fprintf(stderr, "warning: ("); + expr_fprint(esv->expr, stderr); + fprintf(stderr, ") selects %s (with value ", + sym->name); + expr_fprint(esv->value, stderr); + fprintf(stderr, ") which has unmet direct dependencies ("); + expr_fprint(sym->dir_dep.expr, stderr); + fprintf(stderr, ")\n"); + } + } } - newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri); + newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri); + for (esv = sym->val_dep; esv; esv = esv->next) + if (esv->tri != no) + newval.tri = EXPR_OR(newval.tri, + expr_calc_value(esv->value)); } if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN) newval.tri = yes; @@ -404,6 +434,23 @@ void sym_calc_value(struct symbol *sym) break; } } + got_sel_val = 0; + for (esv = sym->val_dep; esv; esv = esv->next) { + if (esv->tri != no) { + struct symbol *ss = esv->value->left.sym; + + if (got_sel_val) { + /* warn of more than one value selected */ + } else { + sym->flags |= SYMBOL_WRITE; + sym_calc_value(ss); + newval.val = ss->curr.val; + got_sel_val = 1; + } + } + } + if (got_sel_val) + break; prop = sym_get_default_prop(sym); if (prop) { struct symbol *ds = prop_get_symbol(prop); @@ -486,6 +533,8 @@ void sym_set_all_changed(void) bool sym_tristate_within_range(struct symbol *sym, tristate val) { int type = sym_get_type(sym); + struct expr_select_value *esv; + tristate tri; if (sym->visible == no) return false; @@ -495,11 +544,14 @@ bool sym_tristate_within_range(struct symbol *sym, tristate val) if (type == S_BOOLEAN && val == mod) return false; - if (sym->visible <= sym->rev_dep.tri) + tri = sym->rev_dep.tri; + for (esv = sym->val_dep; esv; esv = esv->next) + tri = EXPR_OR(tri, esv->tri); + if (sym->visible <= tri) return false; if (sym_is_choice_value(sym) && sym->visible == yes) return val == yes; - return val >= sym->rev_dep.tri && val <= sym->visible; + return val >= tri && val <= sym->visible; } bool sym_set_tristate_value(struct symbol *sym, tristate val) @@ -795,7 +847,13 @@ const char *sym_get_string_value(struct symbol *sym) bool sym_is_changable(struct symbol *sym) { - return sym->visible > sym->rev_dep.tri; + tristate tri = sym->rev_dep.tri; + struct expr_select_value *esv; + + for (esv = sym->val_dep; esv; esv = esv->next) + tri = EXPR_OR(tri, esv->tri); + + return sym->visible > tri; } static unsigned strhash(const char *s) diff --git a/adk/config/zconf.hash.c_shipped b/adk/config/zconf.hash.c_shipped index c77a8eff1..5f3e06f16 100644 --- a/adk/config/zconf.hash.c_shipped +++ b/adk/config/zconf.hash.c_shipped @@ -1,5 +1,5 @@ -/* ANSI-C code produced by gperf version 3.0.4 */ -/* Command-line: gperf -t --output-file scripts/kconfig/zconf.hash.c_shipped -a -C -E -g -k '1,3,$' -p -t scripts/kconfig/zconf.gperf */ +/* ANSI-C code produced by gperf version 3.0.3 */ +/* Command-line: gperf -t --output-file zconf.hash.c -a -C -E -g -k 1,3, -p -t zconf.gperf */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ @@ -28,11 +28,11 @@ #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." #endif -#line 10 "scripts/kconfig/zconf.gperf" +#line 10 "zconf.gperf" struct kconf_id; static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); -/* maximum key range = 71, duplicates = 0 */ +/* maximum key range = 50, duplicates = 0 */ #ifdef __GNUC__ __inline @@ -46,32 +46,32 @@ kconf_id_hash (register const char *str, register unsigned int len) { static const unsigned char asso_values[] = { - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 5, 25, 25, - 0, 0, 0, 5, 0, 0, 73, 73, 5, 0, - 10, 5, 45, 73, 20, 20, 0, 15, 15, 73, - 20, 5, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 10, 40, 5, + 0, 0, 5, 52, 0, 20, 52, 52, 10, 20, + 5, 0, 35, 52, 0, 30, 0, 15, 0, 52, + 15, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52 }; register int hval = len; @@ -85,85 +85,85 @@ kconf_id_hash (register const char *str, register unsigned int len) hval += asso_values[(unsigned char)str[0]]; break; } - return hval + asso_values[(unsigned char)str[len - 1]]; + return hval; } struct kconf_id_strings_t { - char kconf_id_strings_str2[sizeof("if")]; - char kconf_id_strings_str3[sizeof("int")]; + char kconf_id_strings_str2[sizeof("on")]; + char kconf_id_strings_str3[sizeof("env")]; char kconf_id_strings_str5[sizeof("endif")]; - char kconf_id_strings_str7[sizeof("default")]; - char kconf_id_strings_str8[sizeof("tristate")]; + char kconf_id_strings_str6[sizeof("option")]; + char kconf_id_strings_str7[sizeof("endmenu")]; + char kconf_id_strings_str8[sizeof("optional")]; char kconf_id_strings_str9[sizeof("endchoice")]; - char kconf_id_strings_str12[sizeof("def_tristate")]; + char kconf_id_strings_str10[sizeof("range")]; + char kconf_id_strings_str11[sizeof("choice")]; + char kconf_id_strings_str12[sizeof("default")]; char kconf_id_strings_str13[sizeof("def_bool")]; - char kconf_id_strings_str14[sizeof("defconfig_list")]; - char kconf_id_strings_str17[sizeof("on")]; - char kconf_id_strings_str18[sizeof("optional")]; - char kconf_id_strings_str21[sizeof("option")]; - char kconf_id_strings_str22[sizeof("endmenu")]; - char kconf_id_strings_str23[sizeof("mainmenu")]; - char kconf_id_strings_str25[sizeof("menuconfig")]; + char kconf_id_strings_str14[sizeof("help")]; + char kconf_id_strings_str16[sizeof("config")]; + char kconf_id_strings_str17[sizeof("def_tristate")]; + char kconf_id_strings_str18[sizeof("hex")]; + char kconf_id_strings_str19[sizeof("defconfig_list")]; + char kconf_id_strings_str22[sizeof("if")]; + char kconf_id_strings_str23[sizeof("int")]; char kconf_id_strings_str27[sizeof("modules")]; - char kconf_id_strings_str28[sizeof("allnoconfig_y")]; + char kconf_id_strings_str28[sizeof("tristate")]; char kconf_id_strings_str29[sizeof("menu")]; - char kconf_id_strings_str31[sizeof("select")]; char kconf_id_strings_str32[sizeof("comment")]; - char kconf_id_strings_str33[sizeof("env")]; - char kconf_id_strings_str35[sizeof("range")]; - char kconf_id_strings_str36[sizeof("choice")]; - char kconf_id_strings_str39[sizeof("bool")]; - char kconf_id_strings_str41[sizeof("source")]; - char kconf_id_strings_str42[sizeof("visible")]; - char kconf_id_strings_str43[sizeof("hex")]; - char kconf_id_strings_str46[sizeof("config")]; + char kconf_id_strings_str33[sizeof("allnoconfig_y")]; + char kconf_id_strings_str35[sizeof("menuconfig")]; + char kconf_id_strings_str36[sizeof("string")]; + char kconf_id_strings_str37[sizeof("visible")]; + char kconf_id_strings_str41[sizeof("prompt")]; + char kconf_id_strings_str42[sizeof("depends")]; + char kconf_id_strings_str44[sizeof("bool")]; + char kconf_id_strings_str46[sizeof("select")]; char kconf_id_strings_str47[sizeof("boolean")]; - char kconf_id_strings_str51[sizeof("string")]; - char kconf_id_strings_str54[sizeof("help")]; - char kconf_id_strings_str56[sizeof("prompt")]; - char kconf_id_str |