From b0832fe1f38ce3553cb4d3b91b4821565c9d0d36 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 4 Jan 2002 22:03:20 +0100 Subject: tree.h (expand_expr_stmt_value): Add maybe_last argument. * 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. From-SVN: r48541 --- gcc/c-semantics.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'gcc/c-semantics.c') 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: -- cgit v1.2.1