From 8a36b98fd0d80234db3675aca4d56e034b01d175 Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Wed, 4 Jun 2003 09:33:10 -0700 Subject: [PATCH] [PATCH] choice handling fixes A few choice handling fixes: - only visible choice values define the new state of the complete choice - improve handling of choices without visible value - two new warnings --- scripts/kconfig/conf.c | 8 ++++++-- scripts/kconfig/confdata.c | 3 ++- scripts/kconfig/menu.c | 23 +++++++++++------------ scripts/kconfig/symbol.c | 3 +++ 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 93544343f93..323dd1c92bd 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -286,10 +286,14 @@ static int conf_choice(struct menu *menu) break; } } else { - sym->user = sym->curr; - if (sym->curr.tri == mod) { + switch (sym_get_tristate_value(sym)) { + case no: + return 1; + case mod: printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); return 0; + case yes: + break; } } diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index bf833ee2331..4d72008b897 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -243,7 +243,8 @@ int conf_read(const char *name) prop = sym_get_choice_prop(sym); sym->flags &= ~SYMBOL_NEW; for (e = prop->expr; e; e = e->left.expr) - sym->flags |= e->right.sym->flags & SYMBOL_NEW; + if (e->right.sym->visible != no) + sym->flags |= e->right.sym->flags & SYMBOL_NEW; } sym_change_count = 1; diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index b97b02807f9..16317670a87 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -221,11 +221,18 @@ void menu_finalize(struct menu *parent) for (menu = parent->list; menu; menu = menu->next) { if (sym && sym_is_choice(sym) && menu->sym) { menu->sym->flags |= SYMBOL_CHOICEVAL; + if (!menu->prompt) + fprintf(stderr, "%s:%d:warning: choice value must have a prompt\n", + menu->file->name, menu->lineno); for (prop = menu->sym->prop; prop; prop = prop->next) { - if (prop->type != P_DEFAULT) - continue; - fprintf(stderr, "%s:%d:warning: defaults for choice values not supported\n", - prop->file->name, prop->lineno); + if (prop->type == P_PROMPT && prop->menu != menu) { + fprintf(stderr, "%s:%d:warning: choice values currently only support a single prompt\n", + prop->file->name, prop->lineno); + + } + if (prop->type == P_DEFAULT) + fprintf(stderr, "%s:%d:warning: defaults for choice values not supported\n", + prop->file->name, prop->lineno); } current_entry = menu; menu_set_type(sym->type); @@ -311,14 +318,6 @@ bool menu_is_visible(struct menu *menu) } else visible = menu->prompt->visible.tri = expr_calc_value(menu->prompt->visible.expr); - if (sym && sym_is_choice(sym)) { - for (child = menu->list; child; child = child->next) - if (menu_is_visible(child)) - break; - if (!child) - return false; - } - if (visible != no) return true; if (!sym || sym_get_tristate_value(menu->sym) == no) diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index e52ca16d3dd..5c62b2c09a7 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -201,6 +201,9 @@ static struct symbol *sym_calc_choice(struct symbol *sym) if (def_sym->visible != no) return def_sym; } + + /* no choice? reset tristate value */ + sym->curr.tri = no; return NULL; } -- 2.11.4.GIT