[PATCH] kconfig: warn about complex selects

From: Vegard Nossum
Date: Sun May 04 2008 - 01:24:04 EST


"Complex selects" are selects that depend on symbols with dependencies. These
are effectively circumventing the rest of the dependency chains of kconfig,
often leading to build errors.

Signed-off-by: Vegard Nossum <vegard.nossum@xxxxxxxxx>
---
scripts/kconfig/symbol.c | 31 ++++++++++++++++++++++++++++++-
1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 18f3e5c..e5c3c60 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -790,6 +790,24 @@ static struct symbol *sym_check_expr_deps(struct expr *e)
return NULL;
}

+bool sym_check_select(struct symbol *sym)
+{
+ struct property *prop;
+
+ for (prop = sym->prop; prop; prop = prop->next) {
+ struct expr *expr = prop->expr;
+
+ if (!expr)
+ continue;
+ if (expr->type == E_SYMBOL)
+ continue;
+
+ return true;
+ }
+
+ return false;
+}
+
/* return NULL when dependencies are OK */
static struct symbol *sym_check_sym_deps(struct symbol *sym)
{
@@ -801,7 +819,18 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym)
return sym2;

for (prop = sym->prop; prop; prop = prop->next) {
- if (prop->type == P_CHOICE || prop->type == P_SELECT)
+ if (prop->type == P_SELECT) {
+ if (!sym_check_select(prop->expr->left.sym))
+ continue;
+
+ fprintf(stderr, "%s:%d:error: found complex select: "
+ "%s -> %s\n",
+ sym->prop->file->name, sym->prop->lineno,
+ sym->name, prop->expr->left.sym->name);
+ continue;
+ }
+
+ if (prop->type == P_CHOICE)
continue;
sym2 = sym_check_expr_deps(prop->visible.expr);
if (sym2)
--
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/