summaryrefslogtreecommitdiff
path: root/gcc/c-semantics.c
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-02 02:31:58 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-02 02:31:58 +0000
commitd513ec2fc05379653f96d366084f37adac5be1d9 (patch)
tree88f850f8f5e7beb19776302640e41667d82628ef /gcc/c-semantics.c
parentb15047d0d2b0db6ac7af8eddd869c05164da07f5 (diff)
downloadgcc-d513ec2fc05379653f96d366084f37adac5be1d9.tar.gz
* c-common.h (genrtl_expr_stmt_value): Declare.
* c-semantics.c (genrtl_goto_stmt): Redirect to... (genrtl_goto_stmt_value): ... this new function. Pass new argument down to expand_expr_stmt_value, taking TREE_ADDRESSABLE into account. * c-common.c (c_expand_expr): Mark the last EXPR_STMT of a STMT_EXPR as addressable, i.e., one whose result we want. * expr.c (expand_expr): Don't save expression statement value of labeled_blocks or loop_exprs. * stmt.c (expand_expr_stmt): Redirect to... (expand_expr_stmt_value): ... this new function. Use new argument to tell whether to save expression value. (expand_end_stmt_expr): Reset last_expr_type and last_expr_value if we don't have either. * tree-inline.c (declare_return_variable): Mark its use statement as addressable. * tree.h: Document new use of TREE_ADDRESSABLE. (expand_expr_stmt_value): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48456 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-semantics.c')
-rw-r--r--gcc/c-semantics.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c
index 86e2e8999bb..ef9ba333751 100644
--- a/gcc/c-semantics.c
+++ b/gcc/c-semantics.c
@@ -1,7 +1,7 @@
/* This file contains the definitions and documentation for the common
tree codes used in the GNU C and C++ compilers (see c-common.def
for the standard codes).
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Benjamin Chelf (chelf@codesourcery.com).
This file is part of GCC.
@@ -305,12 +305,27 @@ genrtl_goto_stmt (destination)
expand_computed_goto (destination);
}
-/* Generate the RTL for EXPR, which is an EXPR_STMT. */
+/* Generate the RTL for EXPR, which is an EXPR_STMT. Provided just
+ for backward compatibility. genrtl_expr_stmt_value() should be
+ used for new code. */
-void
+void
genrtl_expr_stmt (expr)
tree expr;
{
+ genrtl_expr_stmt_value (expr, -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. */
+
+void
+genrtl_expr_stmt_value (expr, want_value)
+ tree expr;
+ int want_value;
+{
if (expr != NULL_TREE)
{
emit_line_note (input_filename, lineno);
@@ -319,7 +334,7 @@ genrtl_expr_stmt (expr)
expand_start_target_temps ();
if (expr != error_mark_node)
- expand_expr_stmt (expr);
+ expand_expr_stmt_value (expr, want_value);
if (stmts_are_full_exprs_p ())
expand_end_target_temps ();
@@ -748,7 +763,7 @@ expand_stmt (t)
break;
case EXPR_STMT:
- genrtl_expr_stmt (EXPR_STMT_EXPR (t));
+ genrtl_expr_stmt_value (EXPR_STMT_EXPR (t), TREE_ADDRESSABLE (t));
break;
case DECL_STMT: