diff options
author | Nathan Sidwell <nathan@acm.org> | 1999-11-22 16:08:14 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 1999-11-22 16:08:14 +0000 |
commit | 88b4335f8a21d7f6e9c3f1bb8b39788170123a1c (patch) | |
tree | c67803277cb59f65eeb8f454e32b4955ff881bdc | |
parent | 7cffd12d38191aa05ef9049d80d4714d6e52711a (diff) | |
download | gcc-88b4335f8a21d7f6e9c3f1bb8b39788170123a1c.zip gcc-88b4335f8a21d7f6e9c3f1bb8b39788170123a1c.tar.gz gcc-88b4335f8a21d7f6e9c3f1bb8b39788170123a1c.tar.bz2 |
semantics.c (finish_unary_op_expr): Only set TREE_NEGATED_INT when actually negative.
* semantics.c (finish_unary_op_expr): Only set TREE_NEGATED_INT
when actually negative.
* typeck.c (convert_for_assignment): Expand comment about
strange NULL check, moved from ...
(convert_for_initialization): ... here. Remove unneeded
code.
From-SVN: r30616
-rw-r--r-- | gcc/cp/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 4 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 20 |
3 files changed, 17 insertions, 17 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 298bab7..c2f9d74 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +1999-11-22 Nathan Sidwell <nathan@acm.org> + + * semantics.c (finish_unary_op_expr): Only set TREE_NEGATED_INT + when actually negative. + + * typeck.c (convert_for_assignment): Expand comment about + strange NULL check, moved from ... + (convert_for_initialization): ... here. Remove unneeded + code. + 1999-11-21 Alexandre Oliva <oliva@lsd.ic.unicamp.br> * cp-tree.h (build_vec_delete): Remove `auto_delete' argument. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 0f201f6..741f710 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1598,7 +1598,9 @@ finish_unary_op_expr (code, expr) expression. So check whether the result is folded before setting TREE_NEGATED_INT. */ if (code == NEGATE_EXPR && TREE_CODE (expr) == INTEGER_CST - && TREE_CODE (result) == INTEGER_CST) + && TREE_CODE (result) == INTEGER_CST + && !TREE_UNSIGNED (TREE_TYPE (result)) + && INT_CST_LT (result, integer_zero_node)) TREE_NEGATED_INT (result) = 1; overflow_warning (result); return result; diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index dc6c9c9..ec2f606 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -6390,7 +6390,10 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum) if (TREE_CODE (rhs) == TREE_LIST && TREE_VALUE (rhs) == error_mark_node) return error_mark_node; - /* Issue warnings about peculiar, but legal, uses of NULL. */ + /* Issue warnings about peculiar, but legal, uses of NULL. We + do this *before* the call to decl_constant_value so as to + avoid duplicate warnings on code like `const int I = NULL; + f(I);'. */ if (ARITHMETIC_TYPE_P (type) && rhs == null_node) cp_warning ("converting NULL to non-pointer type"); @@ -6567,21 +6570,6 @@ convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum) if (IS_AGGR_TYPE (type)) return ocp_convert (type, rhs, CONV_IMPLICIT|CONV_FORCE_TEMP, flags); - if (type == TREE_TYPE (rhs)) - { - /* Issue warnings about peculiar, but legal, uses of NULL. We - do this *before* the call to decl_constant_value so as to - avoid duplicate warnings on code like `const int I = NULL; - f(I);'. */ - if (ARITHMETIC_TYPE_P (type) && rhs == null_node) - cp_warning ("converting NULL to non-pointer type"); - - if (TREE_READONLY_DECL_P (rhs)) - rhs = decl_constant_value (rhs); - - return rhs; - } - return convert_for_assignment (type, rhs, errtype, fndecl, parmnum); } |