OSDN Git Service

* cp-tree.h (finish_function): Adjust prototype.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Sep 1999 08:52:07 +0000 (08:52 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Sep 1999 08:52:07 +0000 (08:52 +0000)
* decl.c (finish_function): Return the function compiled.
* pt.c (instantiate_decl): Don't play games with obstacks.
* tree.c (mapcar): Handle OFFSET_REF and BIT_FIELD_REF.
(search_tree): Likewise.
* typeck.c: Fix typo in comment.
* typeck2.c (store_init_value): Add comment.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29261 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/pt.c
gcc/cp/tree.c
gcc/cp/typeck.c
gcc/cp/typeck2.c

index a35da1f..dd88d1a 100644 (file)
@@ -3205,7 +3205,7 @@ extern int start_function                 PROTO((tree, tree, tree, int));
 extern void expand_start_early_try_stmts       PROTO((void));
 extern void store_parm_decls                   PROTO((void));
 extern void store_return_init                  PROTO((tree));
-extern void finish_function                    PROTO((int, int));
+extern tree finish_function                    PROTO((int, int));
 extern tree start_method                       PROTO((tree, tree, tree));
 extern tree finish_method                      PROTO((tree));
 extern void hack_incomplete_structures         PROTO((tree));
index 21d88ae..40f691c 100644 (file)
@@ -13481,7 +13481,7 @@ store_return_init (decl)
        function definition.  (This processing will have taken place
        after the class definition is complete.)  */
 
-void
+tree
 finish_function (lineno, flags)
      int lineno;
      int flags;
@@ -13500,7 +13500,7 @@ finish_function (lineno, flags)
   /* When we get some parse errors, we can end up without a
      current_function_decl, so cope.  */
   if (fndecl == NULL_TREE)
-    return;
+    return error_mark_node;
 
   nested = function_depth > 1;
   fntype = TREE_TYPE (fndecl);
@@ -14083,6 +14083,7 @@ finish_function (lineno, flags)
   if (DECL_STATIC_DESTRUCTOR (fndecl))
     static_dtors = tree_cons (NULL_TREE, fndecl, static_dtors);
 
+  /* Clean up.  */
   if (! nested)
     {
       /* Let the error reporting routines know that we're outside a
@@ -14090,6 +14091,8 @@ finish_function (lineno, flags)
          pop_cp_function_context and then reset via pop_function_context.  */
       current_function_decl = NULL_TREE;
     }
+
+  return fndecl;
 }
 \f
 /* Create the FUNCTION_DECL for a function definition.
index 9fd1f2f..8af26e5 100644 (file)
@@ -9689,34 +9689,16 @@ instantiate_decl (d)
     }
   else if (TREE_CODE (d) == FUNCTION_DECL)
     {
-      extern struct obstack *saveable_obstack;
-      extern struct obstack *rtl_obstack;
-
       /* Set up context.  */
       start_function (NULL_TREE, d, NULL_TREE, SF_PRE_PARSED);
       store_parm_decls ();
 
-      /* Anything we might
-        want to save is going to have to be saved forever.  Note that
-        we don't want to save all kinds of temporary clutter that
-        might end up on the temporary obstack so we don't want to
-        call push_permanent_obstack.  */
-      push_obstacks_nochange ();
-      saveable_obstack = &permanent_obstack;
-      /* We only need this because of the cases where we generate
-        RTL_EXPRs.  We should really be generating RTL_EXPRs until
-        final expansion time; when that is fixed, this can go.  */
-      rtl_obstack = &permanent_obstack;
       /* Substitute into the body of the function.  */
       tsubst_expr (DECL_SAVED_TREE (code_pattern), args,
                   /*complain=*/1, tmpl);
 
-      /* Clean up.  */
-      pop_obstacks ();
-      finish_function (lineno, 0);
-
-      /* Now, generate RTL for the function.  */
-      expand_body (d);
+      /* Finish the function.  */
+      expand_body (finish_function (lineno, 0));
     }
 
 out:
index 2cb6721..9cf2ae7 100644 (file)
@@ -1652,6 +1652,7 @@ search_tree (t, func)
     case COMPOUND_EXPR:
     case MODIFY_EXPR:
     case INIT_EXPR:
+    case OFFSET_REF:
       TRY (TREE_OPERAND (t, 0));
       TRY (TREE_OPERAND (t, 1));
       break;
@@ -1666,6 +1667,7 @@ search_tree (t, func)
     case THROW_EXPR:
     case EXIT_EXPR:
     case LOOP_EXPR:
+    case BIT_FIELD_REF:
       TRY (TREE_OPERAND (t, 0));
       break;
 
@@ -1917,6 +1919,7 @@ mapcar (t, func)
     case COMPOUND_EXPR:
     case MODIFY_EXPR:
     case INIT_EXPR:
+    case OFFSET_REF:
       t = copy_node (t);
       TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
       TREE_OPERAND (t, 1) = mapcar (TREE_OPERAND (t, 1), func);
@@ -1999,6 +2002,14 @@ mapcar (t, func)
       TREE_OPERAND (t, 2) = mapcar (TREE_OPERAND (t, 2), func);
       return t;
 
+    case BIT_FIELD_REF:
+      t = copy_node (t);
+      TREE_TYPE (t) = mapcar (TREE_TYPE (t), func);
+      TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
+      TREE_OPERAND (t, 1) = mapcar (TREE_OPERAND (t, 1), func);
+      TREE_OPERAND (t, 2) = mapcar (TREE_OPERAND (t, 2), func);
+      return t;
+      
     case LOOKUP_EXPR:
     case EXIT_EXPR:
     case LOOP_EXPR:
index 506103b..195877c 100644 (file)
@@ -64,7 +64,7 @@ static int comp_cv_target_types PROTO((tree, tree, int));
 static void casts_away_constness_r PROTO((tree *, tree *));
 static int casts_away_constness PROTO ((tree, tree));
 
-/* Return the target type of TYPE, which meas return T for:
+/* Return the target type of TYPE, which means return T for:
    T*, T&, T[], T (...), and otherwise, just T.  */
 
 tree
index 1e7c402..1374c79 100644 (file)
@@ -496,6 +496,10 @@ store_init_value (decl, init)
        }
     }
 #endif
+  
+  /* Store the VALUE in DECL_INITIAL.  If we're building a
+     statement-tree we will actually expand the initialization later
+     when we output this function.  */
   DECL_INITIAL (decl) = value;
   return NULL_TREE;
 }