+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.
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;
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");
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);
}
\f