kconfig: warn unmet direct dependency of tristate symbols selected by y
[carl9170fw.git] / config / symbol.c
index 60a76f958f334e2a52bc38e3dbb7a87454a8b023..6acf536c9726846913d4321460c946d3042d171d 100644 (file)
@@ -183,7 +183,7 @@ static void sym_validate_range(struct symbol *sym)
                sprintf(str, "%lld", val2);
        else
                sprintf(str, "0x%llx", val2);
-       sym->curr.val = strdup(str);
+       sym->curr.val = xstrdup(str);
 }
 
 static void sym_set_changed(struct symbol *sym)
@@ -243,7 +243,7 @@ static void sym_calc_visibility(struct symbol *sym)
        tri = yes;
        if (sym->dir_dep.expr)
                tri = expr_calc_value(sym->dir_dep.expr);
-       if (tri == mod)
+       if (tri == mod && sym_get_type(sym) == S_BOOLEAN)
                tri = yes;
        if (sym->dir_dep.tri != tri) {
                sym->dir_dep.tri = tri;
@@ -403,9 +403,10 @@ void sym_calc_value(struct symbol *sym)
                        if (!sym_is_choice(sym)) {
                                prop = sym_get_default_prop(sym);
                                if (prop) {
-                                       sym->flags |= SYMBOL_WRITE;
                                        newval.tri = EXPR_AND(expr_calc_value(prop->expr),
                                                              prop->visible.tri);
+                                       if (newval.tri != no)
+                                               sym->flags |= SYMBOL_WRITE;
                                }
                                if (sym->implied.tri != no) {
                                        sym->flags |= SYMBOL_WRITE;
@@ -413,7 +414,7 @@ void sym_calc_value(struct symbol *sym)
                                }
                        }
                calc_newval:
-                       if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) {
+                       if (sym->dir_dep.tri < sym->rev_dep.tri) {
                                struct expr *e;
                                e = expr_simplify_unmet_dep(sym->rev_dep.expr,
                                    sym->dir_dep.expr);
@@ -849,7 +850,7 @@ struct symbol *sym_lookup(const char *name, int flags)
                                   : !(symbol->flags & (SYMBOL_CONST|SYMBOL_CHOICE))))
                                return symbol;
                }
-               new_name = strdup(name);
+               new_name = xstrdup(name);
        } else {
                new_name = NULL;
                hash = 0;
@@ -899,7 +900,7 @@ struct symbol *sym_find(const char *name)
  * name to be expanded shall be prefixed by a '$'. Unknown symbol expands to
  * the empty string.
  */
-const char *sym_expand_string_value(const char *in)
+char *sym_expand_string_value(const char *in)
 {
        const char *src;
        char *res;