From: Roman Zippel <zippel@linux-m68k.org>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
kiran@scalemp.com, shai@scalemp.com,
Glauber Costa <gcosta@redhat.com>,
linux-kbuild <linux-kbuild@vger.kernel.org>,
Yinghai Lu <Yinghai.Lu@Sun.COM>
Subject: [PATCH 2/3] fix choice dependency check
Date: Fri, 29 Feb 2008 05:10:24 +0100 (CET) [thread overview]
Message-ID: <Pine.LNX.4.64.0802290509100.2723@scrub.home> (raw)
In-Reply-To: <20080226194058.GA31438@uranus.ravnborg.org>
Properly check the dependency of choices as a group.
Also fix that sym_check_deps() correctly terminates the dependency loop
error check (otherwise it would continue printing the dependency chain).
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
---
scripts/kconfig/symbol.c | 94 ++++++++++++++++++++++++++++++++++++++---------
1 file changed, 76 insertions(+), 18 deletions(-)
Index: linux-2.6/scripts/kconfig/symbol.c
===================================================================
--- linux-2.6.orig/scripts/kconfig/symbol.c
+++ linux-2.6/scripts/kconfig/symbol.c
@@ -762,8 +762,6 @@ struct symbol **sym_re_search(const char
}
-struct symbol *sym_check_deps(struct symbol *sym);
-
static struct symbol *sym_check_expr_deps(struct expr *e)
{
struct symbol *sym;
@@ -795,40 +793,100 @@ static struct symbol *sym_check_expr_dep
}
/* return NULL when dependencies are OK */
-struct symbol *sym_check_deps(struct symbol *sym)
+static struct symbol *sym_check_sym_deps(struct symbol *sym)
{
struct symbol *sym2;
struct property *prop;
- if (sym->flags & SYMBOL_CHECK) {
- fprintf(stderr, "%s:%d:error: found recursive dependency: %s",
- sym->prop->file->name, sym->prop->lineno, sym->name);
- return sym;
- }
- if (sym->flags & SYMBOL_CHECKED)
- return NULL;
-
- sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
sym2 = sym_check_expr_deps(sym->rev_dep.expr);
if (sym2)
- goto out;
+ return sym2;
for (prop = sym->prop; prop; prop = prop->next) {
if (prop->type == P_CHOICE || prop->type == P_SELECT)
continue;
sym2 = sym_check_expr_deps(prop->visible.expr);
if (sym2)
- goto out;
+ break;
if (prop->type != P_DEFAULT || sym_is_choice(sym))
continue;
sym2 = sym_check_expr_deps(prop->expr);
if (sym2)
- goto out;
+ break;
}
-out:
+
+ return sym2;
+}
+
+static struct symbol *sym_check_choice_deps(struct symbol *choice)
+{
+ struct symbol *sym, *sym2;
+ struct property *prop;
+ struct expr *e;
+
+ prop = sym_get_choice_prop(choice);
+ expr_list_for_each_sym(prop->expr, e, sym)
+ sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
+
+ choice->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
+ sym2 = sym_check_sym_deps(choice);
+ choice->flags &= ~SYMBOL_CHECK;
if (sym2)
- fprintf(stderr, " -> %s%s", sym->name, sym2 == sym? "\n": "");
- sym->flags &= ~SYMBOL_CHECK;
+ goto out;
+
+ expr_list_for_each_sym(prop->expr, e, sym) {
+ sym2 = sym_check_sym_deps(sym);
+ if (sym2) {
+ fprintf(stderr, " -> %s", sym->name);
+ break;
+ }
+ }
+out:
+ expr_list_for_each_sym(prop->expr, e, sym)
+ sym->flags &= ~SYMBOL_CHECK;
+
+ if (sym2 && sym_is_choice_value(sym2) &&
+ prop_get_symbol(sym_get_choice_prop(sym2)) == choice)
+ sym2 = choice;
+
+ return sym2;
+}
+
+struct symbol *sym_check_deps(struct symbol *sym)
+{
+ struct symbol *sym2;
+ struct property *prop;
+
+ if (sym->flags & SYMBOL_CHECK) {
+ fprintf(stderr, "%s:%d:error: found recursive dependency: %s",
+ sym->prop->file->name, sym->prop->lineno,
+ sym->name ? sym->name : "<choice>");
+ return sym;
+ }
+ if (sym->flags & SYMBOL_CHECKED)
+ return NULL;
+
+ if (sym_is_choice_value(sym)) {
+ /* for choice groups start the check with main choice symbol */
+ prop = sym_get_choice_prop(sym);
+ sym2 = sym_check_deps(prop_get_symbol(prop));
+ } else if (sym_is_choice(sym)) {
+ sym2 = sym_check_choice_deps(sym);
+ } else {
+ sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
+ sym2 = sym_check_sym_deps(sym);
+ sym->flags &= ~SYMBOL_CHECK;
+ }
+
+ if (sym2) {
+ fprintf(stderr, " -> %s", sym->name ? sym->name : "<choice>");
+ if (sym2 == sym) {
+ fprintf(stderr, "\n");
+ zconfnerrs++;
+ sym2 = NULL;
+ }
+ }
+
return sym2;
}
next prev parent reply other threads:[~2008-02-29 4:10 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-21 10:58 [PATCH] x86_64: make amd quad core 8 socket system not be clustered_box Yinghai Lu
2008-02-22 12:25 ` Andi Kleen
2008-02-22 19:02 ` Yinghai Lu
2008-02-22 19:00 ` Andi Kleen
2008-02-22 19:04 ` Yinghai Lu
2008-02-22 19:07 ` Andi Kleen
2008-02-22 19:07 ` Yinghai Lu
2008-02-22 19:10 ` Andi Kleen
2008-02-23 8:55 ` Yinghai Lu
2008-02-24 5:48 ` [PATCH] x86_64: make amd quad core 8 socket system not be clustered_box v2 Yinghai Lu
2008-02-24 7:50 ` Ingo Molnar
2008-02-24 12:29 ` Andi Kleen
2008-02-24 23:00 ` Yinghai Lu
2008-02-25 1:52 ` Yinghai Lu
2008-02-25 2:32 ` Yinghai Lu
2008-02-25 5:36 ` [PATCH] x86_64: for apic_is_clustered_box for vsmp v2 Yinghai Lu
2008-02-25 6:43 ` [PATCH] x86: vSMP selection in config Yinghai Lu
2008-02-26 19:40 ` Kconfig configuration restore bug [Was: x86: vSMP selection in config] Sam Ravnborg
2008-02-27 2:59 ` Roman Zippel
2008-02-29 4:09 ` [PATCH 1/3] fix recursive dependencies Roman Zippel
2008-02-29 5:05 ` Yinghai Lu
2008-02-29 13:22 ` Roman Zippel
2008-02-29 17:40 ` Sam Ravnborg
2008-02-29 20:05 ` Ingo Molnar
2008-02-29 20:04 ` Ingo Molnar
2008-02-29 4:10 ` Roman Zippel [this message]
2008-04-28 21:08 ` [PATCH 2/3] fix choice dependency check Sam Ravnborg
2008-02-29 4:11 ` [PATCH 3/3] add named choice group Roman Zippel
2008-02-26 20:05 ` [PATCH] x86: vSMP selection in config Sam Ravnborg
2008-02-26 21:03 ` Yinghai Lu
2008-02-25 5:39 ` [PATCH] x86_64: make amd quad core 8 socket system not be clustered_box v2 Yinghai Lu
2008-02-25 19:08 ` Ravikiran Thirumalai
2008-02-25 22:05 ` Yinghai Lu
2008-02-26 3:39 ` Ravikiran Thirumalai
2008-02-26 3:46 ` Andi Kleen
2008-02-26 4:05 ` Ravikiran Thirumalai
2008-02-26 5:27 ` Yinghai Lu
2008-02-26 18:42 ` Ravikiran Thirumalai
2008-02-26 19:00 ` Yinghai Lu
2008-02-26 20:32 ` Ravikiran Thirumalai
2008-02-26 21:09 ` Yinghai Lu
2008-02-26 21:10 ` Yinghai Lu
2008-02-26 21:24 ` Ravikiran Thirumalai
2008-02-26 23:16 ` Yinghai Lu
2008-02-26 23:31 ` Ravikiran Thirumalai
2008-02-26 23:41 ` Yinghai Lu
2008-02-22 19:08 ` [PATCH] x86_64: make amd quad core 8 socket system not be clustered_box Yinghai Lu
2008-02-22 18:59 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0802290509100.2723@scrub.home \
--to=zippel@linux-m68k.org \
--cc=Yinghai.Lu@Sun.COM \
--cc=akpm@linux-foundation.org \
--cc=gcosta@redhat.com \
--cc=kiran@scalemp.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=sam@ravnborg.org \
--cc=shai@scalemp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®