summaryrefslogtreecommitdiff
path: root/scripts/kconfig/symbol.c
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2010-06-08 20:25:57 +0400
committerMichal Marek <mmarek@suse.cz>2010-07-02 16:53:09 +0400
commit246cf9c26bf11f2bffbecea6e5bd222eee7b1df8 (patch)
tree29ddd2eaa165dbad9e8760866d782f122f579118 /scripts/kconfig/symbol.c
parent60c8eca69f7fb2820677a635d921866f66727fcb (diff)
downloadlinux-246cf9c26bf11f2bffbecea6e5bd222eee7b1df8.tar.xz
kbuild: Warn on selecting symbols with unmet direct dependencies
The "select" statement in Kconfig files allows the enabling of options even if they have unmet direct dependencies (i.e. "depends on" expands to "no"). Currently, the "depends on" clauses are used in calculating the visibility but they do not affect the reverse dependencies in any way. The patch introduces additional tracking of the "depends on" statements and prints a warning on selecting an option if its direct dependencies are not met. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/kconfig/symbol.c')
-rw-r--r--scripts/kconfig/symbol.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 2e7a048e0cfc..174b230a52b0 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -205,6 +205,16 @@ static void sym_calc_visibility(struct symbol *sym)
}
if (sym_is_choice_value(sym))
return;
+ /* defaulting to "yes" if no explicit "depends on" are given */
+ tri = yes;
+ if (sym->dir_dep.expr)
+ tri = expr_calc_value(sym->dir_dep.expr);
+ if (tri == mod)
+ tri = yes;
+ if (sym->dir_dep.tri != tri) {
+ sym->dir_dep.tri = tri;
+ sym_set_changed(sym);
+ }
tri = no;
if (sym->rev_dep.expr)
tri = expr_calc_value(sym->rev_dep.expr);
@@ -321,6 +331,14 @@ void sym_calc_value(struct symbol *sym)
}
}
calc_newval:
+ if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) {
+ fprintf(stderr, "warning: (");
+ expr_fprint(sym->rev_dep.expr, stderr);
+ fprintf(stderr, ") selects %s which has unmet direct dependencies (",
+ sym->name);
+ expr_fprint(sym->dir_dep.expr, stderr);
+ fprintf(stderr, ")\n");
+ }
newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
}
if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)