Commit 5868eb4e by Mark Mitchell

decl.c (add_decl_to_level): Remove TREE_PERMANENT assertion.

	* decl.c (add_decl_to_level): Remove TREE_PERMANENT assertion.
	(init_decl_processing): Don't set TREE_PERMANENT for the
	error_mark_node.
	(start_decl): Don't rebuild non-permanent ARRAY_TYPEs.
	(grokdeclarator): Likewise.
	(grokparms): Don't check TREE_PERMANENT when building up lists.
	* decl2.c (grokfield): Don't assert TREE_PERMANENT.
	(mark_inline_for_output): Likewise.
	* expr.c (cplus_expand_expr): Don't check TREE_PERMANENT.
	* init.c (build_offset_ref): Don't check TREE_PERMANENT.
	* lex.c (check_newline): Don't check ggc_p; it is always one.
	* pt.c (process_template_parm): Don't check TREE_PERMANENT.
	* spew.c (yylex): Don't copy_node or probe_obstacks for
	non-permanent CONSTANTs and STRINGs.
	* tree.c (build_cplus_array_type_1): Don't fuss with
	TREE_PERMANENT on ARRAY_TYPEs.

From-SVN: r29350
parent 1ccbefce
...@@ -969,12 +969,6 @@ add_decl_to_level (decl, b) ...@@ -969,12 +969,6 @@ add_decl_to_level (decl, b)
tree decl; tree decl;
struct binding_level *b; struct binding_level *b;
{ {
/* Only things that will live forever should go in the global
binding level. */
my_friendly_assert (!(b == global_binding_level
&& !TREE_PERMANENT (decl)),
19990817);
/* We build up the list in reverse order, and reverse it later if /* We build up the list in reverse order, and reverse it later if
necessary. */ necessary. */
TREE_CHAIN (decl) = b->names; TREE_CHAIN (decl) = b->names;
...@@ -6039,7 +6033,6 @@ init_decl_processing () ...@@ -6039,7 +6033,6 @@ init_decl_processing ()
build_common_tree_nodes (flag_signed_char); build_common_tree_nodes (flag_signed_char);
TREE_PERMANENT (error_mark_node) = 1;
error_mark_list = build_tree_list (error_mark_node, error_mark_node); error_mark_list = build_tree_list (error_mark_node, error_mark_node);
TREE_TYPE (error_mark_list) = error_mark_node; TREE_TYPE (error_mark_list) = error_mark_node;
...@@ -6694,26 +6687,6 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes) ...@@ -6694,26 +6687,6 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
if (type == error_mark_node) if (type == error_mark_node)
return NULL_TREE; return NULL_TREE;
/* Don't lose if destructors must be executed at file-level. */
if (! processing_template_decl && TREE_STATIC (decl)
&& TYPE_NEEDS_DESTRUCTOR (complete_type (type))
&& !TREE_PERMANENT (decl))
{
push_obstacks (&permanent_obstack, &permanent_obstack);
decl = copy_node (decl);
if (TREE_CODE (type) == ARRAY_TYPE)
{
tree itype = TYPE_DOMAIN (type);
if (itype && ! TREE_PERMANENT (itype))
{
itype = build_index_type (TYPE_MAX_VALUE (itype));
type = build_cplus_array_type (TREE_TYPE (type), itype);
TREE_TYPE (decl) = type;
}
}
pop_obstacks ();
}
context context
= (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl)) = (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl))
? DECL_CLASS_CONTEXT (decl) ? DECL_CLASS_CONTEXT (decl)
...@@ -9959,19 +9932,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -9959,19 +9932,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
TREE_OVERFLOW (itype) = 0; TREE_OVERFLOW (itype) = 0;
} }
/* If we're a parm, we need to have a permanent type so itype = build_index_type (itype);
mangling checks for re-use will work right. If both the
element and index types are permanent, the array type
will be, too. */
if (decl_context == PARM
&& allocation_temporary_p () && TREE_PERMANENT (type))
{
push_obstacks (&permanent_obstack, &permanent_obstack);
itype = build_index_type (itype);
pop_obstacks ();
}
else
itype = build_index_type (itype);
dont_grok_size: dont_grok_size:
resume_momentary (yes); resume_momentary (yes);
...@@ -11486,14 +11447,7 @@ grokparms (first_parm, funcdef_flag) ...@@ -11486,14 +11447,7 @@ grokparms (first_parm, funcdef_flag)
TREE_CHAIN (last_decl) = decl; TREE_CHAIN (last_decl) = decl;
last_decl = decl; last_decl = decl;
} }
if (! current_function_decl && TREE_PERMANENT (list_node)) list_node = tree_cons (init, type, NULL_TREE);
{
TREE_PURPOSE (list_node) = init;
TREE_VALUE (list_node) = type;
TREE_CHAIN (list_node) = NULL_TREE;
}
else
list_node = tree_cons (init, type, NULL_TREE);
if (result == NULL_TREE) if (result == NULL_TREE)
{ {
result = list_node; result = list_node;
......
...@@ -1685,7 +1685,6 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist) ...@@ -1685,7 +1685,6 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
init = decl_constant_value (init); init = decl_constant_value (init);
else if (TREE_CODE (init) == CONSTRUCTOR) else if (TREE_CODE (init) == CONSTRUCTOR)
init = digest_init (TREE_TYPE (value), init, (tree *)0); init = digest_init (TREE_TYPE (value), init, (tree *)0);
my_friendly_assert (TREE_PERMANENT (init), 192);
if (init == error_mark_node) if (init == error_mark_node)
/* We must make this look different than `error_mark_node' /* We must make this look different than `error_mark_node'
because `decl_const_value' would mis-interpret it because `decl_const_value' would mis-interpret it
...@@ -2006,7 +2005,6 @@ mark_inline_for_output (decl) ...@@ -2006,7 +2005,6 @@ mark_inline_for_output (decl)
decl = DECL_MAIN_VARIANT (decl); decl = DECL_MAIN_VARIANT (decl);
if (DECL_SAVED_INLINE (decl)) if (DECL_SAVED_INLINE (decl))
return; return;
my_friendly_assert (TREE_PERMANENT (decl), 363);
DECL_SAVED_INLINE (decl) = 1; DECL_SAVED_INLINE (decl) = 1;
if (!saved_inlines) if (!saved_inlines)
VARRAY_TREE_INIT (saved_inlines, 32, "saved_inlines"); VARRAY_TREE_INIT (saved_inlines, 32, "saved_inlines");
......
...@@ -157,14 +157,10 @@ cplus_expand_expr (exp, target, tmode, modifier) ...@@ -157,14 +157,10 @@ cplus_expand_expr (exp, target, tmode, modifier)
if (AGGR_INIT_VIA_CTOR_P (exp)) if (AGGR_INIT_VIA_CTOR_P (exp))
{ {
type = build_pointer_type (type); type = build_pointer_type (type);
/* Don't clobber a value that might be part of a default
parameter value. */
mark_addressable (slot); mark_addressable (slot);
if (TREE_PERMANENT (args)) args = tree_cons (NULL_TREE,
args = tree_cons (0, build1 (ADDR_EXPR, type, slot), build1 (ADDR_EXPR, type, slot),
TREE_CHAIN (args)); TREE_CHAIN (args));
else
TREE_VALUE (args) = build1 (ADDR_EXPR, type, slot);
call_target = 0; call_target = 0;
} }
else else
......
...@@ -1652,17 +1652,6 @@ build_offset_ref (type, name) ...@@ -1652,17 +1652,6 @@ build_offset_ref (type, name)
return build (OFFSET_REF, TREE_TYPE (t), decl, t); return build (OFFSET_REF, TREE_TYPE (t), decl, t);
} }
/* FNFIELDS is most likely allocated on the search_obstack,
which will go away after this class scope. If we need
to save this value for later (i.e. for use as an initializer
for a static variable), then do so here.
??? The smart thing to do for the case of saving initializers
is to resolve them before we're done with this scope. */
if (!TREE_PERMANENT (fnfields)
&& ! allocation_temporary_p ())
fnfields = copy_list (fnfields);
TREE_TYPE (fnfields) = unknown_type_node; TREE_TYPE (fnfields) = unknown_type_node;
return build (OFFSET_REF, unknown_type_node, decl, fnfields); return build (OFFSET_REF, unknown_type_node, decl, fnfields);
} }
......
...@@ -2552,14 +2552,7 @@ linenum: ...@@ -2552,14 +2552,7 @@ linenum:
body_time = this_time; body_time = this_time;
} }
if (! ggc_p && !TREE_PERMANENT (yylval.ttype)) input_filename = TREE_STRING_POINTER (yylval.ttype);
{
input_filename
= (char *) permalloc (TREE_STRING_LENGTH (yylval.ttype) + 1);
strcpy (input_filename, TREE_STRING_POINTER (yylval.ttype));
}
else
input_filename = TREE_STRING_POINTER (yylval.ttype);
GNU_xref_file (input_filename); GNU_xref_file (input_filename);
......
...@@ -1840,11 +1840,6 @@ process_template_parm (list, next) ...@@ -1840,11 +1840,6 @@ process_template_parm (list, next)
|| TREE_CODE (TREE_TYPE (parm)) == COMPLEX_TYPE)) || TREE_CODE (TREE_TYPE (parm)) == COMPLEX_TYPE))
cp_pedwarn ("`%T' is not a valid type for a template constant parameter", cp_pedwarn ("`%T' is not a valid type for a template constant parameter",
TREE_TYPE (parm)); TREE_TYPE (parm));
if (TREE_PERMANENT (parm) == 0)
{
parm = copy_node (parm);
TREE_PERMANENT (parm) = 1;
}
decl = build_decl (CONST_DECL, DECL_NAME (parm), TREE_TYPE (parm)); decl = build_decl (CONST_DECL, DECL_NAME (parm), TREE_TYPE (parm));
DECL_INITIAL (parm) = DECL_INITIAL (decl) DECL_INITIAL (parm) = DECL_INITIAL (decl)
= build_template_parm_index (idx, processing_template_decl, = build_template_parm_index (idx, processing_template_decl,
......
...@@ -269,19 +269,7 @@ yylex () ...@@ -269,19 +269,7 @@ yylex ()
/* if we've got tokens, send them */ /* if we've got tokens, send them */
else if (num_tokens ()) else if (num_tokens ())
{ tmp_token= *nth_token (0);
tmp_token= *nth_token (0);
/* TMP_TOKEN.YYLVAL.TTYPE may have been allocated on the wrong obstack.
If we don't find it in CURRENT_OBSTACK's current or immediately
previous chunk, assume it was and copy it to the current obstack. */
if ((tmp_token.yychar == CONSTANT
|| tmp_token.yychar == STRING)
&& ! TREE_PERMANENT (tmp_token.yylval.ttype)
&& ! probe_obstack (current_obstack, tmp_token.yylval.ttype, 2)
&& ! probe_obstack (saveable_obstack, tmp_token.yylval.ttype, 2))
tmp_token.yylval.ttype = copy_node (tmp_token.yylval.ttype);
}
else else
{ {
/* if not, grab the next one and think about it */ /* if not, grab the next one and think about it */
......
...@@ -459,14 +459,6 @@ build_cplus_array_type_1 (elt_type, index_type) ...@@ -459,14 +459,6 @@ build_cplus_array_type_1 (elt_type, index_type)
if (elt_type == error_mark_node || index_type == error_mark_node) if (elt_type == error_mark_node || index_type == error_mark_node)
return error_mark_node; return error_mark_node;
push_obstacks_nochange ();
/* If both ELT_TYPE and INDEX_TYPE are permanent,
make this permanent too. */
if (TREE_PERMANENT (elt_type)
&& (index_type == 0 || TREE_PERMANENT (index_type)))
end_temporary_allocation ();
if (processing_template_decl if (processing_template_decl
|| uses_template_parms (elt_type) || uses_template_parms (elt_type)
|| uses_template_parms (index_type)) || uses_template_parms (index_type))
...@@ -484,7 +476,6 @@ build_cplus_array_type_1 (elt_type, index_type) ...@@ -484,7 +476,6 @@ build_cplus_array_type_1 (elt_type, index_type)
= TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (elt_type)); = TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (elt_type));
TYPE_NEEDS_DESTRUCTOR (t) TYPE_NEEDS_DESTRUCTOR (t)
= TYPE_NEEDS_DESTRUCTOR (TYPE_MAIN_VARIANT (elt_type)); = TYPE_NEEDS_DESTRUCTOR (TYPE_MAIN_VARIANT (elt_type));
pop_obstacks ();
return t; return t;
} }
......
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