kconfig: rename E_OR & friends to avoid name clash
[safe/jmp/linux-2.6] / scripts / kconfig / symbol.c
index 4ea0050..add068c 100644 (file)
@@ -30,7 +30,7 @@ struct symbol symbol_yes = {
        .flags = SYMBOL_VALID,
 };
 
-int sym_change_count;
+struct symbol *sym_defconfig_list;
 struct symbol *modules_sym;
 tristate modules_val;
 
@@ -199,7 +199,7 @@ static void sym_calc_visibility(struct symbol *sym)
        tri = no;
        for_all_prompts(sym, prop) {
                prop->visible.tri = expr_calc_value(prop->visible.expr);
-               tri = E_OR(tri, prop->visible.tri);
+               tri = EXPR_OR(tri, prop->visible.tri);
        }
        if (tri == mod && (sym->type != S_TRISTATE || modules_val == no))
                tri = yes;
@@ -303,7 +303,7 @@ void sym_calc_value(struct symbol *sym)
                if (sym_is_choice_value(sym) && sym->visible == yes) {
                        prop = sym_get_choice_prop(sym);
                        newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no;
-               } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) {
+               } else if (EXPR_OR(sym->visible, sym->rev_dep.tri) != no) {
                        sym->flags |= SYMBOL_WRITE;
                        if (sym_has_value(sym))
                                newval.tri = sym->def[S_DEF_USER].tri;
@@ -312,7 +312,7 @@ void sym_calc_value(struct symbol *sym)
                                if (prop)
                                        newval.tri = expr_calc_value(prop->expr);
                        }
-                       newval.tri = E_OR(E_AND(newval.tri, sym->visible), sym->rev_dep.tri);
+                       newval.tri = EXPR_OR(EXPR_AND(newval.tri, sym->visible), sym->rev_dep.tri);
                } else if (!sym_is_choice(sym)) {
                        prop = sym_get_default_prop(sym);
                        if (prop) {
@@ -352,10 +352,13 @@ void sym_calc_value(struct symbol *sym)
                sym->curr.val = sym_calc_choice(sym);
        sym_validate_range(sym);
 
-       if (memcmp(&oldval, &sym->curr, sizeof(oldval)))
+       if (memcmp(&oldval, &sym->curr, sizeof(oldval))) {
                sym_set_changed(sym);
-       if (modules_sym == sym)
-               modules_val = modules_sym->curr.tri;
+               if (modules_sym == sym) {
+                       sym_set_all_changed();
+                       modules_val = modules_sym->curr.tri;
+               }
+       }
 
        if (sym_is_choice(sym)) {
                int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
@@ -375,7 +378,7 @@ void sym_clear_all_valid(void)
 
        for_all_symbols(i, sym)
                sym->flags &= ~SYMBOL_VALID;
-       sym_change_count++;
+       sym_add_change_count(1);
        if (modules_sym)
                sym_calc_value(modules_sym);
 }
@@ -426,8 +429,8 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val)
        if (oldval != val && !sym_tristate_within_range(sym, val))
                return false;
 
-       if (sym->flags & SYMBOL_NEW) {
-               sym->flags &= ~SYMBOL_NEW;
+       if (!(sym->flags & SYMBOL_DEF_USER)) {
+               sym->flags |= SYMBOL_DEF_USER;
                sym_set_changed(sym);
        }
        /*
@@ -440,20 +443,17 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val)
                struct expr *e;
 
                cs->def[S_DEF_USER].val = sym;
-               cs->flags &= ~SYMBOL_NEW;
+               cs->flags |= SYMBOL_DEF_USER;
                prop = sym_get_choice_prop(cs);
                for (e = prop->expr; e; e = e->left.expr) {
                        if (e->right.sym->visible != no)
-                               e->right.sym->flags &= ~SYMBOL_NEW;
+                               e->right.sym->flags |= SYMBOL_DEF_USER;
                }
        }
 
        sym->def[S_DEF_USER].tri = val;
-       if (oldval != val) {
+       if (oldval != val)
                sym_clear_all_valid();
-               if (sym == modules_sym)
-                       sym_set_all_changed();
-       }
 
        return true;
 }
@@ -591,8 +591,8 @@ bool sym_set_string_value(struct symbol *sym, const char *newval)
        if (!sym_string_within_range(sym, newval))
                return false;
 
-       if (sym->flags & SYMBOL_NEW) {
-               sym->flags &= ~SYMBOL_NEW;
+       if (!(sym->flags & SYMBOL_DEF_USER)) {
+               sym->flags |= SYMBOL_DEF_USER;
                sym_set_changed(sym);
        }
 
@@ -679,7 +679,6 @@ struct symbol *sym_lookup(const char *name, int isconst)
        memset(symbol, 0, sizeof(*symbol));
        symbol->name = new_name;
        symbol->type = S_UNKNOWN;
-       symbol->flags = SYMBOL_NEW;
        if (isconst)
                symbol->flags |= SYMBOL_CONST;
 
@@ -787,13 +786,15 @@ static struct symbol *sym_check_expr_deps(struct expr *e)
        return NULL;
 }
 
+/* return NULL when dependencies are OK */
 struct symbol *sym_check_deps(struct symbol *sym)
 {
        struct symbol *sym2;
        struct property *prop;
 
        if (sym->flags & SYMBOL_CHECK) {
-               printf("Warning! Found recursive dependency: %s", sym->name);
+               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)
@@ -817,13 +818,8 @@ struct symbol *sym_check_deps(struct symbol *sym)
                        goto out;
        }
 out:
-       if (sym2) {
-               printf(" %s", sym->name);
-               if (sym2 == sym) {
-                       printf("\n");
-                       sym2 = NULL;
-               }
-       }
+       if (sym2)
+               fprintf(stderr, " -> %s%s", sym->name, sym2 == sym? "\n": "");
        sym->flags &= ~SYMBOL_CHECK;
        return sym2;
 }