aboutsummaryrefslogtreecommitdiff
path: root/scripts/parse_kconfig
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-05-05 11:22:50 +0200
committerKarel Kočí <cynerd@email.cz>2015-05-05 11:22:50 +0200
commit20caa5bb744b543b4a55ef7b2d8432e758bb26bb (patch)
tree4cede9e7a167bf4719833bc6b6d200e620070005 /scripts/parse_kconfig
parentbb3fc589961d155bd7cabd3c695f726b69136c14 (diff)
downloadlinux-conf-perf-20caa5bb744b543b4a55ef7b2d8432e758bb26bb.tar.gz
linux-conf-perf-20caa5bb744b543b4a55ef7b2d8432e758bb26bb.tar.bz2
linux-conf-perf-20caa5bb744b543b4a55ef7b2d8432e758bb26bb.zip
parse_kconfig fix problems with choice configs
Choice configs has now own boolean expression. Also fixing problem with i variable. That causes that for some variables no cfn equations were build.
Diffstat (limited to 'scripts/parse_kconfig')
-rw-r--r--scripts/parse_kconfig/parse.c55
1 files changed, 36 insertions, 19 deletions
diff --git a/scripts/parse_kconfig/parse.c b/scripts/parse_kconfig/parse.c
index 1c037ef..d7c2353 100644
--- a/scripts/parse_kconfig/parse.c
+++ b/scripts/parse_kconfig/parse.c
@@ -89,13 +89,14 @@ void build_symlist() {
}
void cpy_dep() {
- int i, y;
+ int i;
struct symbol *sym;
struct property *prop;
struct symlist_el *el;
+ struct boolexpr *pw;
unsigned el_id;
for_all_symbols(i, sym) {
- if ((sym->type == S_BOOLEAN || sym->type == S_TRISTATE)) {
+ if (sym->type == S_BOOLEAN || sym->type == S_TRISTATE) {
el_id = symlist_id(gsymlist, sym->name);
el = &(gsymlist->array[el_id - 1]);
Iprintf("Processing: %s\n", sym->name);
@@ -162,29 +163,20 @@ void cpy_dep() {
choice_exception:
// Add exclusive rules for choice symbol
if (sym_is_choice(sym)) {
- el->def = boolexpr_true();
- if (sym->dir_dep.expr != NULL) {
- Dprintf(" Reverse dependency:\n");
- doutput_expr(sym->dir_dep.expr);
- el->rev_dep =
- boolexpr_kconfig(gsymlist,
- sym->dir_dep.expr, true);
- } else
- el->rev_dep = boolexpr_false();
if (sym->rev_dep.expr != NULL) {
Dprintf(" Dependency:\n");
doutput_expr(sym->rev_dep.expr);
- el->dep =
+ el->rev_dep =
boolexpr_kconfig(gsymlist,
sym->rev_dep.expr, true);
} else
- el->dep = boolexpr_true();
+ el->rev_dep = boolexpr_true();
for_all_choices(sym, prop) {
struct symbol *symw;
struct expr *exprw;
unsigned *symx = NULL;
- size_t symx_size;
- symx_size = 0;
+ size_t symx_size = 0;
+ int x, y;
expr_list_for_each_sym(prop->expr, exprw, symw) {
symx_size++;
symx = realloc(symx, symx_size * sizeof(unsigned));
@@ -195,10 +187,10 @@ void cpy_dep() {
output_rules_symbol(-(int)
el_id);
output_rules_endterm();
- for (i = 0; i < symx_size - 1; i++) {
- for (y = i + 1; y < symx_size; y++) {
+ for (x = 0; x < symx_size - 1; x++) {
+ for (y = x + 1; y < symx_size; y++) {
output_rules_symbol(-(int)
- symx[i]);
+ symx[x]);
output_rules_symbol(-(int)
symx[y]);
output_rules_endterm();
@@ -207,9 +199,33 @@ void cpy_dep() {
free(symx);
symx = NULL;
}
+ struct boolexpr *boolsym = boolexpr_sym(gsymlist, sym,
+ false);
+ if (!sym_is_optional(sym)) {
+ boolexpr_copy(boolsym);
+ boolexpr_copy(el->vis);
+ }
+ struct boolexpr *boolsym_not = boolexpr_not(boolsym);
+ boolexpr_copy(boolsym_not);
+ boolexpr_copy(el->rev_dep);
+ struct boolexpr *notrev_dep = boolexpr_not(el->rev_dep);
+ if (!sym_is_optional(sym)) {
+ boolexpr_copy(notrev_dep);
+ }
+ struct boolexr *w1 = boolexpr_or(boolsym_not, el->rev_dep);
+ struct boolexpr *w2 = boolexpr_or(boolsym_not, notrev_dep);
+ w2 = boolexpr_or(w2, el->vis);
+ pw = boolexpr_and(w1, w2);
+ if (!sym_is_optional(sym)) {
+ struct boolexpr *w3 = boolexpr_not(el->vis);
+ w3 = boolexpr_or(w3, notrev_dep);
+ w3 = boolexpr_or(w3, boolsym);
+ pw = boolexpr_and(pw, w3);
+ }
+
+ goto pw_solve;
}
- struct boolexpr *pw;
struct boolexpr *boolsym = boolexpr_sym(gsymlist, sym,
false);
boolexpr_copy(boolsym);
@@ -239,6 +255,7 @@ void cpy_dep() {
pw = boolexpr_and(w1, w2);
pw = boolexpr_and(w3, pw);
pw = boolexpr_and(w4, pw);
+ pw_solve:
Dprintf(" CNF:\n");
doutput_boolexpr(pw, gsymlist);
cnf_boolexpr(gsymlist, pw);