* stmt.c (warn_if_unused_value): Don't warn if the expression
has side effects.
From-SVN: r37448
2000-11-14 Richard Henderson <rth@redhat.com>
+ * stmt.c (warn_if_unused_value): Don't warn if the expression
+ has side effects.
+
* c-typeck.c (c_sizeof): Fold result to c_size_type_node.
(c_sizeof_nowarn, c_alignof, c_alignof_expr): Likewise.
case TRY_CATCH_EXPR:
case WITH_CLEANUP_EXPR:
case EXIT_EXPR:
- /* We don't warn about COND_EXPR because it may be a useful
- construct if either arm contains a side effect. */
- case COND_EXPR:
return 0;
case BIND_EXPR:
&& TREE_THIS_VOLATILE (exp))
return 0;
+ /* If this is an expression with side effects, don't warn. */
+ if (TREE_SIDE_EFFECTS (exp))
+ return 0;
+
/* If this is an expression which has no operands, there is no value
to be unused. There are no such language-independent codes,
but front ends may define such. */