linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] Make sparse return 1 if errors occurred
@ 2007-07-14 20:51 Josh Triplett
  0 siblings, 0 replies; only message in thread
From: Josh Triplett @ 2007-07-14 20:51 UTC (permalink / raw)
  To: linux-sparse

[-- Attachment #1: Type: text/plain, Size: 3729 bytes --]

Sparse always returned 0.  Change it to return 1 if errors occurred, and
remove check-known-to-fail from tests that expected that behavior.

Also rename the misleadingly named global die_if_error to had_errors.

Signed-off-by: Josh Triplett <josh@freedesktop.org>
---
 lib.c                                         |    4 ++--
 lib.h                                         |    2 +-
 sparse.c                                      |    2 +-
 validation/bad-array-designated-initializer.c |    2 --
 validation/bad-assignment.c                   |    2 --
 validation/preprocessor/preprocessor18.c      |    2 --
 validation/preprocessor/preprocessor21.c      |    2 --
 7 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/lib.c b/lib.c
index a1442a2..be1aca4 100644
--- a/lib.c
+++ b/lib.c
@@ -29,7 +29,7 @@
 #include "target.h"
 
 int verbose, optimize, optimize_size, preprocessing;
-int die_if_error = 0;
+int had_errors = 0;
 
 #ifndef __GNUC__
 # define __GNUC__ 2
@@ -129,7 +129,7 @@ void warning(struct position pos, const char * fmt, ...)
 static void do_error(struct position pos, const char * fmt, va_list args)
 {
 	static int errors = 0;
-        die_if_error = 1;
+	had_errors = 1;
 	show_info = 1;
 	/* Shut up warnings after an error */
 	max_warnings = 0;
diff --git a/lib.h b/lib.h
index aacafea..a5e9f8e 100644
--- a/lib.h
+++ b/lib.h
@@ -18,7 +18,7 @@
 #include "ptrlist.h"
 
 extern int verbose, optimize, optimize_size, preprocessing;
-extern int die_if_error;
+extern int had_errors;
 extern int repeat_phase, merge_phi_sources;
 extern int gcc_major, gcc_minor, gcc_patchlevel;
 
diff --git a/sparse.c b/sparse.c
index 4026ba7..2f74194 100644
--- a/sparse.c
+++ b/sparse.c
@@ -283,5 +283,5 @@ int main(int argc, char **argv)
 	FOR_EACH_PTR_NOTAG(filelist, file) {
 		check_symbols(sparse(file));
 	} END_FOR_EACH_PTR_NOTAG(file);
-	return 0;
+	return had_errors;
 }
diff --git a/validation/bad-array-designated-initializer.c b/validation/bad-array-designated-initializer.c
index ecc5bd3..75e8a10 100644
--- a/validation/bad-array-designated-initializer.c
+++ b/validation/bad-array-designated-initializer.c
@@ -12,6 +12,4 @@ bad-array-designated-initializer.c:3:3: error: Expected constant expression
 bad-array-designated-initializer.c:3:3: error: Expected } at end of initializer
 bad-array-designated-initializer.c:3:3: error: got \
  * check-output-end
- *
- * check-known-to-fail
  */
diff --git a/validation/bad-assignment.c b/validation/bad-assignment.c
index 66f6fe8..f876076 100644
--- a/validation/bad-assignment.c
+++ b/validation/bad-assignment.c
@@ -13,6 +13,4 @@ static int foo(int a)
 bad-assignment.c:3:6: error: Expected ; at end of statement
 bad-assignment.c:3:6: error: got \
  * check-output-end
- *
- * check-known-to-fail
  */
diff --git a/validation/preprocessor/preprocessor18.c b/validation/preprocessor/preprocessor18.c
index b4de1e6..b864010 100644
--- a/validation/preprocessor/preprocessor18.c
+++ b/validation/preprocessor/preprocessor18.c
@@ -12,6 +12,4 @@ preprocessor/preprocessor18.c:2:2: error: expected identifier to 'define'
 preprocessor/preprocessor18.c:3:2: error: expected identifier to 'undef'
 
  * check-output-end
- *
- * check-known-to-fail
  */
diff --git a/validation/preprocessor/preprocessor21.c b/validation/preprocessor/preprocessor21.c
index 1719fc0..ce62dbb 100644
--- a/validation/preprocessor/preprocessor21.c
+++ b/validation/preprocessor/preprocessor21.c
@@ -11,6 +11,4 @@ preprocessor/preprocessor21.c:2:2: error: unterminated preprocessor conditional
 
 
  * check-output-end
- *
- * check-known-to-fail
  */
-- 
1.5.2.3



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

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

only message in thread, other threads:[~2007-07-14 20:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-14 20:51 [RFC PATCH] Make sparse return 1 if errors occurred Josh Triplett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).