From 72f3b7cf814beb273c5b5867c47a7a84daf50ac1 Mon Sep 17 00:00:00 2001 From: Robert Schwebel Date: Wed, 28 Jul 2004 01:13:09 +0000 Subject: rules/vendor-tweaks/abbcc.make git-svn-id: https://svn.pengutronix.de/svn/ptxdist/trunk@1507 33e552b5-05e3-0310-8538-816dae2090ed --- scripts/kconfig/conf.c | 7 ++- scripts/kconfig/confdata.c | 15 ++++- scripts/kconfig/expr.c | 40 +++++++------ scripts/kconfig/expr.h | 1 - scripts/kconfig/mconf.c | 19 +++++-- scripts/kconfig/menu.c | 133 ++++++++++++++++++++++++++++--------------- scripts/kconfig/symbol.c | 28 ++++----- scripts/lxdialog/checklist.c | 10 +++- scripts/settoolchain.sh | 3 +- 9 files changed, 159 insertions(+), 97 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 08da496f8..cdc72014d 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -175,7 +175,7 @@ int conf_string(struct menu *menu) break; case '?': /* print help */ - if (line[1] == 0) { + if (line[1] == '\n') { help = nohelp_text; if (menu->sym->help) help = menu->sym->help; @@ -575,6 +575,9 @@ int main(int ac, char **av) conf_cnt = 0; check_conf(&rootmenu); } while (conf_cnt); - conf_write(NULL); + if (conf_write(NULL)) { + fprintf(stderr, "\n*** Error during writing of the kernel configuration.\n\n"); + return 1; + } return 0; } diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index fb7fc28b5..211200895 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -128,7 +128,7 @@ int conf_read(const char *name) continue; sym = sym_find(line + 10); if (!sym) { - fprintf(stderr, "%s:%d: trying to assign nonexistent symbol %s\n", name, lineno, line + 9); + fprintf(stderr, "%s:%d: trying to assign nonexistent symbol %s\n", name, lineno, line + 10); break; } switch (sym->type) { @@ -229,6 +229,9 @@ int conf_read(const char *name) } fclose(in); + if (modules_sym) + sym_calc_value(modules_sym); + for_all_symbols(i, sym) { sym_calc_value(sym); if (sym_has_value(sym) && !sym_is_choice_value(sym)) { @@ -269,8 +272,14 @@ int conf_write(const char *name) dirname[0] = 0; if (name && name[0]) { - char *slash = strrchr(name, '/'); - if (slash) { + struct stat st; + char *slash; + + if (!stat(name, &st) && S_ISDIR(st.st_mode)) { + strcpy(dirname, name); + strcat(dirname, "/"); + basename = conf_def_filename; + } else if ((slash = strrchr(name, '/'))) { int size = slash - name + 1; memcpy(dirname, name, size); dirname[size] = 0; diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 3f15ae859..73ae3f0dd 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c @@ -219,10 +219,9 @@ int expr_eq(struct expr *e1, struct expr *e2) case E_NONE: /* panic */; } - - print_expr(0, e1, 0); + expr_fprint(e1, stdout); printf(" = "); - print_expr(0, e2, 0); + expr_fprint(e2, stdout); printf(" ?\n"); return 0; @@ -397,12 +396,14 @@ struct expr *expr_join_or(struct expr *e1, struct expr *e2) return expr_alloc_symbol(&symbol_yes); } - printf("optimize "); - print_expr(0, e1, 0); - printf(" || "); - print_expr(0, e2, 0); - printf(" ?\n"); + printf("optimize ("); + expr_fprint(e1, stdout); + printf(") || ("); + expr_fprint(e2, stdout); + printf(")?\n"); + return NULL; + } struct expr *expr_join_and(struct expr *e1, struct expr *e2) @@ -444,6 +445,11 @@ struct expr *expr_join_and(struct expr *e1, struct expr *e2) // (a) && (a!='n') -> (a) return expr_alloc_symbol(sym1); + if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_mod) || + (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_mod)) + // (a) && (a!='m') -> (a='y') + return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes); + if (sym1->type == S_TRISTATE) { if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) { // (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' @@ -483,11 +489,11 @@ struct expr *expr_join_and(struct expr *e1, struct expr *e2) (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_yes)) return NULL; } - printf("optimize "); - print_expr(0, e1, 0); - printf(" && "); - print_expr(0, e2, 0); - printf(" ?\n"); + printf("optimize ("); + expr_fprint(e1, stdout); + printf(") && ("); + expr_fprint(e2, stdout); + printf(")?\n"); return NULL; } @@ -1073,11 +1079,3 @@ void expr_fprint(struct expr *e, FILE *out) { expr_print(e, expr_print_file_helper, out, E_NONE); } - -void print_expr(int mask, struct expr *e, int prevtoken) -{ - if (!(cdebug & mask)) - return; - expr_fprint(e, stdout); -} - diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index cc616f1f8..cac51f6a8 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -174,7 +174,6 @@ void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, s struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym); void expr_fprint(struct expr *e, FILE *out); -void print_expr(int mask, struct expr *e, int prevtoken); static inline int expr_is_yes(struct expr *e) { diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 93a2683af..45028639f 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -607,6 +607,7 @@ static void conf_choice(struct menu *menu) struct symbol *active; int stat; + active = sym_get_choice_value(menu->sym); while (1) { cprint_init(); cprint("--title"); @@ -618,24 +619,32 @@ static void conf_choice(struct menu *menu) cprint("6"); current_menu = menu; - active = sym_get_choice_value(menu->sym); for (child = menu->list; child; child = child->next) { if (!menu_is_visible(child)) continue; cprint("%p", child); cprint("%s", menu_get_prompt(child)); - cprint(child->sym == active ? "ON" : "OFF"); + if (child->sym == sym_get_choice_value(menu->sym)) + cprint("ON"); + else if (child->sym == active) + cprint("SELECTED"); + else + cprint("OFF"); } stat = exec_conf(); switch (stat) { case 0: - if (sscanf(input_buf, "%p", &menu) != 1) + if (sscanf(input_buf, "%p", &child) != 1) break; - sym_set_tristate_value(menu->sym, yes); + sym_set_tristate_value(child->sym, yes); return; case 1: - show_help(menu); + if (sscanf(input_buf, "%p", &child) == 1) { + show_help(child); + active = child->sym; + } else + show_help(menu); break; case 255: return; diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 16317670a..5f62ad798 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -16,6 +16,28 @@ static struct menu **last_entry_ptr; struct file *file_list; struct file *current_file; +static void +menu_warn(struct menu *menu, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + fprintf(stderr, "%s:%d:warning: ", menu->file->name, menu->lineno); + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); + va_end(ap); +} + +static void +prop_warn(struct property *prop, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + fprintf(stderr, "%s:%d:warning: ", prop->file->name, prop->lineno); + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); + va_end(ap); +} + void menu_init(void) { current_entry = current_menu = &rootmenu; @@ -94,9 +116,9 @@ void menu_set_type(int type) sym->type = type; return; } - fprintf(stderr, "%s:%d:warning: type of '%s' redefined from '%s' to '%s'\n", - current_entry->file->name, current_entry->lineno, - sym->name ? sym->name : "", sym_type_name(sym->type), sym_type_name(type)); + menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'\n", + sym->name ? sym->name : "", + sym_type_name(sym->type), sym_type_name(type)); } struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) @@ -110,8 +132,7 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e if (prompt) { if (current_entry->prompt) - fprintf(stderr, "%s:%d: prompt redefined\n", - current_entry->file->name, current_entry->lineno); + menu_warn(current_entry, "prompt redefined\n"); current_entry->prompt = prop; } @@ -133,6 +154,55 @@ 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 +sym_check_prop(struct symbol *sym) +{ + struct property *prop; + struct symbol *sym2; + for (prop = sym->prop; prop; prop = prop->next) { + switch (prop->type) { + case P_DEFAULT: + if ((sym->type == S_STRING || sym->type == S_INT + || sym->type == S_HEX) + && prop->expr->type != E_SYMBOL) + prop_warn(prop, + "default for config symbol '%'" + " must be a single symbol", + sym->name); + break; + case P_SELECT: + sym2 = prop_get_symbol(prop); + if (sym->type != S_BOOLEAN && sym->type != S_TRISTATE) + prop_warn(prop, + "config symbol '%s' uses select, but is " + "not boolean or tristate", sym->name); + else if (sym2->type == S_UNKNOWN) + prop_warn(prop, + "'select' used by config symbol '%s' " + "refer to undefined symbol '%s'", + sym->name, sym2->name); + else if (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); + break; + case P_RANGE: + if (sym->type != S_INT && sym->type != S_HEX) + prop_warn(prop, "range is only allowed " + "for int or hex symbols"); + if (!sym_string_valid(sym, prop->expr->left.sym->name) + || !sym_string_valid(sym, + prop->expr->right.sym->name)) + prop_warn(prop, "range is invalid"); + break; + default: + ; + } + } +} + void menu_finalize(struct menu *parent) { struct menu *menu, *last_menu; @@ -222,17 +292,16 @@ void menu_finalize(struct menu *parent) 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); + menu_warn(menu, "choice value must have a prompt"); for (prop = menu->sym->prop; prop; prop = prop->next) { 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); - + prop_warn(prop, "choice values " + "currently only support a " + "single prompt"); } if (prop->type == P_DEFAULT) - fprintf(stderr, "%s:%d:warning: defaults for choice values not supported\n", - prop->file->name, prop->lineno); + prop_warn(prop, "defaults for choice " + "values not supported"); } current_entry = menu; menu_set_type(sym->type); @@ -256,43 +325,15 @@ void menu_finalize(struct menu *parent) } if (sym && !(sym->flags & SYMBOL_WARNED)) { - struct symbol *sym2; if (sym->type == S_UNKNOWN) - fprintf(stderr, "%s:%d:warning: config symbol defined without type\n", - parent->file->name, parent->lineno); + menu_warn(parent, "config symbol defined " + "without type\n"); if (sym_is_choice(sym) && !parent->prompt) - fprintf(stderr, "%s:%d:warning: choice must have a prompt\n", - parent->file->name, parent->lineno); - - for (prop = sym->prop; prop; prop = prop->next) { - switch (prop->type) { - case P_DEFAULT: - if ((sym->type == S_STRING || sym->type == S_INT || sym->type == S_HEX) && - prop->expr->type != E_SYMBOL) - fprintf(stderr, "%s:%d:warning: default must be a single symbol\n", - prop->file->name, prop->lineno); - break; - case P_SELECT: - sym2 = prop_get_symbol(prop); - if ((sym->type != S_BOOLEAN && sym->type != S_TRISTATE) || - (sym2->type != S_BOOLEAN && sym2->type != S_TRISTATE)) - fprintf(stderr, "%s:%d:warning: enable is only allowed with boolean and tristate symbols\n", - prop->file->name, prop->lineno); - break; - case P_RANGE: - if (sym->type != S_INT && sym->type != S_HEX) - fprintf(stderr, "%s:%d:warning: range is only allowed for int or hex symbols\n", - prop->file->name, prop->lineno); - if (!sym_string_valid(sym, prop->expr->left.sym->name) || - !sym_string_valid(sym, prop->expr->right.sym->name)) - fprintf(stderr, "%s:%d:warning: range is invalid\n", - prop->file->name, prop->lineno); - break; - default: - ; - } - } + menu_warn(parent, "choice must have a prompt\n"); + + /* Check properties connected to this symbol */ + sym_check_prop(sym); sym->flags |= SYMBOL_WARNED; } diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 01c766ed1..16b48cf88 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -31,6 +31,7 @@ struct symbol symbol_yes = { int sym_change_count; struct symbol *modules_sym; +tristate modules_val; void sym_add_default(struct symbol *sym, const char *def) { @@ -79,11 +80,8 @@ enum symbol_type sym_get_type(struct symbol *sym) if (type == S_TRISTATE) { if (sym_is_choice_value(sym) && sym->visible == yes) type = S_BOOLEAN; - else { - sym_calc_value(modules_sym); - if (modules_sym->curr.tri == no) - type = S_BOOLEAN; - } + else if (modules_val == no) + type = S_BOOLEAN; } return type; } @@ -153,6 +151,8 @@ static void sym_calc_visibility(struct symbol *sym) prop->visible.tri = expr_calc_value(prop->visible.expr); tri = E_OR(tri, prop->visible.tri); } + if (tri == mod && (sym->type != S_TRISTATE || modules_val == no)) + tri = yes; if (sym->visible != tri) { sym->visible = tri; sym_set_changed(sym); @@ -162,6 +162,8 @@ static void sym_calc_visibility(struct symbol *sym) tri = no; if (sym->rev_dep.expr) tri = expr_calc_value(sym->rev_dep.expr); + if (tri == mod && sym_get_type(sym) == S_BOOLEAN) + tri = yes; if (sym->rev_dep.tri != tri) { sym->rev_dep.tri = tri; sym_set_changed(sym); @@ -268,14 +270,8 @@ void sym_calc_value(struct symbol *sym) newval.tri = expr_calc_value(prop->expr); } } - if (sym_get_type(sym) == S_BOOLEAN) { - if (newval.tri == mod) - newval.tri = yes; - if (sym->visible == mod) - sym->visible = yes; - if (sym->rev_dep.tri == mod) - sym->rev_dep.tri = yes; - } + if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN) + newval.tri = yes; break; case S_STRING: case S_HEX: @@ -307,6 +303,8 @@ void sym_calc_value(struct symbol *sym) if (memcmp(&oldval, &sym->curr, sizeof(oldval))) sym_set_changed(sym); + if (modules_sym == sym) + modules_val = modules_sym->curr.tri; if (sym_is_choice(sym)) { int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE); @@ -327,6 +325,8 @@ void sym_clear_all_valid(void) for_all_symbols(i, sym) sym->flags &= ~SYMBOL_VALID; sym_change_count++; + if (modules_sym) + sym_calc_value(modules_sym); } void sym_set_changed(struct symbol *sym) @@ -706,7 +706,7 @@ struct symbol *sym_check_deps(struct symbol *sym) goto out; for (prop = sym->prop; prop; prop = prop->next) { - if (prop->type == P_CHOICE) + if (prop->type == P_CHOICE || prop->type == P_SELECT) continue; sym2 = sym_check_expr_deps(prop->visible.expr); if (sym2) diff --git a/scripts/lxdialog/checklist.c b/scripts/lxdialog/checklist.c index 4f78688ed..99705fe65 100644 --- a/scripts/lxdialog/checklist.c +++ b/scripts/lxdialog/checklist.c @@ -138,9 +138,11 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, /* Initializes status */ for (i = 0; i < item_no; i++) { status[i] = !strcasecmp (items[i * 3 + 2], "on"); - if (!choice && status[i]) - choice = i; + if ((!choice && status[i]) || !strcasecmp (items[i * 3 + 2], "selected")) + choice = i + 1; } + if (choice) + choice--; max_choice = MIN (list_height, item_no); @@ -302,6 +304,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, case 'H': case 'h': case '?': + fprintf (stderr, "%s", items[(scroll + choice) * 3]); delwin (dialog); free (status); return 1; @@ -347,7 +350,8 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, } } - } + } else + fprintf (stderr, "%s", items[(scroll + choice) * 3]); delwin (dialog); free (status); return button; diff --git a/scripts/settoolchain.sh b/scripts/settoolchain.sh index 17e9ffcc2..617a25c92 100755 --- a/scripts/settoolchain.sh +++ b/scripts/settoolchain.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: settoolchain.sh,v 1.8 2003/11/17 03:47:04 mkl Exp $ +# $Id: settoolchain.sh,v 1.9 2004/07/28 01:13:09 rsc Exp $ # # Copyright (C) 2003 Ixia Communications, by Dan Kegel # @@ -85,4 +85,3 @@ yes '' | make oldconfig NEW_GNU_TARGET=`cat .config | grep PTXCONF_GNU_TARGET | sed 's/.*="//;s/".*//'` test x$TARGET = x$NEW_GNU_TARGET || abort "make oldconfig mangled the target $TARGET into $NEW_GNU_TARGET; you may need to use a canonical target, or fix config/target.in" - -- cgit v1.2.3