aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mmitchel@gcc.gnu.org>1999-09-10 08:52:07 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-09-10 08:52:07 +0000
commit4d6abc1c32bb3a815b1899a6a930d4b8a41baa06 (patch)
treeac67db242e37a7870f41e606e2f2d4be9f5bf8ae /gcc
parentf0105ed3b9568fba5d49d279a4bc12546763ad89 (diff)
downloadgcc-4d6abc1c32bb3a815b1899a6a930d4b8a41baa06.zip
gcc-4d6abc1c32bb3a815b1899a6a930d4b8a41baa06.tar.gz
gcc-4d6abc1c32bb3a815b1899a6a930d4b8a41baa06.tar.bz2
cp-tree.h (finish_function): Adjust prototype.
* cp-tree.h (finish_function): Adjust prototype. * 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. From-SVN: r29261
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/decl.c7
-rw-r--r--gcc/cp/pt.c22
-rw-r--r--gcc/cp/tree.c11
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/cp/typeck2.c4
6 files changed, 24 insertions, 24 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index a35da1f..dd88d1a 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -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));
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 21d88ae..40f691c 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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;
}
/* Create the FUNCTION_DECL for a function definition.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 9fd1f2f..8af26e5 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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:
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 2cb6721..9cf2ae7 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -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:
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 506103b..195877c 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 1e7c402..1374c79 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -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;
}