Commit a09ba2e0 by Mark Mitchell Committed by Mark Mitchell

cp-tree.h (min_tree_cons): Remove.

	* cp-tree.h (min_tree_cons): Remove.
	(scratch_ovl_cons): Likewise.
	* decl.c (saveable_obstack): Don't declare.
	(duplicate_decls): Tweak error-message.
	(initialize_local_var): Explicitly mark the definition as static.
	(finish_function): Call permanent_allocation, just so
	that the middle-end sees the obstacks it expects.
	(mark_cp_function_context): Likewise.
	* init.c (build_new): Don't use min_tree_cons.
	* lex.c (permanent_obstack): Don't declare.
	(current_obstack, saveable_obstack): Likewise.
	* spew.c (current_obstack, saveable_obstack): Likewise.
	* tree.c (current_obstack, saveable_obstack): Likewise.
	(scratch_ovl_cons): Remove.
	(build_min_nt): Don't mess with obstacks.
	(build_min): Likewise.
	(min_tree_cons): Remove
	* typeck.c (build_component_ref): Don't use scratch_ovl_cons.
	(build_x_function_call): Likewise.
	(build_c_cast): Don't use min_tree_cons.

From-SVN: r30743
parent eb69a686
1999-12-01 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (min_tree_cons): Remove.
(scratch_ovl_cons): Likewise.
* decl.c (saveable_obstack): Don't declare.
(duplicate_decls): Tweak error-message.
(initialize_local_var): Explicitly mark the definition as static.
(finish_function): Call permanent_allocation, just so
that the middle-end sees the obstacks it expects.
(mark_cp_function_context): Likewise.
* init.c (build_new): Don't use min_tree_cons.
* lex.c (permanent_obstack): Don't declare.
(current_obstack, saveable_obstack): Likewise.
* spew.c (current_obstack, saveable_obstack): Likewise.
* tree.c (current_obstack, saveable_obstack): Likewise.
(scratch_ovl_cons): Remove.
(build_min_nt): Don't mess with obstacks.
(build_min): Likewise.
(min_tree_cons): Remove
* typeck.c (build_component_ref): Don't use scratch_ovl_cons.
(build_x_function_call): Likewise.
(build_c_cast): Don't use min_tree_cons.
1999-11-29 Mark Mitchell <mark@codesourcery.com> 1999-11-29 Mark Mitchell <mark@codesourcery.com>
* pt.c (tsubst_decl): Robustify. * pt.c (tsubst_decl): Robustify.
......
...@@ -3990,7 +3990,6 @@ extern int member_p PROTO((tree)); ...@@ -3990,7 +3990,6 @@ extern int member_p PROTO((tree));
extern cp_lvalue_kind real_lvalue_p PROTO((tree)); extern cp_lvalue_kind real_lvalue_p PROTO((tree));
extern tree build_min PVPROTO((enum tree_code, tree, ...)); extern tree build_min PVPROTO((enum tree_code, tree, ...));
extern tree build_min_nt PVPROTO((enum tree_code, ...)); extern tree build_min_nt PVPROTO((enum tree_code, ...));
extern tree min_tree_cons PROTO((tree, tree, tree));
extern int lvalue_p PROTO((tree)); extern int lvalue_p PROTO((tree));
extern int lvalue_or_else PROTO((tree, const char *)); extern int lvalue_or_else PROTO((tree, const char *));
extern tree build_cplus_new PROTO((tree, tree)); extern tree build_cplus_new PROTO((tree, tree));
...@@ -4014,7 +4013,6 @@ extern int is_overloaded_fn PROTO((tree)); ...@@ -4014,7 +4013,6 @@ extern int is_overloaded_fn PROTO((tree));
extern tree get_first_fn PROTO((tree)); extern tree get_first_fn PROTO((tree));
extern int bound_pmf_p PROTO((tree)); extern int bound_pmf_p PROTO((tree));
extern tree ovl_cons PROTO((tree, tree)); extern tree ovl_cons PROTO((tree, tree));
extern tree scratch_ovl_cons PROTO((tree, tree));
extern int ovl_member PROTO((tree, tree)); extern int ovl_member PROTO((tree, tree));
extern tree build_overload PROTO((tree, tree)); extern tree build_overload PROTO((tree, tree));
extern tree fnaddr_from_vtable_entry PROTO((tree)); extern tree fnaddr_from_vtable_entry PROTO((tree));
......
...@@ -49,7 +49,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -49,7 +49,6 @@ Boston, MA 02111-1307, USA. */
#define obstack_chunk_free free #define obstack_chunk_free free
extern struct obstack permanent_obstack; extern struct obstack permanent_obstack;
extern struct obstack* saveable_obstack;
extern int current_class_depth; extern int current_class_depth;
...@@ -3318,7 +3317,7 @@ duplicate_decls (newdecl, olddecl) ...@@ -3318,7 +3317,7 @@ duplicate_decls (newdecl, olddecl)
{ {
cp_error ("declaration of `%F' throws different exceptions", cp_error ("declaration of `%F' throws different exceptions",
newdecl); newdecl);
cp_error_at ("to previous declaration `%F'", olddecl); cp_error_at ("than previous declaration `%F'", olddecl);
} }
} }
TREE_TYPE (newdecl) = TREE_TYPE (olddecl) = newtype; TREE_TYPE (newdecl) = TREE_TYPE (olddecl) = newtype;
...@@ -7488,7 +7487,7 @@ initialize_local_var (decl, init, flags) ...@@ -7488,7 +7487,7 @@ initialize_local_var (decl, init, flags)
/* Generate code to destroy DECL (a local variable). */ /* Generate code to destroy DECL (a local variable). */
void static void
destroy_local_var (decl) destroy_local_var (decl)
tree decl; tree decl;
{ {
...@@ -13792,6 +13791,9 @@ finish_function (lineno, flags) ...@@ -13792,6 +13791,9 @@ finish_function (lineno, flags)
function. For a nested function, this value is used in function. For a nested function, this value is used in
pop_cp_function_context and then reset via pop_function_context. */ pop_cp_function_context and then reset via pop_function_context. */
current_function_decl = NULL_TREE; current_function_decl = NULL_TREE;
/* We don't really care about obstacks, but the middle-end
sometimes cares on what obstck things are located. */
permanent_allocation (1);
} }
return fndecl; return fndecl;
...@@ -14201,7 +14203,7 @@ mark_lang_function (p) ...@@ -14201,7 +14203,7 @@ mark_lang_function (p)
/* Mark the language-specific data in F for GC. */ /* Mark the language-specific data in F for GC. */
void static void
mark_cp_function_context (f) mark_cp_function_context (f)
struct function *f; struct function *f;
{ {
......
...@@ -1999,7 +1999,7 @@ build_new (placement, decl, init, use_global_new) ...@@ -1999,7 +1999,7 @@ build_new (placement, decl, init, use_global_new)
if (processing_template_decl) if (processing_template_decl)
{ {
if (has_array) if (has_array)
t = min_tree_cons (min_tree_cons (NULL_TREE, type, NULL_TREE), t = tree_cons (tree_cons (NULL_TREE, type, NULL_TREE),
build_min_nt (ARRAY_REF, NULL_TREE, nelts), build_min_nt (ARRAY_REF, NULL_TREE, nelts),
NULL_TREE); NULL_TREE);
else else
......
...@@ -51,9 +51,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -51,9 +51,6 @@ Boston, MA 02111-1307, USA. */
#define DIR_SEPARATOR '/' #define DIR_SEPARATOR '/'
#endif #endif
extern struct obstack permanent_obstack;
extern struct obstack *current_obstack, *saveable_obstack;
extern void yyprint PROTO((FILE *, int, YYSTYPE)); extern void yyprint PROTO((FILE *, int, YYSTYPE));
static tree get_time_identifier PROTO((const char *)); static tree get_time_identifier PROTO((const char *));
......
...@@ -205,7 +205,6 @@ extern int looking_for_typename; ...@@ -205,7 +205,6 @@ extern int looking_for_typename;
int looking_for_template; int looking_for_template;
extern int do_snarf_defarg; extern int do_snarf_defarg;
extern struct obstack *current_obstack, *saveable_obstack;
tree got_scope; tree got_scope;
tree got_object; tree got_object;
......
...@@ -437,10 +437,7 @@ break_out_calls (exp) ...@@ -437,10 +437,7 @@ break_out_calls (exp)
} }
extern struct obstack *current_obstack;
extern struct obstack permanent_obstack; extern struct obstack permanent_obstack;
extern struct obstack *saveable_obstack;
extern struct obstack *expression_obstack;
/* Here is how primitive or already-canonicalized types' hash /* Here is how primitive or already-canonicalized types' hash
codes are made. MUST BE CONSISTENT WITH tree.c !!! */ codes are made. MUST BE CONSISTENT WITH tree.c !!! */
...@@ -1406,21 +1403,6 @@ ovl_cons (decl, chain) ...@@ -1406,21 +1403,6 @@ ovl_cons (decl, chain)
return result; return result;
} }
/* Same as ovl_cons, but on the scratch_obstack. */
tree
scratch_ovl_cons (value, chain)
tree value, chain;
{
register tree node;
register struct obstack *ambient_obstack = current_obstack;
extern struct obstack *expression_obstack;
current_obstack = expression_obstack;
node = ovl_cons (value, chain);
current_obstack = ambient_obstack;
return node;
}
/* Build a new overloaded function. If this is the first one, /* Build a new overloaded function. If this is the first one,
just return it; otherwise, ovl_cons the _DECLs */ just return it; otherwise, ovl_cons the _DECLs */
...@@ -2023,8 +2005,8 @@ break_out_target_exprs (t) ...@@ -2023,8 +2005,8 @@ break_out_target_exprs (t)
/* Obstack used for allocating nodes in template function and variable /* Obstack used for allocating nodes in template function and variable
definitions. */ definitions. */
/* Similar to `build_nt', except we build /* Similar to `build_nt', except that we set TREE_COMPLEXITY to be the
on the permanent_obstack, regardless. */ current line number. */
tree tree
build_min_nt VPROTO((enum tree_code code, ...)) build_min_nt VPROTO((enum tree_code code, ...))
...@@ -2032,7 +2014,6 @@ build_min_nt VPROTO((enum tree_code code, ...)) ...@@ -2032,7 +2014,6 @@ build_min_nt VPROTO((enum tree_code code, ...))
#ifndef ANSI_PROTOTYPES #ifndef ANSI_PROTOTYPES
enum tree_code code; enum tree_code code;
#endif #endif
register struct obstack *ambient_obstack = expression_obstack;
va_list p; va_list p;
register tree t; register tree t;
register int length; register int length;
...@@ -2044,8 +2025,6 @@ build_min_nt VPROTO((enum tree_code code, ...)) ...@@ -2044,8 +2025,6 @@ build_min_nt VPROTO((enum tree_code code, ...))
code = va_arg (p, enum tree_code); code = va_arg (p, enum tree_code);
#endif #endif
expression_obstack = &permanent_obstack;
t = make_node (code); t = make_node (code);
length = tree_code_length[(int) code]; length = tree_code_length[(int) code];
TREE_COMPLEXITY (t) = lineno; TREE_COMPLEXITY (t) = lineno;
...@@ -2057,12 +2036,11 @@ build_min_nt VPROTO((enum tree_code code, ...)) ...@@ -2057,12 +2036,11 @@ build_min_nt VPROTO((enum tree_code code, ...))
} }
va_end (p); va_end (p);
expression_obstack = ambient_obstack;
return t; return t;
} }
/* Similar to `build', except we build /* Similar to `build', except we set TREE_COMPLEXITY to the current
on the permanent_obstack, regardless. */ line-number. */
tree tree
build_min VPROTO((enum tree_code code, tree tt, ...)) build_min VPROTO((enum tree_code code, tree tt, ...))
...@@ -2071,7 +2049,6 @@ build_min VPROTO((enum tree_code code, tree tt, ...)) ...@@ -2071,7 +2049,6 @@ build_min VPROTO((enum tree_code code, tree tt, ...))
enum tree_code code; enum tree_code code;
tree tt; tree tt;
#endif #endif
register struct obstack *ambient_obstack = expression_obstack;
va_list p; va_list p;
register tree t; register tree t;
register int length; register int length;
...@@ -2084,8 +2061,6 @@ build_min VPROTO((enum tree_code code, tree tt, ...)) ...@@ -2084,8 +2061,6 @@ build_min VPROTO((enum tree_code code, tree tt, ...))
tt = va_arg (p, tree); tt = va_arg (p, tree);
#endif #endif
expression_obstack = &permanent_obstack;
t = make_node (code); t = make_node (code);
length = tree_code_length[(int) code]; length = tree_code_length[(int) code];
TREE_TYPE (t) = tt; TREE_TYPE (t) = tt;
...@@ -2098,26 +2073,9 @@ build_min VPROTO((enum tree_code code, tree tt, ...)) ...@@ -2098,26 +2073,9 @@ build_min VPROTO((enum tree_code code, tree tt, ...))
} }
va_end (p); va_end (p);
expression_obstack = ambient_obstack;
return t; return t;
} }
/* Same as `tree_cons' but make a permanent object. */
tree
min_tree_cons (purpose, value, chain)
tree purpose, value, chain;
{
register tree node;
register struct obstack *ambient_obstack = current_obstack;
current_obstack = &permanent_obstack;
node = tree_cons (purpose, value, chain);
current_obstack = ambient_obstack;
return node;
}
tree tree
get_type_decl (t) get_type_decl (t)
tree t; tree t;
......
...@@ -2159,7 +2159,7 @@ build_component_ref (datum, component, basetype_path, protect) ...@@ -2159,7 +2159,7 @@ build_component_ref (datum, component, basetype_path, protect)
unknown_type_node to be really overloaded, so unknown_type_node to be really overloaded, so
let's oblige. */ let's oblige. */
TREE_VALUE (fndecls) TREE_VALUE (fndecls)
= scratch_ovl_cons (TREE_VALUE (fndecls), NULL_TREE); = ovl_cons (TREE_VALUE (fndecls), NULL_TREE);
} }
} }
...@@ -2600,7 +2600,7 @@ build_x_function_call (function, params, decl) ...@@ -2600,7 +2600,7 @@ build_x_function_call (function, params, decl)
/* A friend template. Make it look like a toplevel declaration. */ /* A friend template. Make it look like a toplevel declaration. */
if (! is_method && TREE_CODE (function) == TEMPLATE_DECL) if (! is_method && TREE_CODE (function) == TEMPLATE_DECL)
function = scratch_ovl_cons (function, NULL_TREE); function = ovl_cons (function, NULL_TREE);
/* Handle methods, friends, and overloaded functions, respectively. */ /* Handle methods, friends, and overloaded functions, respectively. */
if (is_method) if (is_method)
...@@ -5447,7 +5447,7 @@ build_c_cast (type, expr) ...@@ -5447,7 +5447,7 @@ build_c_cast (type, expr)
if (processing_template_decl) if (processing_template_decl)
{ {
tree t = build_min (CAST_EXPR, type, tree t = build_min (CAST_EXPR, type,
min_tree_cons (NULL_TREE, value, NULL_TREE)); tree_cons (NULL_TREE, value, NULL_TREE));
return t; return t;
} }
......
// Build don't link:
// Origin: Mark Mitchell <mark@codesourcery.com>
// Special g++ Options:
# 1 "foo" 1 3
void f () {}
extern "C" void foo(int);
extern "C" void foo(int) throw();
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