Commit 80048418 by Mark Mitchell Committed by Mark Mitchell

cp-tree.h (begin_new_placement): Remove.

	* cp-tree.h (begin_new_placement): Remove.
	(finish_new_placement): Likewise.
	* class.c (finish_struct_1): Don't suspend_momentary or
	resume_momentary.
	* decl.c (grokdeclarator): Likewise.
	(maybe_build_cleanup_1): Likewise.
	* except.c (push_eh_cleanup): Likewise.
	(build_terminate_handler): Likewise.
	* init.c (build_new_1): Likewise.
	* parse.y (parse_decl): Change prototype.
	(initdecls, notype_initdecls, initdcl): Don't return int.
	(initdcl0, notype_initdcl0, initdcl0_innards): Likewise.
	(.begin_new_placement): Remove.
	(.finish_new_placement): Likewise.
	(nonmomentary_expr): Likewise.
	(suspend_mom): Likewise.
	(condition): Don't suspend_momentary, resume_momentary, or keep
	track of need to resume.
	(unary_expr): Likewise.
	(new_placement): Likewise.
	(decl): Likewise.
	(structsp): Likewise.
	(new_type_id): Likewise.
	(maybe_parmlist): Likewise.
	(direct_after_type_declaration): Likewise.
	(direct_new_declarator): Likewise.
	(direct_abstract_declaration): Likewise.
	* parse.c: Regenerated.
	* pt.c (tsubst_expr): Don't suspend_momentary or resume_momentary.
	* semantics.c (begin_new_placement): Remove.
	(finish_new_placement): Likewise.

