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
This commit is contained in:
Mark Mitchell 1999-12-01 18:09:09 +00:00 committed by Mark Mitchell
parent eb69a68672
commit a09ba2e041
9 changed files with 48 additions and 62 deletions

View File

@ -1,3 +1,26 @@
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>
* pt.c (tsubst_decl): Robustify.

View File

@ -3990,7 +3990,6 @@ extern int member_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_nt PVPROTO((enum tree_code, ...));
extern tree min_tree_cons PROTO((tree, tree, tree));
extern int lvalue_p PROTO((tree));
extern int lvalue_or_else PROTO((tree, const char *));
extern tree build_cplus_new PROTO((tree, tree));
@ -4014,7 +4013,6 @@ extern int is_overloaded_fn PROTO((tree));
extern tree get_first_fn PROTO((tree));
extern int bound_pmf_p PROTO((tree));
extern tree ovl_cons PROTO((tree, tree));
extern tree scratch_ovl_cons PROTO((tree, tree));
extern int ovl_member PROTO((tree, tree));
extern tree build_overload PROTO((tree, tree));
extern tree fnaddr_from_vtable_entry PROTO((tree));

View File

@ -49,7 +49,6 @@ Boston, MA 02111-1307, USA. */
#define obstack_chunk_free free
extern struct obstack permanent_obstack;
extern struct obstack* saveable_obstack;
extern int current_class_depth;
@ -3318,7 +3317,7 @@ duplicate_decls (newdecl, olddecl)
{
cp_error ("declaration of `%F' throws different exceptions",
newdecl);
cp_error_at ("to previous declaration `%F'", olddecl);
cp_error_at ("than previous declaration `%F'", olddecl);
}
}
TREE_TYPE (newdecl) = TREE_TYPE (olddecl) = newtype;
@ -7488,7 +7487,7 @@ initialize_local_var (decl, init, flags)
/* Generate code to destroy DECL (a local variable). */
void
static void
destroy_local_var (decl)
tree decl;
{
@ -13792,6 +13791,9 @@ finish_function (lineno, flags)
function. For a nested function, this value is used in
pop_cp_function_context and then reset via pop_function_context. */
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;
@ -14201,7 +14203,7 @@ mark_lang_function (p)
/* Mark the language-specific data in F for GC. */
void
static void
mark_cp_function_context (f)
struct function *f;
{

View File

@ -1999,9 +1999,9 @@ build_new (placement, decl, init, use_global_new)
if (processing_template_decl)
{
if (has_array)
t = min_tree_cons (min_tree_cons (NULL_TREE, type, NULL_TREE),
build_min_nt (ARRAY_REF, NULL_TREE, nelts),
NULL_TREE);
t = tree_cons (tree_cons (NULL_TREE, type, NULL_TREE),
build_min_nt (ARRAY_REF, NULL_TREE, nelts),
NULL_TREE);
else
t = type;

View File

@ -51,9 +51,6 @@ Boston, MA 02111-1307, USA. */
#define DIR_SEPARATOR '/'
#endif
extern struct obstack permanent_obstack;
extern struct obstack *current_obstack, *saveable_obstack;
extern void yyprint PROTO((FILE *, int, YYSTYPE));
static tree get_time_identifier PROTO((const char *));

View File

@ -205,7 +205,6 @@ extern int looking_for_typename;
int looking_for_template;
extern int do_snarf_defarg;
extern struct obstack *current_obstack, *saveable_obstack;
tree got_scope;
tree got_object;

View File

@ -437,10 +437,7 @@ break_out_calls (exp)
}
extern struct obstack *current_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
codes are made. MUST BE CONSISTENT WITH tree.c !!! */
@ -1406,21 +1403,6 @@ ovl_cons (decl, chain)
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,
just return it; otherwise, ovl_cons the _DECLs */
@ -2023,8 +2005,8 @@ break_out_target_exprs (t)
/* Obstack used for allocating nodes in template function and variable
definitions. */
/* Similar to `build_nt', except we build
on the permanent_obstack, regardless. */
/* Similar to `build_nt', except that we set TREE_COMPLEXITY to be the
current line number. */
tree
build_min_nt VPROTO((enum tree_code code, ...))
@ -2032,7 +2014,6 @@ build_min_nt VPROTO((enum tree_code code, ...))
#ifndef ANSI_PROTOTYPES
enum tree_code code;
#endif
register struct obstack *ambient_obstack = expression_obstack;
va_list p;
register tree t;
register int length;
@ -2044,8 +2025,6 @@ build_min_nt VPROTO((enum tree_code code, ...))
code = va_arg (p, enum tree_code);
#endif
expression_obstack = &permanent_obstack;
t = make_node (code);
length = tree_code_length[(int) code];
TREE_COMPLEXITY (t) = lineno;
@ -2057,12 +2036,11 @@ build_min_nt VPROTO((enum tree_code code, ...))
}
va_end (p);
expression_obstack = ambient_obstack;
return t;
}
/* Similar to `build', except we build
on the permanent_obstack, regardless. */
/* Similar to `build', except we set TREE_COMPLEXITY to the current
line-number. */
tree
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;
tree tt;
#endif
register struct obstack *ambient_obstack = expression_obstack;
va_list p;
register tree t;
register int length;
@ -2084,8 +2061,6 @@ build_min VPROTO((enum tree_code code, tree tt, ...))
tt = va_arg (p, tree);
#endif
expression_obstack = &permanent_obstack;
t = make_node (code);
length = tree_code_length[(int) code];
TREE_TYPE (t) = tt;
@ -2098,26 +2073,9 @@ build_min VPROTO((enum tree_code code, tree tt, ...))
}
va_end (p);
expression_obstack = ambient_obstack;
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
get_type_decl (t)
tree t;

View File

@ -2159,7 +2159,7 @@ build_component_ref (datum, component, basetype_path, protect)
unknown_type_node to be really overloaded, so
let's oblige. */
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)
/* A friend template. Make it look like a toplevel declaration. */
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. */
if (is_method)
@ -5447,7 +5447,7 @@ build_c_cast (type, expr)
if (processing_template_decl)
{
tree t = build_min (CAST_EXPR, type,
min_tree_cons (NULL_TREE, value, NULL_TREE));
tree_cons (NULL_TREE, value, NULL_TREE));
return t;
}

View File

@ -0,0 +1,9 @@
// 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();