summaryrefslogtreecommitdiff
path: root/kconfig/symbol.c
diff options
context:
space:
mode:
authorChris Packham <judge.packham@gmail.com>2020-12-09 08:03:27 (GMT)
committerChris Packham <judge.packham@gmail.com>2021-02-02 07:06:32 (GMT)
commit689dc60f212db105243b60290480f29475578e0d (patch)
tree3e4a6332013209dd63809f4e719f1add8fe9b21a /kconfig/symbol.c
parent07ae8dd48dfb19a7b89bc4c208bc5778c79ce446 (diff)
kconfig: Sync with upstream v4.17
This commit introduces the following upstream changes: 17baab68d337 kconfig: extend output of 'listnewconfig' b23d1a241f4e kbuild: add %.lex.c and %.tab.[ch] to 'targets' automatically 9a8dfb394c04 kbuild: clean up *.lex.c and *.tab.[ch] patterns from top-level Makefile 598893002745 .gitignore: move *.lex.c *.tab.[ch] patterns to the top-level .gitignore 18492685e479 kconfig: use yylineno option instead of manual lineno increments 379a8eb8eb1a kconfig: detect recursive inclusion earlier 32a94b8b0c3e kconfig: remove duplicated file name and lineno of recursive inclusion 26561514cc9d kconfig: do not include both curses.h and ncurses.h for nconfig f8f69dc0b4e0 kconfig: make unmet dependency warnings readable f622f8279581 kconfig: warn unmet direct dependency of tristate symbols selected by y e2c75e7667c7 kconfig: tests: test if recursive inclusion is detected 29c434f367ea kconfig: tests: test if recursive dependencies are detected 3e4888c2e3d7 kconfig: tests: test randconfig for choice in choice beaaddb62540 kconfig: tests: test defconfig when two choices interact ee236610653e kconfig: tests: check visibility of tristate choice values in y choice 930c429a656f kconfig: tests: check unneeded "is not set" with unmet dependency b76960c0f6b2 kconfig: tests: test if new symbols in choice are asked 49ac3c0c3aa3 kconfig: tests: test automatic submenu creation 1903c5119059 kconfig: tests: add basic choice tests 022a4bf6b59d kconfig: tests: add framework for Kconfig unit testing 2a61625835c7 kconfig: remove redundant streamline_config.pl prerequisite 911a91c39cab kconfig: rename silentoldconfig to syncconfig 81d2bc227305 kconfig: invoke oldconfig instead of silentoldconfig from local*config 2aad9b896213 kconfig: hide irrelevant sub-menus for oldconfig 99f0b6578bab kconfig: remove redundant input_mode test for check_conf() loop 4bb3a5b085cd kconfig: remove unneeded input_mode test in conf() 59a80b5e892d kconfig: do not call check_conf() for olddefconfig f467c5640c29 kconfig: only write '# CONFIG_FOO is not set' for visible symbols d9119b5925a0 kconfig: Print reverse dependencies in groups 9a47ceec543b kconfig: clean-up reverse dependency help implementation 07a422bb213a kbuild: restore autoksyms.h touch to the top Makefile Signed-off-by: Chris Packham <judge.packham@gmail.com>
Diffstat (limited to 'kconfig/symbol.c')
-rw-r--r--kconfig/symbol.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/kconfig/symbol.c b/kconfig/symbol.c
index 2220bc4..f0b2e3b 100644
--- a/kconfig/symbol.c
+++ b/kconfig/symbol.c
@@ -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;
@@ -333,6 +333,27 @@ static struct symbol *sym_calc_choice(struct symbol *sym)
return def_sym;
}
+static void sym_warn_unmet_dep(struct symbol *sym)
+{
+ struct gstr gs = str_new();
+
+ str_printf(&gs,
+ "\nWARNING: unmet direct dependencies detected for %s\n",
+ sym->name);
+ str_printf(&gs,
+ " Depends on [%c]: ",
+ sym->dir_dep.tri == mod ? 'm' : 'n');
+ expr_gstr_print(sym->dir_dep.expr, &gs);
+ str_printf(&gs, "\n");
+
+ expr_gstr_print_revdep(sym->rev_dep.expr, &gs, yes,
+ " Selected by [y]:\n");
+ expr_gstr_print_revdep(sym->rev_dep.expr, &gs, mod,
+ " Selected by [m]:\n");
+
+ fputs(str_get(&gs), stderr);
+}
+
void sym_calc_value(struct symbol *sym)
{
struct symbol_value newval, oldval;
@@ -403,9 +424,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,18 +435,8 @@ 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);
- }
+ if (sym->dir_dep.tri < sym->rev_dep.tri)
+ sym_warn_unmet_dep(sym);
newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
}
if (newval.tri == mod &&