From: Linus Torvalds Date: Mon, 10 Jan 2011 16:28:17 +0000 (-0800) Subject: Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6 X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=f28b1c8aaa97a68028bb894bffb1690185c62b01;hp=-c;p=deliverable%2Flinux.git Merge branch 'kconfig' of git://git./linux/kernel/git/mmarek/kbuild-2.6 * 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6: nconf: handle comment entries within choice/endchoice kconfig: fix warning kconfig: Make expr_copy() take a const argument kconfig: simplify select-with-unmet-direct-dependency warning kconfig: add more S_INT and S_HEX consistency checks kconfig: fix `zconfdebug' extern declaration kconfig/conf: merge duplicate switch's case kconfig: fix typos kbuild/gconf: add dummy inline for bind_textdomain_codeset() kbuild/nconf: fix spaces damage kconfig: nuke second argument of conf_write_symbol() kconfig: do not define AUTOCONF_INCLUDED kconfig: the day kconfig warns about "select"-abuse has come --- f28b1c8aaa97a68028bb894bffb1690185c62b01 diff --combined scripts/kconfig/expr.h index e57826ced380,79ab6e746f53..3d238db49764 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@@ -164,7 -164,6 +164,7 @@@ struct menu struct menu *list; struct symbol *sym; struct property *prompt; + struct expr *visibility; struct expr *dep; unsigned int flags; char *help; @@@ -192,7 -191,7 +192,7 @@@ struct expr *expr_alloc_two(enum expr_t struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2); struct expr *expr_alloc_and(struct expr *e1, struct expr *e2); struct expr *expr_alloc_or(struct expr *e1, struct expr *e2); - struct expr *expr_copy(struct expr *org); + struct expr *expr_copy(const struct expr *org); void expr_free(struct expr *e); int expr_eq(struct expr *e1, struct expr *e2); void expr_eliminate_eq(struct expr **ep1, struct expr **ep2); @@@ -207,6 -206,7 +207,7 @@@ struct expr *expr_extract_eq_and(struc struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2); void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2); struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym); + struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2); void expr_fprint(struct expr *e, FILE *out); struct gstr; /* forward */ diff --combined scripts/kconfig/lkc.h index 3f7240df0f3b,6d38b7c9c824..febf0c94d558 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@@ -14,6 -14,7 +14,7 @@@ static inline const char *gettext(const char *txt) { return txt; } static inline void textdomain(const char *domainname) {} static inline void bindtextdomain(const char *name, const char *dir) {} + static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c; } #endif #ifdef __cplusplus @@@ -67,10 -68,12 +68,12 @@@ struct kconf_id enum symbol_type stype; }; + #ifdef YYDEBUG + extern int zconfdebug; + #endif + int zconfparse(void); void zconfdump(FILE *out); - - extern int zconfdebug; void zconf_starthelp(void); FILE *zconf_fopen(const char *name); void zconf_initscan(const char *name); @@@ -107,7 -110,6 +110,7 @@@ void menu_end_menu(void) void menu_add_entry(struct symbol *sym); void menu_end_entry(void); void menu_add_dep(struct expr *dep); +void menu_add_visibility(struct expr *dep); struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep); 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); diff --combined scripts/kconfig/menu.c index 5f77dcb8977e,8a8bc9be7831..5fdf10dc1d8a --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@@ -140,20 -140,6 +140,20 @@@ struct property *menu_add_prop(enum pro } if (current_entry->prompt && current_entry != &rootmenu) prop_warn(prop, "prompt redefined"); + + /* Apply all upper menus' visibilities to actual prompts. */ + if(type == P_PROMPT) { + struct menu *menu = current_entry; + + while ((menu = menu->parent) != NULL) { + if (!menu->visibility) + continue; + prop->visible.expr + = expr_alloc_and(prop->visible.expr, + menu->visibility); + } + } + current_entry->prompt = prop; } prop->text = prompt; @@@ -166,12 -152,6 +166,12 @@@ struct property *menu_add_prompt(enum p return menu_add_prop(type, prompt, NULL, dep); } +void menu_add_visibility(struct expr *expr) +{ + current_entry->visibility = expr_alloc_and(current_entry->visibility, + expr); +} + void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep) { menu_add_prop(type, NULL, expr, dep); @@@ -203,7 -183,7 +203,7 @@@ void menu_add_option(int token, char *a } } - static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2) + static int menu_validate_number(struct symbol *sym, struct symbol *sym2) { return sym2->type == S_INT || sym2->type == S_HEX || (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); @@@ -221,6 -201,15 +221,15 @@@ static void sym_check_prop(struct symbo prop_warn(prop, "default for config symbol '%s'" " must be a single symbol", sym->name); + if (prop->expr->type != E_SYMBOL) + break; + sym2 = prop_get_symbol(prop); + if (sym->type == S_HEX || sym->type == S_INT) { + if (!menu_validate_number(sym, sym2)) + prop_warn(prop, + "'%s': number is invalid", + sym->name); + } break; case P_SELECT: sym2 = prop_get_symbol(prop); @@@ -240,8 -229,8 +249,8 @@@ if (sym->type != S_INT && sym->type != S_HEX) prop_warn(prop, "range is only allowed " "for int or hex symbols"); - if (!menu_range_valid_sym(sym, prop->expr->left.sym) || - !menu_range_valid_sym(sym, prop->expr->right.sym)) + if (!menu_validate_number(sym, prop->expr->left.sym) || + !menu_validate_number(sym, prop->expr->right.sym)) prop_warn(prop, "range is invalid"); break; default: @@@ -430,11 -419,6 +439,11 @@@ bool menu_is_visible(struct menu *menu if (!menu->prompt) return false; + if (menu->visibility) { + if (expr_calc_value(menu->visibility) == no) + return no; + } + sym = menu->sym; if (sym) { sym_calc_value(sym); diff --combined scripts/kconfig/symbol.c index af6e9f3de950,fa52e6f44ac4..a796c95fe8a0 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@@ -351,12 -351,16 +351,16 @@@ 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(sym->rev_dep.expr, stderr); + 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); } newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri); } @@@ -686,7 -690,7 +690,7 @@@ const char *sym_get_string_default(stru switch (sym->type) { case S_BOOLEAN: case S_TRISTATE: - /* The visibility imay limit the value from yes => mod */ + /* The visibility may limit the value from yes => mod */ val = EXPR_AND(expr_calc_value(prop->expr), prop->visible.tri); break; default: @@@ -875,7 -879,7 +879,7 @@@ const char *sym_expand_string_value(con symval = sym_get_string_value(sym); } - newlen = strlen(res) + strlen(symval) + strlen(src); + newlen = strlen(res) + strlen(symval) + strlen(src) + 1; if (newlen > reslen) { reslen = newlen; res = realloc(res, reslen);