diff options
author | Paul Eggert <eggert@twinsun.com> | 1997-09-27 03:46:35 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1997-09-26 21:46:35 -0600 |
commit | 407cb092e3216d372d9fa3120e531829448f0bbc (patch) | |
tree | 9364040c5ea8353e79b03373275054360d7f64c3 /gcc | |
parent | 3ba104945bc26252fbe5bb6cbeb67a5a33cf90f2 (diff) | |
download | gcc-407cb092e3216d372d9fa3120e531829448f0bbc.zip gcc-407cb092e3216d372d9fa3120e531829448f0bbc.tar.gz gcc-407cb092e3216d372d9fa3120e531829448f0bbc.tar.bz2 |
c-typeck.c (build_binary_op): Warn about comparing signed vs unsigned if...
* c-typeck.c (build_binary_op): Warn about comparing signed vs
unsigned if -W is specified and -Wno-sign-compare is not.
* c-decl.c (warn_sign_compare): Initialize to -1.
(c_decode_option): -Wall no longer implies -Wsign-compare.
From-SVN: r15739
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-decl.c | 6 | ||||
-rw-r--r-- | gcc/c-typeck.c | 3 |
3 files changed, 12 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1a4439d..993df97 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +Fri Sep 26 08:54:59 1997 Paul Eggert <eggert@twinsun.com> + + * c-typeck.c (build_binary_op): Warn about comparing signed vs + unsigned if -W is specified and -Wno-sign-compare is not. + * c-decl.c (warn_sign_compare): Initialize to -1. + (c_decode_option): -Wall no longer implies -Wsign-compare. + Fri Sep 26 09:00:13 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * integrate.c (expand_inline_function): Make sure there is at diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 94dc196..09143e4 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -553,9 +553,10 @@ int warn_missing_braces; int warn_main; -/* Warn about comparison of signed and unsigned values. */ +/* Warn about comparison of signed and unsigned values. + If -1, neither -Wsign-compare nor -Wno-sign-compare has been specified. */ -int warn_sign_compare; +int warn_sign_compare = -1; /* Nonzero means `$' can be in an identifier. */ @@ -758,7 +759,6 @@ c_decode_option (p) warn_char_subscripts = 1; warn_parentheses = 1; warn_missing_braces = 1; - warn_sign_compare = 1; /* We set this to 2 here, but 1 in -Wmain, so -ffreestanding can turn it off only if it's not explicit. */ warn_main = 2; diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index b3b0f10..22843ae 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -2477,7 +2477,8 @@ build_binary_op (code, orig_op0, orig_op1, convert_p) converted = 1; resultcode = xresultcode; - if (warn_sign_compare && skip_evaluation == 0) + if ((warn_sign_compare < 0 ? extra_warnings : warn_sign_compare != 0) + && skip_evaluation == 0) { int op0_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op0)); int op1_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op1)); |