From 94a0f92e1a36d68c95781e916a94a377b7081d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 29 Apr 2015 10:17:05 +0200 Subject: Add prompt variable to parse_kconfig --- scripts/parse_kconfig/cnfexpr.c | 4 ++-- scripts/parse_kconfig/cnfexpr.h | 2 +- scripts/parse_kconfig/parse.c | 8 ++++++-- scripts/parse_kconfig/symlist.c | 1 + scripts/parse_kconfig/symlist.h | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) (limited to 'scripts/parse_kconfig') diff --git a/scripts/parse_kconfig/cnfexpr.c b/scripts/parse_kconfig/cnfexpr.c index 9939670..ea0b453 100644 --- a/scripts/parse_kconfig/cnfexpr.c +++ b/scripts/parse_kconfig/cnfexpr.c @@ -9,7 +9,7 @@ struct cnfexpr *cnf_not(struct cnfexpr *el); struct cnfexpr *cnf_copy(struct cnfexpr *el); void free_cnf(struct cnfexpr *e); -struct cnfexpr *kconfig_cnfexpr(struct symlist *sl, bool nt, +struct cnfexpr *kconfig_cnfexpr(struct symlist *sl, bool nt, bool def, struct symbol *sym, struct expr *expr) { struct stck { struct expr *expr; @@ -94,7 +94,7 @@ struct cnfexpr *kconfig_cnfexpr(struct symlist *sl, bool nt, free(stack); struct symlist_el *se = symlist_find(sl, sym->name); - if (se->prompt || nt == true) + if (se->prompt || (nt == true && def == true)) rtrn = cnf_or(cnf_sym(sl, !nt, sym), rtrn); else { struct cnfexpr *w12 = cnf_not(cnf_copy(rtrn)); diff --git a/scripts/parse_kconfig/cnfexpr.h b/scripts/parse_kconfig/cnfexpr.h index c38625a..685ad9b 100644 --- a/scripts/parse_kconfig/cnfexpr.h +++ b/scripts/parse_kconfig/cnfexpr.h @@ -18,7 +18,7 @@ struct cnfexpr { unsigned size; }; -struct cnfexpr *kconfig_cnfexpr(struct symlist *sl, bool nt, +struct cnfexpr *kconfig_cnfexpr(struct symlist *sl, bool nt, bool def, struct symbol *sym, struct expr *expr); void cnf_printf(struct cnfexpr *); diff --git a/scripts/parse_kconfig/parse.c b/scripts/parse_kconfig/parse.c index 576595c..e4e9ec5 100644 --- a/scripts/parse_kconfig/parse.c +++ b/scripts/parse_kconfig/parse.c @@ -81,6 +81,10 @@ void build_symlist() { gsymlist->array[gsymlist->pos - 1].prompt = true; break; } + for_all_defaults(sym, prop) { + gsymlist->array[gsymlist->pos - 1].def = true; + break; + } } } @@ -97,7 +101,7 @@ void cpy_dep() { if (verbose_level > 3) printf_original(gsymlist, sym->dir_dep.expr); el->be = - kconfig_cnfexpr(gsymlist, false, sym, + kconfig_cnfexpr(gsymlist, false, el->def, sym, sym->dir_dep.expr); Iprintf("Direct:\n"); if (verbose_level > 2) @@ -108,7 +112,7 @@ void cpy_dep() { if (verbose_level > 3) printf_original(gsymlist, sym->rev_dep.expr); el->re_be = - kconfig_cnfexpr(gsymlist, true, sym, + kconfig_cnfexpr(gsymlist, true, el->def, sym, sym->rev_dep.expr); Iprintf("Revers:\n"); if (verbose_level > 2) diff --git a/scripts/parse_kconfig/symlist.c b/scripts/parse_kconfig/symlist.c index c6e5140..b0b90ea 100644 --- a/scripts/parse_kconfig/symlist.c +++ b/scripts/parse_kconfig/symlist.c @@ -19,6 +19,7 @@ void symlist_add(struct symlist *sl, char *name) { sl->array[sl->pos].name = name; sl->array[sl->pos].be = NULL; sl->array[sl->pos].prompt = false; + sl->array[sl->pos].def = true; sl->pos++; } diff --git a/scripts/parse_kconfig/symlist.h b/scripts/parse_kconfig/symlist.h index 99d9bfb..6f1f32f 100644 --- a/scripts/parse_kconfig/symlist.h +++ b/scripts/parse_kconfig/symlist.h @@ -8,7 +8,7 @@ struct symlist_el { unsigned int id; char *name; - bool prompt; + bool prompt, def; struct cnfexpr *be; struct cnfexpr *re_be; // forward dependency }; -- cgit v1.2.3