[PATCH RESEND] sparse_error() should not silence info() after sparse_error()s

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Josh Triplett <josh@xxxxxxxxxxxxxxx>
---
 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";
-- 
1.4.1.1


-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux