OSDN Git Service

no xfail
[pf3gnuchains/gcc-fork.git] / gcc / c-semantics.c
index 6da71b3..4bab4d3 100644 (file)
@@ -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.
@@ -170,19 +170,12 @@ finish_stmt_tree (t)
 tree
 build_stmt VPARAMS ((enum tree_code code, ...))
 {
-#ifndef ANSI_PROTOTYPES
-  enum tree_code code;
-#endif
-  va_list p;
-  register tree t;
-  register int length;
-  register int i;
-
-  VA_START (p, code);
+  tree t;
+  int length;
+  int i;
 
-#ifndef ANSI_PROTOTYPES
-  code = va_arg (p, enum tree_code);
-#endif
+  VA_OPEN (p, code);
+  VA_FIXEDARG (p, enum tree_code, code);
 
   t = make_node (code);
   length = TREE_CODE_LENGTH (code);
@@ -191,7 +184,7 @@ build_stmt VPARAMS ((enum tree_code code, ...))
   for (i = 0; i < length; i++)
     TREE_OPERAND (t, i) = va_arg (p, tree);
 
-  va_end (p);
+  VA_CLOSE (p);
   return t;
 }
 
@@ -312,12 +305,29 @@ 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, 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.
+   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, maybe_last)
+     tree expr;
+     int want_value, maybe_last;
+{
   if (expr != NULL_TREE)
     {
       emit_line_note (input_filename, lineno);
@@ -326,7 +336,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, maybe_last);
       
       if (stmts_are_full_exprs_p ())
        expand_end_target_temps ();
@@ -755,7 +765,10 @@ 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),
+                                 TREE_CHAIN (t) == NULL
+                                 || (TREE_CODE (TREE_CHAIN (t)) == SCOPE_STMT
+                                     && TREE_CHAIN (TREE_CHAIN (t)) == NULL));
          break;
 
        case DECL_STMT: