public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: linux-kbuild <linux-kbuild@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Roman Zippel <zippel@linux-m68k.org>
Subject: [PATCH 1/2] kconfig: print all locations when we see a recursive dependency
Date: Sat, 27 Dec 2008 21:58:07 +0100	[thread overview]
Message-ID: <20081227205807.GB16609@uranus.ravnborg.org> (raw)
In-Reply-To: <20081227090339.GA6279@uranus.ravnborg.org>

From 7e9617872fe81a9515e8ce22c9ece8bd1e905b4c Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Sat, 27 Dec 2008 21:25:29 +0100
Subject: [PATCH 1/2] kconfig: print all locations when we see a recursive dependency

It is nessesary to know all locations when trying to track
a recursive dependency. So print out all locations for each symbol.

Sample output:
Kconfig:1: found recursive dependency:
            TEST1
         -> TEST2 (Kconfig:4),(Kconfig:12)
         -> TEST1 (Kconfig:1),(Kconfig:7)

In a more complex example the symbols can be defined in different
files thus making it harder to track.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
 scripts/kconfig/symbol.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 474dae2..fc62f34 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -790,6 +790,21 @@ static struct symbol *sym_check_expr_deps(struct expr *e)
 	return NULL;
 }
 
+static void print_symbol_location(struct symbol *sym)
+{
+	struct property *prop;
+	int comma = 0;
+
+	fprintf(stderr, "\t -> %s ", sym->name ? sym->name : "<choice>");
+	for (prop = sym->prop; prop; prop = prop->next) {
+		if (prop->type == P_SYMBOL) {
+			fprintf(stderr, "%s(%s:%d)",
+			comma ? "," : "", prop->file->name, prop->lineno);
+			comma = 1;
+		}
+	}
+	fprintf(stderr, "\n");
+}
 /* return NULL when dependencies are OK */
 static struct symbol *sym_check_sym_deps(struct symbol *sym)
 {
@@ -835,7 +850,7 @@ static struct symbol *sym_check_choice_deps(struct symbol *choice)
 	expr_list_for_each_sym(prop->expr, e, sym) {
 		sym2 = sym_check_sym_deps(sym);
 		if (sym2) {
-			fprintf(stderr, " -> %s", sym->name);
+			print_symbol_location(sym);
 			break;
 		}
 	}
@@ -856,7 +871,7 @@ struct symbol *sym_check_deps(struct symbol *sym)
 	struct property *prop;
 
 	if (sym->flags & SYMBOL_CHECK) {
-		fprintf(stderr, "%s:%d:error: found recursive dependency:\n",
+		fprintf(stderr, "%s:%d: found recursive dependency:\n",
 		        sym->prop->file->name, sym->prop->lineno);
 		fprintf(stderr, "\t    %s\n",
 			sym->name ? sym->name : "<choice>");
@@ -878,11 +893,8 @@ struct symbol *sym_check_deps(struct symbol *sym)
 	}
 
 	if (sym2) {
-		fprintf(stderr, "\t -> %s (%s:%d)\n",
-		        sym->name ? sym->name : "<choice>",
-			sym->prop->file->name, sym->prop->lineno);
+		print_symbol_location(sym);
 		if (sym2 == sym) {
-			fprintf(stderr, "\n");
 			zconfnerrs++;
 			sym2 = NULL;
 		}
-- 
1.6.0.2.GIT


  parent reply	other threads:[~2008-12-27 20:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-27  9:03 Improve dependency checks in kconfig Sam Ravnborg
2008-12-27  9:24 ` [PATCH 1/4] kconfig: explain symbol value defaults Sam Ravnborg
2008-12-27  9:24 ` [PATCH 2/4] kconfig: add comments to symbol flags Sam Ravnborg
2008-12-27  9:24 ` [PATCH 3/4] kconfig: struct property commented Sam Ravnborg
2008-12-27  9:24 ` [PATCH 4/4] kconfig: improve readout when we hit recursive dependencies Sam Ravnborg
2008-12-27 20:57 ` Improve dependency checks in kconfig Sam Ravnborg
2008-12-27 20:58 ` Sam Ravnborg [this message]
2008-12-27 20:58 ` [PATCH 2/2] kconfig: improve error messages for bad source statements Sam Ravnborg

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=20081227205807.GB16609@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zippel@linux-m68k.org \
    /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