diff options
author | Christopher Li <sparse@chrisli.org> | 2014-10-10 22:37:07 +0800 |
---|---|---|
committer | Christopher Li <sparse@chrisli.org> | 2014-10-10 22:43:02 +0800 |
commit | fe57afa0b44a5f49046cf1ac84040bcf172b8fa8 (patch) | |
tree | 5454f42d431e3702b7a58beb1bcdec0214420332 | |
parent | 4d8811879a1cc48c1cdd0b0466dc6865c715d149 (diff) | |
download | sparse-fe57afa0b44a5f49046cf1ac84040bcf172b8fa8.tar.gz |
rename -Werror to -Wsparse-error
Sparse is often share compile flags. So Werror is usually
mean gcc should treat warning as error. Apply the same
option to sparse will cause the Linux kernel checking fail
the build. We don't want that.
Rename the sparse option to -Wsparse-error. It allow caller
to control gcc and sparse behavior seperately.
It also make sparse return error status only when -Wsparse-error
is present.
Signed-off-by: Christopher Li <sparse@chrisli.org>
-rw-r--r-- | lib.c | 8 | ||||
-rw-r--r-- | lib.h | 2 | ||||
-rw-r--r-- | sparse.1 | 2 | ||||
-rw-r--r-- | sparse.c | 2 | ||||
-rwxr-xr-x | validation/test-suite | 7 |
5 files changed, 8 insertions, 13 deletions
@@ -150,7 +150,7 @@ void warning(struct position pos, const char * fmt, ...) { va_list args; - if (Werror) { + if (Wsparse_error) { va_start(args, fmt); do_error(pos, fmt, args); va_end(args); @@ -226,7 +226,7 @@ int Wdesignated_init = 1; int Wdo_while = 0; int Winit_cstring = 0; int Wenum_mismatch = 1; -int Werror = 0; +int Wsparse_error = 0; int Wnon_pointer_null = 1; int Wold_initializer = 1; int Wone_bit_signed_bitfield = 1; @@ -439,7 +439,7 @@ static const struct warning { { "designated-init", &Wdesignated_init }, { "do-while", &Wdo_while }, { "enum-mismatch", &Wenum_mismatch }, - { "error", &Werror }, + { "sparse-error", &Wsparse_error }, { "init-cstring", &Winit_cstring }, { "non-pointer-null", &Wnon_pointer_null }, { "old-initializer", &Wold_initializer }, @@ -471,7 +471,7 @@ static char **handle_onoff_switch(char *arg, char **next, const struct warning w if (!strcmp(p, "sparse-all")) { for (i = 0; i < n; i++) { - if (*warnings[i].flag != WARNING_FORCE_OFF && warnings[i].flag != &Werror) + if (*warnings[i].flag != WARNING_FORCE_OFF && warnings[i].flag != &Wsparse_error) *warnings[i].flag = WARNING_ON; } } @@ -112,7 +112,7 @@ extern int Wdefault_bitfield_sign; extern int Wdesignated_init; extern int Wdo_while; extern int Wenum_mismatch; -extern int Werror; +extern int Wsparse_error; extern int Winit_cstring; extern int Wnon_pointer_null; extern int Wold_initializer; @@ -24,7 +24,7 @@ off those warnings, pass the negation of the associated warning option, Turn on all sparse warnings, except for those explicitly disabled via \fB\-Wno\-something\fR. .TP -.B \-Werror +.B \-Wsparse\-error Turn all sparse warnings into errors. .TP .B \-Waddress\-space @@ -288,7 +288,7 @@ static void check_symbols(struct symbol_list *list) } } END_FOR_EACH_PTR(sym); - if (die_if_error) + if (Wsparse_error && die_if_error) exit(1); } diff --git a/validation/test-suite b/validation/test-suite index 61667a56..744383dc 100755 --- a/validation/test-suite +++ b/validation/test-suite @@ -117,12 +117,7 @@ do_test() if [ "$?" -eq "0" ]; then expected_exit_value=`echo $last_result | tr -d ' '` else - grep -q -E "^[^:]+:[[:digit:]]+:[[:digit:]]+: error:" "$file".error.expected - if [ "$?" -eq "0" ]; then - expected_exit_value=1 - else - expected_exit_value=0 - fi + expected_exit_value=0 fi verbose "Expecting exit value: $expected_exit_value" |