From-SVN: r30443
parent 1aecd750
1999-11-07 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (begin_new_placement): Remove.
(finish_new_placement): Likewise.
* class.c (finish_struct_1): Don't suspend_momentary or
resume_momentary.
* decl.c (grokdeclarator): Likewise.
(maybe_build_cleanup_1): Likewise.
* except.c (push_eh_cleanup): Likewise.
(build_terminate_handler): Likewise.
* init.c (build_new_1): Likewise.
* parse.y (parse_decl): Change prototype.
(initdecls, notype_initdecls, initdcl): Don't return int.
(initdcl0, notype_initdcl0, initdcl0_innards): Likewise.
(.begin_new_placement): Remove.
(.finish_new_placement): Likewise.
(nonmomentary_expr): Likewise.
(suspend_mom): Likewise.
(condition): Don't suspend_momentary, resume_momentary, or keep
track of need to resume.
(unary_expr): Likewise.
(new_placement): Likewise.
(decl): Likewise.
(structsp): Likewise.
(new_type_id): Likewise.
(maybe_parmlist): Likewise.
(direct_after_type_declaration): Likewise.
(direct_new_declarator): Likewise.
(direct_abstract_declaration): Likewise.
* parse.c: Regenerated.
* pt.c (tsubst_expr): Don't suspend_momentary or resume_momentary.
* semantics.c (begin_new_placement): Remove.
(finish_new_placement): Likewise.
1999-11-05 Martin v. Lwis <loewis@informatik.hu-berlin.de> 1999-11-05 Martin v. Lwis <loewis@informatik.hu-berlin.de>
* cp-tree.h (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK): New macro. * cp-tree.h (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK): New macro.
......
...@@ -3377,7 +3377,6 @@ void ...@@ -3377,7 +3377,6 @@ void
finish_struct_1 (t) finish_struct_1 (t)
tree t; tree t;
{ {
int old;
tree fields = TYPE_FIELDS (t); tree fields = TYPE_FIELDS (t);
tree x, last_x, method_vec; tree x, last_x, method_vec;
int has_virtual; int has_virtual;
...@@ -3427,8 +3426,6 @@ finish_struct_1 (t) ...@@ -3427,8 +3426,6 @@ finish_struct_1 (t)
TYPE_SIZE (t) = NULL_TREE; TYPE_SIZE (t) = NULL_TREE;
CLASSTYPE_GOT_SEMICOLON (t) = 0; CLASSTYPE_GOT_SEMICOLON (t) = 0;
old = suspend_momentary ();
/* Install struct as DECL_FIELD_CONTEXT of each field decl. /* Install struct as DECL_FIELD_CONTEXT of each field decl.
Also process specified field sizes. Also process specified field sizes.
Set DECL_FIELD_SIZE to the specified size, or 0 if none specified. Set DECL_FIELD_SIZE to the specified size, or 0 if none specified.
...@@ -4183,8 +4180,6 @@ finish_struct_1 (t) ...@@ -4183,8 +4180,6 @@ finish_struct_1 (t)
undo_template_name_overload (TYPE_IDENTIFIER (t), 1); undo_template_name_overload (TYPE_IDENTIFIER (t), 1);
#endif #endif
resume_momentary (old);
if (warn_overloaded_virtual) if (warn_overloaded_virtual)
warn_hidden (t); warn_hidden (t);
......
...@@ -3894,8 +3894,6 @@ extern tree finish_qualified_call_expr PROTO ((tree, tree)); ...@@ -3894,8 +3894,6 @@ extern tree finish_qualified_call_expr PROTO ((tree, tree));
extern tree finish_label_address_expr PROTO((tree)); extern tree finish_label_address_expr PROTO((tree));
extern tree finish_unary_op_expr PROTO((enum tree_code, tree)); extern tree finish_unary_op_expr PROTO((enum tree_code, tree));
extern tree finish_id_expr PROTO((tree)); extern tree finish_id_expr PROTO((tree));
extern int begin_new_placement PROTO((void));
extern tree finish_new_placement PROTO((tree, int));
extern int begin_function_definition PROTO((tree, tree)); extern int begin_function_definition PROTO((tree, tree));
extern tree begin_constructor_declarator PROTO((tree, tree)); extern tree begin_constructor_declarator PROTO((tree, tree));
extern tree finish_declarator PROTO((tree, tree, tree, tree, int)); extern tree finish_declarator PROTO((tree, tree, tree, tree, int));
......
...@@ -9845,13 +9845,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -9845,13 +9845,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (size) if (size)
{ {
/* Must suspend_momentary here because the index
type may need to live until the end of the function.
For example, it is used in the declaration of a
variable which requires destructing at the end of
the function; then build_vec_delete will need this
value. */
int yes = suspend_momentary ();
/* Might be a cast. */ /* Might be a cast. */
if (TREE_CODE (size) == NOP_EXPR if (TREE_CODE (size) == NOP_EXPR
&& TREE_TYPE (size) == TREE_TYPE (TREE_OPERAND (size, 0))) && TREE_TYPE (size) == TREE_TYPE (TREE_OPERAND (size, 0)))
...@@ -9934,11 +9927,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -9934,11 +9927,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
} }
itype = build_index_type (itype); itype = build_index_type (itype);
dont_grok_size:
resume_momentary (yes);
} }
dont_grok_size:
type = build_cplus_array_type (type, itype); type = build_cplus_array_type (type, itype);
ctype = NULL_TREE; ctype = NULL_TREE;
} }
...@@ -14055,12 +14046,9 @@ maybe_build_cleanup_1 (decl, auto_delete) ...@@ -14055,12 +14046,9 @@ maybe_build_cleanup_1 (decl, auto_delete)
tree type = TREE_TYPE (decl); tree type = TREE_TYPE (decl);
if (type != error_mark_node && TYPE_NEEDS_DESTRUCTOR (type)) if (type != error_mark_node && TYPE_NEEDS_DESTRUCTOR (type))
{ {
int temp = 0, flags = LOOKUP_NORMAL|LOOKUP_DESTRUCTOR; int flags = LOOKUP_NORMAL|LOOKUP_DESTRUCTOR;
tree rval; tree rval;
if (TREE_CODE (decl) != PARM_DECL)
temp = suspend_momentary ();
if (TREE_CODE (type) == ARRAY_TYPE) if (TREE_CODE (type) == ARRAY_TYPE)
rval = decl; rval = decl;
else else
...@@ -14081,9 +14069,6 @@ maybe_build_cleanup_1 (decl, auto_delete) ...@@ -14081,9 +14069,6 @@ maybe_build_cleanup_1 (decl, auto_delete)
rval = build_compound_expr (tree_cons (NULL_TREE, rval, rval = build_compound_expr (tree_cons (NULL_TREE, rval,
build_expr_list (NULL_TREE, build_vbase_delete (type, decl)))); build_expr_list (NULL_TREE, build_vbase_delete (type, decl))));
if (TREE_CODE (decl) != PARM_DECL)
resume_momentary (temp);
return rval; return rval;
} }
return 0; return 0;
......
...@@ -440,12 +440,7 @@ do_pop_exception () ...@@ -440,12 +440,7 @@ do_pop_exception ()
static void static void
push_eh_cleanup () push_eh_cleanup ()
{ {
int yes;
yes = suspend_momentary ();
/* All cleanups must last longer than normal. */
finish_decl_cleanup (NULL_TREE, do_pop_exception ()); finish_decl_cleanup (NULL_TREE, do_pop_exception ());
resume_momentary (yes);
} }
/* Build up a call to terminate on the function obstack, for use as an /* Build up a call to terminate on the function obstack, for use as an
...@@ -454,10 +449,7 @@ push_eh_cleanup () ...@@ -454,10 +449,7 @@ push_eh_cleanup ()
static tree static tree
build_terminate_handler () build_terminate_handler ()
{ {
int yes = suspend_momentary (); return build_function_call (terminate_node, NULL_TREE);
tree term = build_function_call (terminate_node, NULL_TREE);
resume_momentary (yes);
return term;
} }
/* Initialize the catch parameter DECL. */ /* Initialize the catch parameter DECL. */
......
...@@ -2193,20 +2193,10 @@ build_new_1 (exp) ...@@ -2193,20 +2193,10 @@ build_new_1 (exp)
} }
else else
{ {
int susp = 0;
if (flag_exceptions)
/* We will use RVAL when generating an exception handler for
this new-expression, so we must save it. */
susp = suspend_momentary ();
rval = build_op_new_call rval = build_op_new_call
(code, true_type, tree_cons (NULL_TREE, size, placement), (code, true_type, tree_cons (NULL_TREE, size, placement),
LOOKUP_NORMAL | (use_global_new * LOOKUP_GLOBAL)); LOOKUP_NORMAL | (use_global_new * LOOKUP_GLOBAL));
rval = cp_convert (build_pointer_type (true_type), rval); rval = cp_convert (build_pointer_type (true_type), rval);
if (flag_exceptions)
resume_momentary (susp);
} }
/* unless an allocation function is declared with an empty excep- /* unless an allocation function is declared with an empty excep-
...@@ -2369,9 +2359,6 @@ build_new_1 (exp) ...@@ -2369,9 +2359,6 @@ build_new_1 (exp)
tree cleanup, fn = NULL_TREE; tree cleanup, fn = NULL_TREE;
int flags = LOOKUP_NORMAL | (use_global_new * LOOKUP_GLOBAL); int flags = LOOKUP_NORMAL | (use_global_new * LOOKUP_GLOBAL);
/* All cleanups must last longer than normal. */
int yes = suspend_momentary ();
/* The Standard is unclear here, but the right thing to do /* The Standard is unclear here, but the right thing to do
is to use the same method for finding deallocation is to use the same method for finding deallocation
functions that we use for finding allocation functions. */ functions that we use for finding allocation functions. */
...@@ -2384,8 +2371,6 @@ build_new_1 (exp) ...@@ -2384,8 +2371,6 @@ build_new_1 (exp)
cleanup = build_op_delete_call (dcode, alloc_node, size, flags, fn); cleanup = build_op_delete_call (dcode, alloc_node, size, flags, fn);
resume_momentary (yes);
/* Ack! First we allocate the memory. Then we set our sentry /* Ack! First we allocate the memory. Then we set our sentry
variable to true, and expand a cleanup that deletes the memory variable to true, and expand a cleanup that deletes the memory
if sentry is true. Then we run the constructor and store the if sentry is true. Then we run the constructor and store the
...@@ -2398,11 +2383,9 @@ build_new_1 (exp) ...@@ -2398,11 +2383,9 @@ build_new_1 (exp)
begin = get_target_expr (boolean_true_node); begin = get_target_expr (boolean_true_node);
sentry = TREE_OPERAND (begin, 0); sentry = TREE_OPERAND (begin, 0);
yes = suspend_momentary ();
TREE_OPERAND (begin, 2) TREE_OPERAND (begin, 2)
= build (COND_EXPR, void_type_node, sentry, = build (COND_EXPR, void_type_node, sentry,
cleanup, void_zero_node); cleanup, void_zero_node);
resume_momentary (yes);
rval = get_target_expr (rval); rval = get_target_expr (rval);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -7097,7 +7097,6 @@ tsubst_expr (t, args, complain, in_decl) ...@@ -7097,7 +7097,6 @@ tsubst_expr (t, args, complain, in_decl)
case DECL_STMT: case DECL_STMT:
{ {
int i = suspend_momentary ();
tree decl; tree decl;
tree init; tree init;
...@@ -7122,7 +7121,6 @@ tsubst_expr (t, args, complain, in_decl) ...@@ -7122,7 +7121,6 @@ tsubst_expr (t, args, complain, in_decl)
maybe_push_decl (decl); maybe_push_decl (decl);
cp_finish_decl (decl, init, NULL_TREE, 0, 0); cp_finish_decl (decl, init, NULL_TREE, 0, 0);
} }
resume_momentary (i);
return decl; return decl;
} }
......
...@@ -1619,32 +1619,6 @@ finish_id_expr (expr) ...@@ -1619,32 +1619,6 @@ finish_id_expr (expr)
return expr; return expr;
} }
/* Begin a new-placement. */
int
begin_new_placement ()
{
/* The arguments to a placement new might be passed to a
deallocation function, in the event that the allocation throws an
exception. Since we don't expand exception handlers until the
end of a function, we must make sure the arguments stay around
that long. */
return suspend_momentary ();
}
/* Finish a new-placement. The ARGS are the placement arguments. The
COOKIE is the value returned by the previous call to
begin_new_placement. */
tree
finish_new_placement (args, cookie)
tree args;
int cookie;
{
resume_momentary (cookie);
return args;
}
/* Begin a function defniition declared with DECL_SPECS and /* Begin a function defniition declared with DECL_SPECS and
DECLARATOR. Returns non-zero if the function-declaration is DECLARATOR. Returns non-zero if the function-declaration is
legal. */ legal. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment