Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 227665
b: refs/heads/master
c: 1137c56
h: refs/heads/master
i:
  227663: 9d8d8bd
v: v3
  • Loading branch information
Arnaud Lacombe authored and Michal Marek committed Dec 21, 2010
1 parent 2216d48 commit 0a9dc19
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ab60bd0b92ec57c98df08616b7d0664be5551eae
refs/heads/master: 1137c56b7420c801147e0863845c03b07554721a
42 changes: 42 additions & 0 deletions trunk/scripts/kconfig/expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,48 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2)
#endif
}

static inline struct expr *
expr_get_leftmost_symbol(const struct expr *e)
{

if (e == NULL)
return NULL;

while (e->type != E_SYMBOL)
e = e->left.expr;

return expr_copy(e);
}

/*
* Given expression `e1' and `e2', returns the leaf of the longest
* sub-expression of `e1' not containing 'e2.
*/
struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2)
{
struct expr *ret;

switch (e1->type) {
case E_OR:
return expr_alloc_and(
expr_simplify_unmet_dep(e1->left.expr, e2),
expr_simplify_unmet_dep(e1->right.expr, e2));
case E_AND: {
struct expr *e;
e = expr_alloc_and(expr_copy(e1), expr_copy(e2));
e = expr_eliminate_dups(e);
ret = (!expr_eq(e, e1)) ? e1 : NULL;
expr_free(e);
break;
}
default:
ret = e1;
break;
}

return expr_get_leftmost_symbol(ret);
}

void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)
{
if (!e) {
Expand Down
6 changes: 5 additions & 1 deletion trunk/scripts/kconfig/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,16 @@ 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(sym->rev_dep.expr, stderr);
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 = EXPR_OR(newval.tri, sym->rev_dep.tri);
}
Expand Down

0 comments on commit 0a9dc19

Please sign in to comment.