Make sparse return 1 if errors occurred
RFC PATCH 1/1 Make sparse return 1 if errors occurred
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 <[email protected]>
--- 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(-)
lib.c +2 -2
@@ -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 ;
lib.h +1 -1
@@ -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;
sparse.c +1 -1
@@ -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; }
validation/bad-array-designated-initializer.c +0 -2
@@ -12,6 +12,4 @@ bad-array-designated-initializer.c:3:3: error: Expected constant expressionbad-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 */
validation/bad-assignment.c +0 -2
@@ -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 */
validation/preprocessor/preprocessor18.c +0 -2
@@ -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 */
validation/preprocessor/preprocessor21.c +0 -2
@@ -11,6 +11,4 @@ preprocessor/preprocessor21.c:2:2: error: unterminated preprocessor conditional* check-output-end -* -* check-known-to-fail */
Signature · 1 line
1.5.2.3