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
This commit is contained in:
Nathan Sidwell 1999-11-22 16:08:14 +00:00 committed by Nathan Sidwell
parent 7cffd12d38
commit 88b4335f8a
3 changed files with 17 additions and 17 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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);
}