summaryrefslogtreecommitdiff
path: root/gcc/c-semantics.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-04 21:03:20 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-04 21:03:20 +0000
commit4e3da2396b7b11d2d03b45e4bfd1096b07792403 (patch)
tree39b333f5be357db96e4a98270b060aeefbef3de7 /gcc/c-semantics.c
parent236804177128b520cfb3fe5a23abfbaa9f59d5da (diff)
downloadgcc-4e3da2396b7b11d2d03b45e4bfd1096b07792403.tar.gz
* tree.h (expand_expr_stmt_value): Add maybe_last argument.
* c-common.h (genrtl_expr_stmt_value): Likewise. * stmt.c (expand_expr_stmt): Pass 1 as maybe_last. (expand_expr_stmt_value): Add maybe_last argument. Don't warn about statement with no effect if it is the last statement in expression statement. * c-semantics.c (genrtl_expr_stmt): Pass 1 as maybe_last. (genrtl_expr_stmt_value): Add maybe_last argument, pass it down to expand_expr_stmt_value. (expand_stmt) [EXPR_STMT]: Pass 1 as maybe_last to genrtl_expr_stmt_value if t is the last EXPR_STMT in its scope. * expr.c (expand_expr) [LABELED_BLOCK_EXPR, LOOP_EXPR]: Pass 1 as maybe_last to expand_expr_stmt_value. * gcc.dg/20020104-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48541 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-semantics.c')
-rw-r--r--gcc/c-semantics.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c
index ef9ba333751..4bab4d3aaa6 100644
--- a/gcc/c-semantics.c
+++ b/gcc/c-semantics.c
@@ -313,18 +313,20 @@ void
genrtl_expr_stmt (expr)
tree expr;
{
- genrtl_expr_stmt_value (expr, -1);
+ genrtl_expr_stmt_value (expr, -1, 1);
}
/* Generate the RTL for EXPR, which is an EXPR_STMT. WANT_VALUE tells
whether to (1) save the value of the expression, (0) discard it or
(-1) use expr_stmts_for_value to tell. The use of -1 is
- deprecated, and retained only for backward compatibility. */
+ deprecated, and retained only for backward compatibility.
+ MAYBE_LAST is non-zero if this EXPR_STMT might be the last statement
+ in expression statement. */
void
-genrtl_expr_stmt_value (expr, want_value)
+genrtl_expr_stmt_value (expr, want_value, maybe_last)
tree expr;
- int want_value;
+ int want_value, maybe_last;
{
if (expr != NULL_TREE)
{
@@ -334,7 +336,7 @@ genrtl_expr_stmt_value (expr, want_value)
expand_start_target_temps ();
if (expr != error_mark_node)
- expand_expr_stmt_value (expr, want_value);
+ expand_expr_stmt_value (expr, want_value, maybe_last);
if (stmts_are_full_exprs_p ())
expand_end_target_temps ();
@@ -763,7 +765,10 @@ expand_stmt (t)
break;
case EXPR_STMT:
- genrtl_expr_stmt_value (EXPR_STMT_EXPR (t), TREE_ADDRESSABLE (t));
+ genrtl_expr_stmt_value (EXPR_STMT_EXPR (t), TREE_ADDRESSABLE (t),
+ TREE_CHAIN (t) == NULL
+ || (TREE_CODE (TREE_CHAIN (t)) == SCOPE_STMT
+ && TREE_CHAIN (TREE_CHAIN (t)) == NULL));
break;
case DECL_STMT: