hostapd: make -mesh and -p2p variants depend on the cfg80211 symbol
[openwrt/openwrt.git] / scripts / config / symbol.c
index 7caabdb51c647e12e35b500bdebd262ba1545eb0..31f268a4eecd6a9f767100920c381a8d7ddb7b1b 100644 (file)
@@ -112,7 +112,7 @@ struct property *sym_get_env_prop(struct symbol *sym)
        return NULL;
 }
 
-struct property *sym_get_default_prop(struct symbol *sym)
+static struct property *sym_get_default_prop(struct symbol *sym)
 {
        struct property *prop;
 
@@ -186,15 +186,49 @@ static void sym_validate_range(struct symbol *sym)
        sym->curr.val = strdup(str);
 }
 
+static void sym_set_changed(struct symbol *sym)
+{
+       struct property *prop;
+
+       sym->flags |= SYMBOL_CHANGED;
+       for (prop = sym->prop; prop; prop = prop->next) {
+               if (prop->menu)
+                       prop->menu->flags |= MENU_CHANGED;
+       }
+}
+
+static void sym_set_all_changed(void)
+{
+       struct symbol *sym;
+       int i;
+
+       for_all_symbols(i, sym)
+               sym_set_changed(sym);
+}
+
 static void sym_calc_visibility(struct symbol *sym)
 {
        struct property *prop;
+       struct symbol *choice_sym = NULL;
        tristate tri;
 
        /* any prompt visible? */
        tri = no;
+
+       if (sym_is_choice_value(sym))
+               choice_sym = prop_get_symbol(sym_get_choice_prop(sym));
+
        for_all_prompts(sym, prop) {
                prop->visible.tri = expr_calc_value(prop->visible.expr);
+               /*
+                * Tristate choice_values with visibility 'mod' are
+                * not visible if the corresponding choice's value is
+                * 'yes'.
+                */
+               if (choice_sym && sym->type == S_TRISTATE &&
+                   prop->visible.tri == mod && choice_sym->curr.tri == yes)
+                       prop->visible.tri = no;
+
                tri = EXPR_OR(tri, prop->visible.tri);
        }
        if (tri == mod && (sym->type != S_TRISTATE || modules_val == no))
@@ -366,18 +400,10 @@ 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(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 = no;
+                       } else {
+                               newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
                        }
-                       newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
                }
                if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)
                        newval.tri = yes;
@@ -447,28 +473,7 @@ void sym_clear_all_valid(void)
        for_all_symbols(i, sym)
                sym->flags &= ~SYMBOL_VALID;
        sym_add_change_count(1);
-       if (modules_sym)
-               sym_calc_value(modules_sym);
-}
-
-void sym_set_changed(struct symbol *sym)
-{
-       struct property *prop;
-
-       sym->flags |= SYMBOL_CHANGED;
-       for (prop = sym->prop; prop; prop = prop->next) {
-               if (prop->menu)
-                       prop->menu->flags |= MENU_CHANGED;
-       }
-}
-
-void sym_set_all_changed(void)
-{
-       struct symbol *sym;
-       int i;
-
-       for_all_symbols(i, sym)
-               sym_set_changed(sym);
+       sym_calc_value(modules_sym);
 }
 
 bool sym_tristate_within_range(struct symbol *sym, tristate val)
@@ -1117,6 +1122,8 @@ static void sym_check_print_recursive(struct symbol *last_sym)
                if (stack->sym == last_sym)
                        fprintf(stderr, "%s:%d:error: recursive dependency detected!\n",
                                prop->file->name, prop->lineno);
+                       fprintf(stderr, "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n");
+                       fprintf(stderr, "subsection \"Kconfig recursive dependency limitations\"\n");
                if (stack->expr) {
                        fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n",
                                prop->file->name, prop->lineno,
@@ -1166,6 +1173,10 @@ static struct symbol *sym_check_expr_deps(struct expr *e)
        case E_NOT:
                return sym_check_expr_deps(e->left.expr);
        case E_EQUAL:
+       case E_GEQ:
+       case E_GTH:
+       case E_LEQ:
+       case E_LTH:
        case E_UNEQUAL:
                sym = sym_check_deps(e->left.sym);
                if (sym)
@@ -1337,6 +1348,8 @@ const char *prop_get_type_name(enum prop_type type)
                return "range";
        case P_SYMBOL:
                return "symbol";
+       case P_RESET:
+               return "reset";
        case P_UNKNOWN:
                break;
        }