diff options
author | Karel Kočí <cynerd@email.cz> | 2015-09-12 11:46:26 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2015-09-12 11:46:26 +0200 |
commit | e94207efe93141ce2d58436c56ea4271948bf148 (patch) | |
tree | e7e2ff871591f9f1c6cf363e5b6865e76ccaefa4 /scripts/parse_kconfig/boolexpr.c | |
parent | 762e0304d1c493447e367a45431416fbada5cc8c (diff) | |
download | linux-conf-perf-e94207efe93141ce2d58436c56ea4271948bf148.tar.gz linux-conf-perf-e94207efe93141ce2d58436c56ea4271948bf148.tar.bz2 linux-conf-perf-e94207efe93141ce2d58436c56ea4271948bf148.zip |
Fix parse_kconfig choice parsing
Parsing choices was implemented wrong. For non-optional choice output
rules must contain also dependency of all choice symbols. Because if no
choice symbol has fulfilled dependencies, than choice shouldn't be
selected.
Diffstat (limited to 'scripts/parse_kconfig/boolexpr.c')
-rw-r--r-- | scripts/parse_kconfig/boolexpr.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/scripts/parse_kconfig/boolexpr.c b/scripts/parse_kconfig/boolexpr.c index 4d58654..b6f008d 100644 --- a/scripts/parse_kconfig/boolexpr.c +++ b/scripts/parse_kconfig/boolexpr.c @@ -4,7 +4,7 @@ struct boolexpr *boolexpr_eql(struct symlist *sl, struct symbol *sym1, struct symbol *sym2); struct boolexpr *boolexpr_kconfig(struct symlist *sl, struct expr *expr, - bool modulesym) { + bool modulesym, struct symbol **as_true) { struct stck { struct expr *expr; struct boolexpr *bl; @@ -30,7 +30,7 @@ struct boolexpr *boolexpr_kconfig(struct symlist *sl, struct expr *expr, } switch (expr->type) { case E_SYMBOL: - rtn = boolexpr_sym(sl, expr->left.sym, modulesym); + rtn = boolexpr_sym(sl, expr->left.sym, modulesym, as_true); goto go_up; case E_NOT: if (rtn == NULL) @@ -111,7 +111,7 @@ struct boolexpr *boolexpr_false() { } struct boolexpr *boolexpr_sym(struct symlist *sl, struct symbol *sym, - bool modulesym) { + bool modulesym, struct symbol **as_true) { struct boolexpr *rtn; rtn = malloc(sizeof(struct boolexpr)); rtn->overusage = 0; @@ -125,6 +125,14 @@ struct boolexpr *boolexpr_sym(struct symlist *sl, struct symbol *sym, } else if (!strcmp(sym->name, "y")) { rtn->type = BT_TRUE; } else { + if (as_true != NULL) { + for (; *as_true != NULL; as_true++) { + if (!strcmp((*as_true)->name, sym->name)) { + rtn->type = BT_TRUE; + return rtn; + } + } + } rtn->id = symlist_id(sl, sym->name); if (rtn->id != 0) rtn->type = BT_SYM; @@ -144,18 +152,18 @@ struct boolexpr *boolexpr_eql(struct symlist *sl, return rtn; } if (!strcmp(sym2->name, "n")) - return boolexpr_not(boolexpr_sym(sl, sym1, false)); + return boolexpr_not(boolexpr_sym(sl, sym1, false, NULL)); if (!strcmp(sym2->name, "y")) - return boolexpr_sym(sl, sym1, false); + return boolexpr_sym(sl, sym1, false, NULL); // sym1 <-> sym2 // (!sym1 || sym2) && (sym1 || !sym2) return boolexpr_and(boolexpr_or - (boolexpr_not(boolexpr_sym(sl, sym1, false)), - boolexpr_sym(sl, sym2, false)), - boolexpr_or(boolexpr_sym(sl, sym1, false), + (boolexpr_not(boolexpr_sym(sl, sym1, false, NULL)), + boolexpr_sym(sl, sym2, false, NULL)), + boolexpr_or(boolexpr_sym(sl, sym1, false, NULL), boolexpr_not(boolexpr_sym - (sl, sym2, false)))); + (sl, sym2, false, NULL)))); } struct boolexpr *boolexpr_or(struct boolexpr *e1, struct boolexpr *e2) { |