summaryrefslogtreecommitdiff
path: root/kconfig/menu.c
diff options
context:
space:
mode:
authorBryan Hundven <bryanhundven@gmail.com>2018-02-01 00:39:45 (GMT)
committerBryan Hundven <bryanhundven@gmail.com>2018-02-01 00:39:45 (GMT)
commit59b08f8d06700770cf1105269acb2ec2460e2a34 (patch)
tree7e26466ff1bdcb344d223d27c24a2014ff54a38f /kconfig/menu.c
parentba165ed4c0bfa8a83e61a2efd1ad205777978486 (diff)
Sync kconfig files with upstream 4.15
Last updated with 4.9-rc7. This commit introduces the following upstream changes: 9059a3493efe kconfig: fix relational operators for bool and tristate symbols 88127dae6ed9 kconfig/symbol.c: use correct pointer type argument for sizeof b24413180f56 License cleanup: add SPDX GPL-2.0 license identifier to files with no license bb3290d91695 Remove gperf usage from toolchain ad8181060788 kconfig: fix sparse warnings in nconfig ff85a1a80e00 kconfig: Check for libncurses before menuconfig 9be3213b14d4 gconfig: remove misleading parentheses around a condition 83c3a1bad224 xconfig: fix missing suboption and help panels on first run e039303ff71a xconfig: fix 'Show Debug' functionality 79e51b5c2dee kconfig/nconf: Fix hang when editing symbol with a long prompt 0eb47346968f Scripts: kconfig: nconf: fix _GNU_SOURCE redefined warning 237e3ad0f195 Kconfig: Introduce the "imply" keyword Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
Diffstat (limited to 'kconfig/menu.c')
-rw-r--r--kconfig/menu.c57
1 files changed, 40 insertions, 17 deletions
diff --git a/kconfig/menu.c b/kconfig/menu.c
index 6a65271..1fd7b25 100644
--- a/kconfig/menu.c
+++ b/kconfig/menu.c
@@ -239,6 +239,8 @@ static void sym_check_prop(struct symbol *sym)
{
struct property *prop;
struct symbol *sym2;
+ char *use;
+
for (prop = sym->prop; prop; prop = prop->next) {
switch (prop->type) {
case P_DEFAULT:
@@ -258,18 +260,20 @@ static void sym_check_prop(struct symbol *sym)
}
break;
case P_SELECT:
+ case P_IMPLY:
+ use = prop->type == P_SELECT ? "select" : "imply";
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);
+ "config symbol '%s' uses %s, but is "
+ "not boolean or tristate", sym->name, use);
else if (sym2->type != S_UNKNOWN &&
sym2->type != S_BOOLEAN &&
sym2->type != S_TRISTATE)
prop_warn(prop,
- "'%s' has wrong type. 'select' only "
+ "'%s' has wrong type. '%s' only "
"accept arguments of boolean and "
- "tristate type", sym2->name);
+ "tristate type", sym2->name, use);
break;
case P_RANGE:
if (sym->type != S_INT && sym->type != S_HEX)
@@ -339,6 +343,10 @@ void menu_finalize(struct menu *parent)
struct symbol *es = prop_get_symbol(prop);
es->rev_dep.expr = expr_alloc_or(es->rev_dep.expr,
expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
+ } else if (prop->type == P_IMPLY) {
+ struct symbol *es = prop_get_symbol(prop);
+ es->implied.expr = expr_alloc_or(es->implied.expr,
+ expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
}
}
}
@@ -483,7 +491,7 @@ bool menu_is_visible(struct menu *menu)
if (menu->visibility) {
if (expr_calc_value(menu->visibility) == no)
- return no;
+ return false;
}
sym = menu->sym;
@@ -618,13 +626,30 @@ static struct property *get_symbol_prop(struct symbol *sym)
return prop;
}
+static void get_symbol_props_str(struct gstr *r, struct symbol *sym,
+ enum prop_type tok, const char *prefix)
+{
+ bool hit = false;
+ struct property *prop;
+
+ for_all_properties(sym, prop, tok) {
+ if (!hit) {
+ str_append(r, prefix);
+ hit = true;
+ } else
+ str_printf(r, " && ");
+ expr_gstr_print(prop->expr, r);
+ }
+ if (hit)
+ str_append(r, "\n");
+}
+
/*
* head is optional and may be NULL
*/
static void get_symbol_str(struct gstr *r, struct symbol *sym,
struct list_head *head)
{
- bool hit;
struct property *prop;
if (sym && sym->name) {
@@ -654,22 +679,20 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym,
}
}
- hit = false;
- for_all_properties(sym, prop, P_SELECT) {
- if (!hit) {
- str_append(r, " Selects: ");
- hit = true;
- } else
- str_printf(r, " && ");
- expr_gstr_print(prop->expr, r);
- }
- if (hit)
- str_append(r, "\n");
+ get_symbol_props_str(r, sym, P_SELECT, _(" Selects: "));
if (sym->rev_dep.expr) {
str_append(r, _(" Selected by: "));
expr_gstr_print(sym->rev_dep.expr, r);
str_append(r, "\n");
}
+
+ get_symbol_props_str(r, sym, P_IMPLY, _(" Implies: "));
+ if (sym->implied.expr) {
+ str_append(r, _(" Implied by: "));
+ expr_gstr_print(sym->implied.expr, r);
+ str_append(r, "\n");
+ }
+
str_append(r, "\n\n");
}