All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sparse_error() should not silence info() after sparse_error()s
@ 2006-08-25 21:27 Josh Triplett
  0 siblings, 0 replies; only message in thread
From: Josh Triplett @ 2006-08-25 21:27 UTC (permalink / raw)
  To: linux-sparse; +Cc: Adam DiCarlo

sparse_error() sets max_warnings = 0 to silence subsequent sparse_warning()s
or info()s; however, this also silences the info() after that sparse_error()
and subsequent sparse_errors() which still get shown.  bad_expr_type runs into
this problem: it reports an error with sparse_error() and then provides
further information with info(), which the user never sees.  Make info()
continue to print as long as the immediately preceeding warning or error does.

Thanks to Adam DiCarlo <adam.dicarlo@gmail.com> for reporting the problem.

Signed-off-by: Josh Triplett <josh@freedesktop.org>
Cc: Adam DiCarlo <adam.dicarlo@gmail.com>
---
 lib.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib.c b/lib.c
index feb755a..05ed848 100644
--- a/lib.c
+++ b/lib.c
@@ -94,12 +94,13 @@ static void do_warn(const char *type, st
 }
 
 static int max_warnings = 100;
+static int show_info = 1;
 
 void info(struct position pos, const char * fmt, ...)
 {
 	va_list args;
 
-	if (!max_warnings)
+	if (!show_info)
 		return;
 	va_start(args, fmt);
 	do_warn("", pos, fmt, args);
@@ -110,11 +111,15 @@ void warning(struct position pos, const 
 {
 	va_list args;
 
-	if (!max_warnings)
+	if (!max_warnings) {
+		show_info = 0;
 		return;
+	}
 
-	if (!--max_warnings)
+	if (!--max_warnings) {
+		show_info = 0;
 		fmt = "too many warnings";
+	}
 
 	va_start(args, fmt);
 	do_warn("warning: ", pos, fmt, args);
@@ -126,10 +131,12 @@ void sparse_error(struct position pos, c
 	static int errors = 0;
 	va_list args;
         die_if_error = 1;
+	show_info = 1;
 	/* Shut up warnings after an error */
 	max_warnings = 0;
 	if (errors > 100) {
 		static int once = 0;
+		show_info = 0;
 		if (once)
 			return;
 		fmt = "too many errors";

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-08-25 21:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-25 21:27 [PATCH] sparse_error() should not silence info() after sparse_error()s Josh Triplett

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.