* 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
+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.
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));
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));
#define obstack_chunk_free free
extern struct obstack permanent_obstack;
-extern struct obstack* saveable_obstack;
extern int current_class_depth;
{
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;
/* Generate code to destroy DECL (a local variable). */
-void
+static void
destroy_local_var (decl)
tree decl;
{
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;
/* Mark the language-specific data in F for GC. */
-void
+static void
mark_cp_function_context (f)
struct function *f;
{
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;
#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 *));
int looking_for_template;
extern int do_snarf_defarg;
-extern struct obstack *current_obstack, *saveable_obstack;
tree got_scope;
tree got_object;
}
\f
-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 !!! */
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 */
/* 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, ...))
#ifndef ANSI_PROTOTYPES
enum tree_code code;
#endif
- register struct obstack *ambient_obstack = expression_obstack;
va_list p;
register tree t;
register int length;
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;
}
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, ...))
enum tree_code code;
tree tt;
#endif
- register struct obstack *ambient_obstack = expression_obstack;
va_list p;
register tree t;
register int length;
tt = va_arg (p, tree);
#endif
- expression_obstack = &permanent_obstack;
-
t = make_node (code);
length = tree_code_length[(int) code];
TREE_TYPE (t) = 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;
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);
}
}
/* 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)
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;
}
--- /dev/null
+// 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();
+