Commit 87e3dbc9 by Mark Mitchell Committed by Mark Mitchell

Makefile.in (tree.o): Depend on ggc.h.

	* Makefile.in (tree.o): Depend on ggc.h.
	* class.c (make_method_vec): Remove.
	(free_method_vec): Likewise.
	(free_method_vecs): Remove.
	(add_method): Don't use them.
	* cp-tree.def (PTRMEM_CST): Make it longer.
	(TEMPLATE_PARM_INDEX): Make it shorter.
	* cp-tree.h (BINDING_HAS_LEVEL_P): New macro.
	(template_parm_index): Remove RTL field.
	(ptrmem_cst): Add RTL field.
	(finish_function): Removed parameter.
	(process_next_inline): Change prototype.
	(init_cplus_unsave): Rename to init_tree.
	(binding_init): Remove.
	* decl.c (free_binding_nodes): Remove.
	(push_binding): Don't use them.  Set BINDING_HAS_LEVEL_P.
	(pop_binding): Don't use free_binding_nodes.
	(free_binding_vecs): Remove.
	(store_bindings): Don't use them.
	(pop_from_top_level): Likewise.
	(lookup_namespace_name): Simplify.
	(build_typename_type): Don't use obstack_free.
	(unqualified_namespace_lookup): Simplify.
	(lookup_name_real): Simplify.
	(start_function): Remove comment about leaks.
	(finish_function): Removed nested parameter.  Call
	expand_end_bindings even when building_stmt_tree.
	Call ggc_push_context and ggc_pop_context around
	rest_of_compilation, if necessary.
	(mark_cp_function_context): Handle a NULL language-context.
	(lang_mark_false_label_stack): Fix typo.
	(lang_mark_tree): Handle CPLUS_BINDING, OVERLOAD,
	TEMPLATE_PARM_INDEX.  Handle the funny TYPE_LANG_SPECIFIC on
	pointer to method types.
	(lang_cleanup_tree): Use free to free TYPE_LANG_SPECIFIC.
	* decl2.c (finish_objects): Adjust call to finish_function.
	(finish_static_store_duration_function): Likewise.
	(do_nonmember_using_decl): Remove call to binding_init.
	* except.c (end_anon_func): Adjust call to finish_function.
	* lex.c (mark_impl_file_chain): New function.
	(init_parse): Call init_tree, not init_cplus_unsave.
	Add GC roots.
	(cp_pramga_interface): Use xmalloc, not permalloc.
	(cp_pragma_implementation): Likewise.
	(begin_definition_of_inclass_inline): Simplify.
	(process_next_inline): Adjust prototype.
	(do_scoped_id): Don't call binding_init.
	(make_lang_type): Allocate TYPE_LANG_SPECIFIC with xmalloc.
	(emit_thunk): Adjust call to finish_function.
	(synthesize_method): Likewise.
	* parse.y (%union): Add a new `pi' variant.
	(PRE_PARSED_FUNCTION_DECL): Use it.
	(fn.defpen): Likewise.
	(fndef): Adjust call to finish_function.
	(instantiate_decl): Likewise.
	(rtti.c): Likewise.
	(semantics.c): Likewise.
	* tree.c: Include ggc.h.
	(mark_list_hash): New function.
	(binding_init): Remove.
	(init_cplus_unsave): Rename to ...
	(init_tree): This.  Add GC roots.

From-SVN: r29172
parent bcc5cac9
1999-09-07 Mark Mitchell <mark@codesourcery.com>
* Makefile.in (tree.o): Depend on ggc.h.
* class.c (make_method_vec): Remove.
(free_method_vec): Likewise.
(free_method_vecs): Remove.
(add_method): Don't use them.
* cp-tree.def (PTRMEM_CST): Make it longer.
(TEMPLATE_PARM_INDEX): Make it shorter.
* cp-tree.h (BINDING_HAS_LEVEL_P): New macro.
(template_parm_index): Remove RTL field.
(ptrmem_cst): Add RTL field.
(finish_function): Removed parameter.
(process_next_inline): Change prototype.
(init_cplus_unsave): Rename to init_tree.
(binding_init): Remove.
* decl.c (free_binding_nodes): Remove.
(push_binding): Don't use them. Set BINDING_HAS_LEVEL_P.
(pop_binding): Don't use free_binding_nodes.
(free_binding_vecs): Remove.
(store_bindings): Don't use them.
(pop_from_top_level): Likewise.
(lookup_namespace_name): Simplify.
(build_typename_type): Don't use obstack_free.
(unqualified_namespace_lookup): Simplify.
(lookup_name_real): Simplify.
(start_function): Remove comment about leaks.
(finish_function): Removed nested parameter. Call
expand_end_bindings even when building_stmt_tree.
Call ggc_push_context and ggc_pop_context around
rest_of_compilation, if necessary.
(mark_cp_function_context): Handle a NULL language-context.
(lang_mark_false_label_stack): Fix typo.
(lang_mark_tree): Handle CPLUS_BINDING, OVERLOAD,
TEMPLATE_PARM_INDEX. Handle the funny TYPE_LANG_SPECIFIC on
pointer to method types.
(lang_cleanup_tree): Use free to free TYPE_LANG_SPECIFIC.
* decl2.c (finish_objects): Adjust call to finish_function.
(finish_static_store_duration_function): Likewise.
(do_nonmember_using_decl): Remove call to binding_init.
* except.c (end_anon_func): Adjust call to finish_function.
* lex.c (mark_impl_file_chain): New function.
(init_parse): Call init_tree, not init_cplus_unsave.
Add GC roots.
(cp_pramga_interface): Use xmalloc, not permalloc.
(cp_pragma_implementation): Likewise.
(begin_definition_of_inclass_inline): Simplify.
(process_next_inline): Adjust prototype.
(do_scoped_id): Don't call binding_init.
(make_lang_type): Allocate TYPE_LANG_SPECIFIC with xmalloc.
(emit_thunk): Adjust call to finish_function.
(synthesize_method): Likewise.
* parse.y (%union): Add a new `pi' variant.
(PRE_PARSED_FUNCTION_DECL): Use it.
(fn.defpen): Likewise.
(fndef): Adjust call to finish_function.
(instantiate_decl): Likewise.
(rtti.c): Likewise.
(semantics.c): Likewise.
* tree.c: Include ggc.h.
(mark_list_hash): New function.
(binding_init): Remove.
(init_cplus_unsave): Rename to ...
(init_tree): This. Add GC roots.
1999-09-05 Mark Mitchell <mark@codesourcery.com>
Get ready for garbage collection.
......
......@@ -271,7 +271,7 @@ cvt.o : cvt.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h decl.h \
search.o : search.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../stack.h \
$(srcdir)/../flags.h $(srcdir)/../system.h $(srcdir)/../toplev.h
tree.o : tree.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
$(srcdir)/../system.h $(srcdir)/../toplev.h
$(srcdir)/../system.h $(srcdir)/../toplev.h $(srcdir)/../ggc.h
ptree.o : ptree.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h
rtti.o : rtti.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
$(srcdir)/../system.h $(srcdir)/../toplev.h
......
......@@ -115,8 +115,6 @@ static void finish_struct_methods PROTO((tree));
static void maybe_warn_about_overly_private_class PROTO ((tree));
static int field_decl_cmp PROTO ((const tree *, const tree *));
static int method_name_cmp PROTO ((const tree *, const tree *));
static tree make_method_vec PROTO((int));
static void free_method_vec PROTO((tree));
static tree add_implicitly_declared_members PROTO((tree, int, int, int));
static tree fixed_type_or_null PROTO((tree, int *));
static tree resolve_address_of_overloaded_function PROTO((tree, tree, int,
......@@ -1066,46 +1064,6 @@ add_virtual_function (pv, phv, has_virtual, fndecl, t)
struct obstack class_obstack;
extern struct obstack *current_obstack;
/* These are method vectors that were too small for the number of
methods in some class, and so were abandoned. */
static tree free_method_vecs;
/* Returns a method vector with enough room for N methods. N should
be a power of two. */
static tree
make_method_vec (n)
int n;
{
tree new_vec;
tree* t;
for (t = &free_method_vecs; *t; t = &(TREE_CHAIN (*t)))
/* Note that we don't use >= n here because we don't want to
allocate a very large vector where it isn't needed. */
if (TREE_VEC_LENGTH (*t) == n)
{
new_vec = *t;
*t = TREE_CHAIN (new_vec);
TREE_CHAIN (new_vec) = NULL_TREE;
bzero ((PTR) &TREE_VEC_ELT (new_vec, 0), n * sizeof (tree));
return new_vec;
}
new_vec = make_tree_vec (n);
return new_vec;
}
/* Free the method vector VEC. */
static void
free_method_vec (vec)
tree vec;
{
TREE_CHAIN (vec) = free_method_vecs;
free_method_vecs = vec;
}
/* Add method METHOD to class TYPE.
If non-NULL, FIELDS is the entry in the METHOD_VEC vector entry of
......@@ -1141,9 +1099,8 @@ add_method (type, fields, method)
memory making the links in the list than we would by
over-allocating the size of the vector here. Furthermore,
we would complicate all the code that expects this to be a
vector. We keep a free list of vectors that we outgrew so
that we don't really waste any memory. */
CLASSTYPE_METHOD_VEC (type) = make_method_vec (8);
vector. */
CLASSTYPE_METHOD_VEC (type) = make_tree_vec (8);
method_vec = CLASSTYPE_METHOD_VEC (type);
len = TREE_VEC_LENGTH (method_vec);
......@@ -1165,11 +1122,10 @@ add_method (type, fields, method)
if (slot == len)
{
/* We need a bigger method vector. */
tree new_vec = make_method_vec (2 * len);
tree new_vec = make_tree_vec (2 * len);
bcopy ((PTR) &TREE_VEC_ELT (method_vec, 0),
(PTR) &TREE_VEC_ELT (new_vec, 0),
len * sizeof (tree));
free_method_vec (method_vec);
len = 2 * len;
method_vec = CLASSTYPE_METHOD_VEC (type) = new_vec;
}
......
......@@ -32,7 +32,7 @@ DEFTREECODE (OFFSET_REF, "offset_ref", 'r', 2)
/* A pointer-to-member constant. For a pointer-to-member constant
`X::Y' The PTRMEM_CST_CLASS is the RECORD_TYPE for `X' and the
PTRMEM_CST_MEMBER is the _DECL for `Y'. */
DEFTREECODE (PTRMEM_CST, "ptrmem_cst", 'c', 1)
DEFTREECODE (PTRMEM_CST, "ptrmem_cst", 'c', 2)
/* For NEW_EXPR, operand 0 is the placement list.
Operand 1 is the new-declarator.
......@@ -130,7 +130,7 @@ DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", 'x',
expression is to ensure against the case where
sizeof(char*) does not evenly divide
sizeof(HOST_WIDE_INT). */
2 + ((3 * sizeof (HOST_WIDE_INT) + sizeof(char*) - 1)
1 + ((3 * sizeof (HOST_WIDE_INT) + sizeof(char*) - 1)
/ sizeof (char*)))
/* Index into a template parameter list. This parameter must be a type.
......
......@@ -54,6 +54,7 @@ Boston, MA 02111-1307, USA. */
BINFO_FIELDS_MARKED.
TYPE_VIRTUAL_P.
ICS_THIS_FLAG (in _CONV)
BINDING_HAS_LEVEL_P (In CPLUS_BINDING)
3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE).
BINFO_VTABLE_PATH_MARKED.
BINFO_PUSHDECLS_MARKED.
......@@ -139,8 +140,6 @@ typedef struct
typedef struct
{
char common[sizeof (struct tree_common)];
struct rtx_def *rtl; /* Unused, but required to match up with what
the middle-end expects. */
HOST_WIDE_INT index;
HOST_WIDE_INT level;
HOST_WIDE_INT orig_level;
......@@ -150,6 +149,9 @@ typedef struct
typedef struct ptrmem_cst
{
char common[sizeof (struct tree_common)];
/* This isn't used, but the middle-end expects all constants to have
this field. */
struct rtx_def *rtl;
tree member;
}* ptrmem_cst_t;
......@@ -168,6 +170,9 @@ typedef struct ptrmem_cst
BINDING_LEVEL is used instead. */
#define BINDING_SCOPE(NODE) (((struct tree_binding*)NODE)->scope.scope)
/* Nonzero if NODE has BINDING_LEVEL, rather than BINDING_SCOPE. */
#define BINDING_HAS_LEVEL_P(NODE) TREE_LANG_FLAG_2 ((NODE))
/* This is the declaration bound to the name. Possible values:
variable, overloaded function, namespace, template, enumerator. */
#define BINDING_VALUE(NODE) (((struct tree_binding*)NODE)->value)
......@@ -3174,7 +3179,7 @@ extern int start_function PROTO((tree, tree, tree, int));
extern void expand_start_early_try_stmts PROTO((void));
extern void store_parm_decls PROTO((void));
extern void store_return_init PROTO((tree));
extern void finish_function PROTO((int, int, int));
extern void finish_function PROTO((int, int));
extern tree start_method PROTO((tree, tree, tree));
extern tree finish_method PROTO((tree));
extern void hack_incomplete_structures PROTO((tree));
......@@ -3376,7 +3381,7 @@ extern void reinit_parse_for_function PROTO((void));
extern void print_parse_statistics PROTO((void));
extern void extract_interface_info PROTO((void));
extern void do_pending_inlines PROTO((void));
extern void process_next_inline PROTO((tree));
extern void process_next_inline PROTO((struct pending_inline *));
extern struct pending_input *save_pending_input PROTO((void));
extern void restore_pending_input PROTO((struct pending_input *));
extern void yyungetc PROTO((int, int));
......@@ -3640,7 +3645,7 @@ extern int yylex PROTO((void));
extern tree arbitrate_lookup PROTO((tree, tree, tree));
/* in tree.c */
extern void init_cplus_unsave PROTO((void));
extern void init_tree PROTO((void));
extern void cplus_unsave_expr_now PROTO((tree));
extern int pod_type_p PROTO((tree));
extern void unshare_base_binfos PROTO((tree));
......@@ -3670,7 +3675,6 @@ extern tree reverse_path PROTO((tree));
extern int count_functions PROTO((tree));
extern int is_overloaded_fn PROTO((tree));
extern tree get_first_fn PROTO((tree));
extern tree binding_init PROTO((struct tree_binding*));
extern int bound_pmf_p PROTO((tree));
extern tree ovl_cons PROTO((tree, tree));
extern tree scratch_ovl_cons PROTO((tree, tree));
......
......@@ -2860,7 +2860,7 @@ finish_objects (method_type, initp)
expand_end_bindings (getdecls (), 1, 0);
poplevel (1, 0, 0);
pop_momentary ();
finish_function (lineno, 0, 0);
finish_function (lineno, 0);
if (initp == DEFAULT_INIT_PRIORITY)
{
......@@ -3111,7 +3111,7 @@ finish_static_storage_duration_function ()
expand_end_bindings (getdecls (), 1, 0);
poplevel (1, 0, 0);
pop_momentary ();
finish_function (lineno, 0, 0);
finish_function (lineno, 0);
}
/* Return the information about the indicated PRIORITY level. If no
......@@ -4950,10 +4950,9 @@ do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype)
tree *newval, *newtype;
{
tree decls;
struct tree_binding _decls;
*newval = *newtype = NULL_TREE;
decls = binding_init (&_decls);
decls = make_node (CPLUS_BINDING);
if (!qualified_lookup_using_namespace (name, scope, decls, 0))
/* Lookup error */
return;
......
......@@ -838,7 +838,7 @@ end_anon_func ()
poplevel (1, 0, 0);
pop_momentary ();
finish_function (lineno, 0, 0);
finish_function (lineno, 0);
pop_from_top_level ();
pop_function_context_from (NULL_TREE);
......
......@@ -94,6 +94,7 @@ static void pragma_ungetc PROTO((int));
static int read_line_number PROTO((int *));
static int token_getch PROTO ((void));
static void token_put_back PROTO ((int));
static void mark_impl_file_chain PROTO ((void *));
/* Given a file name X, return the nondirectory portion.
Keep in mind that X can be computed more than once. */
......@@ -185,6 +186,33 @@ extern int *token_count;
static tree defarg_fns;
static tree defarg_parm;
/* Functions and data structures for #pragma interface.
`#pragma implementation' means that the main file being compiled
is considered to implement (provide) the classes that appear in
its main body. I.e., if this is file "foo.cc", and class `bar'
is defined in "foo.cc", then we say that "foo.cc implements bar".
All main input files "implement" themselves automagically.
`#pragma interface' means that unless this file (of the form "foo.h"
is not presently being included by file "foo.cc", the
CLASSTYPE_INTERFACE_ONLY bit gets set. The effect is that none
of the vtables nor any of the inline functions defined in foo.h
will ever be output.
There are cases when we want to link files such as "defs.h" and
"main.cc". In this case, we give "defs.h" a `#pragma interface',
and "main.cc" has `#pragma implementation "defs.h"'. */
struct impl_files
{
char *filename;
struct impl_files *next;
};
static struct impl_files *impl_file_chain;
/* Return something to represent absolute declarators containing a *.
TARGET is the absolute declarator that the * contains.
......@@ -544,7 +572,7 @@ init_parse (filename)
set_identifier_size (sizeof (struct lang_identifier));
decl_printable_name = lang_printable_name;
init_cplus_unsave ();
init_tree ();
init_cplus_expand ();
memcpy (tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE,
......@@ -894,7 +922,8 @@ init_parse (filename)
ggc_add_tree_root (&defarg_parm, 1);
ggc_add_tree_root (&this_filename_time, 1);
ggc_add_tree_root (&filename_times, 1);
ggc_add_root (&impl_file_chain, 1, sizeof (impl_file_chain),
mark_impl_file_chain);
return filename;
}
......@@ -1091,32 +1120,18 @@ set_yydebug (value)
}
/* Functions and data structures for #pragma interface.
`#pragma implementation' means that the main file being compiled
is considered to implement (provide) the classes that appear in
its main body. I.e., if this is file "foo.cc", and class `bar'
is defined in "foo.cc", then we say that "foo.cc implements bar".
All main input files "implement" themselves automagically.
`#pragma interface' means that unless this file (of the form "foo.h"
is not presently being included by file "foo.cc", the
CLASSTYPE_INTERFACE_ONLY bit gets set. The effect is that none
of the vtables nor any of the inline functions defined in foo.h
will ever be output.
/* Mark ARG (which is really a struct impl_files **) for GC. */
There are cases when we want to link files such as "defs.h" and
"main.cc". In this case, we give "defs.h" a `#pragma interface',
and "main.cc" has `#pragma implementation "defs.h"'. */
struct impl_files
static void
mark_impl_file_chain (arg)
void *arg;
{
char *filename;
struct impl_files *next;
};
struct impl_files *ifs;
static struct impl_files *impl_file_chain;
ifs = *(struct impl_files **) arg;
if (ifs)
ggc_mark_string (ifs->filename);
}
/* Helper function to load global variables with interface
information. */
......@@ -1202,7 +1217,8 @@ cp_pragma_interface (main_filename)
TREE_INT_CST_LOW (fi) = 0;
TREE_INT_CST_HIGH (fi) = 1;
/* Get default. */
impl_file_chain = (struct impl_files *)permalloc (sizeof (struct impl_files));
impl_file_chain
= (struct impl_files *) xmalloc (sizeof (struct impl_files));
impl_file_chain->filename = filename;
impl_file_chain->next = 0;
#endif
......@@ -1237,7 +1253,7 @@ cp_pragma_implementation (main_filename)
}
if (ifiles == 0)
{
ifiles = (struct impl_files*) permalloc (sizeof (struct impl_files));
ifiles = (struct impl_files*) xmalloc (sizeof (struct impl_files));
ifiles->filename = main_filename;
ifiles->next = impl_file_chain;
impl_file_chain = ifiles;
......@@ -1247,7 +1263,7 @@ cp_pragma_implementation (main_filename)
&& ! strcmp (main_input_filename, input_filename))
|| ! strcmp (main_filename, input_filename))
{
impl_file_chain = (struct impl_files*) permalloc (sizeof (struct impl_files));
impl_file_chain = (struct impl_files*) xmalloc (sizeof (struct impl_files));
impl_file_chain->filename = main_filename;
impl_file_chain->next = 0;
}
......@@ -1289,7 +1305,7 @@ begin_definition_of_inclass_inline (pi)
feed_input (pi->buf, pi->len, pi->filename, pi->lineno);
yychar = PRE_PARSED_FUNCTION_DECL;
yylval.ttype = build_tree_list ((tree) pi, pi->fndecl);
yylval.pi = pi;
/* Pass back a handle to the rest of the inline functions, so that they
can be processed later. */
DECL_PENDING_INLINE_INFO (pi->fndecl) = 0;
......@@ -1340,11 +1356,10 @@ do_pending_inlines ()
do_pending_inlines). */
void
process_next_inline (t)
tree t;
process_next_inline (i)
struct pending_inline *i;
{
tree context;
struct pending_inline *i = (struct pending_inline *) TREE_PURPOSE (t);
context = hack_decl_function_context (i->fndecl);
if (context)
pop_function_context_from (context);
......@@ -2539,7 +2554,7 @@ linenum:
body_time = this_time;
}
if (!TREE_PERMANENT (yylval.ttype))
if (! ggc_p && !TREE_PERMANENT (yylval.ttype))
{
input_filename
= (char *) permalloc (TREE_STRING_LENGTH (yylval.ttype) + 1);
......@@ -3254,8 +3269,7 @@ do_scoped_id (token, parsing)
/* during parsing, this is ::name. Otherwise, it is black magic. */
if (parsing)
{
struct tree_binding _b;
id = binding_init (&_b);
id = make_node (CPLUS_BINDING);
if (!qualified_lookup_using_namespace (token, global_namespace, id, 0))
id = NULL_TREE;
else
......@@ -4836,23 +4850,16 @@ tree
make_lang_type (code)
enum tree_code code;
{
extern struct obstack *current_obstack, *saveable_obstack;
register tree t = make_node (code);
/* Set up some flags that give proper default behavior. */
if (IS_AGGR_TYPE_CODE (code))
{
struct obstack *obstack = current_obstack;
struct lang_type *pi;
SET_IS_AGGR_TYPE (t, 1);
if (! TREE_PERMANENT (t))
obstack = saveable_obstack;
else
my_friendly_assert (obstack == &permanent_obstack, 236);
pi = (struct lang_type *) obstack_alloc (obstack, sizeof (struct lang_type));
pi = (struct lang_type *) xmalloc (sizeof (struct lang_type));
bzero ((char *) pi, (int) sizeof (struct lang_type));
TYPE_LANG_SPECIFIC (t) = pi;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
typedef union {long itype; tree ttype; char *strtype; enum tree_code code; flagged_type_tree ftype; } YYSTYPE;
typedef union {
long itype;
tree ttype;
char *strtype;
enum tree_code code;
flagged_type_tree ftype;
struct pending_inline *pi;
} YYSTYPE;
#define IDENTIFIER 257
#define TYPENAME 258
#define SELFNAME 259
......@@ -73,12 +80,12 @@ typedef union {long itype; tree ttype; char *strtype; enum tree_code code; flagg
#define POINTSAT 328
#define TRY 329
#define CATCH 330
#define PRE_PARSED_FUNCTION_DECL 331
#define EXTERN_LANG_STRING 332
#define ALL 333
#define PRE_PARSED_CLASS_DECL 334
#define DEFARG 335
#define DEFARG_MARKER 336
#define EXTERN_LANG_STRING 331
#define ALL 332
#define PRE_PARSED_CLASS_DECL 333
#define DEFARG 334
#define DEFARG_MARKER 335
#define PRE_PARSED_FUNCTION_DECL 336
#define TYPENAME_DEFN 337
#define IDENTIFIER_DEFN 338
#define PTYPENAME_DEFN 339
......
......@@ -90,7 +90,14 @@ empty_parms ()
%start program
%union {long itype; tree ttype; char *strtype; enum tree_code code; flagged_type_tree ftype; }
%union {
long itype;
tree ttype;
char *strtype;
enum tree_code code;
flagged_type_tree ftype;
struct pending_inline *pi;
}
/* All identifiers that are not reserved words
and are not declared typedefs in the current block */
......@@ -236,10 +243,12 @@ empty_parms ()
/* C++ extensions */
%token <ttype> PTYPENAME
%token <ttype> PRE_PARSED_FUNCTION_DECL EXTERN_LANG_STRING ALL
%token <ttype> EXTERN_LANG_STRING ALL
%token <ttype> PRE_PARSED_CLASS_DECL DEFARG DEFARG_MARKER
%token <pi> PRE_PARSED_FUNCTION_DECL
%type <ttype> component_constructor_declarator
%type <ttype> fn.def2 return_id fn.defpen constructor_declarator
%type <ttype> fn.def2 return_id constructor_declarator
%type <pi> fn.defpen
%type <itype> ctor_initializer_opt function_try_block
%type <ttype> named_class_head_sans_basetype
%type <ftype> class_head named_class_head
......@@ -311,7 +320,7 @@ extern void yyprint PROTO((FILE *, int, YYSTYPE));
extern tree combine_strings PROTO((tree));
static int
parse_decl(declarator, specs_attrs, attributes, initialized, decl)
parse_decl (declarator, specs_attrs, attributes, initialized, decl)
tree declarator;
tree specs_attrs;
tree attributes;
......@@ -651,13 +660,9 @@ eat_saved_input:
fndef:
fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error
{ finish_function (lineno, (int)$3, 0); }
{ finish_function (lineno, (int)$3); }
| fn.def1 maybe_return_init function_try_block
{
int nested = (hack_decl_function_context
(current_function_decl) != NULL_TREE);
finish_function (lineno, (int)$3, nested);
}
{ finish_function (lineno, (int)$3); }
| fn.def1 maybe_return_init error
{ }
;
......@@ -2059,23 +2064,18 @@ initlist:
fn.defpen:
PRE_PARSED_FUNCTION_DECL
{ start_function (NULL_TREE, TREE_VALUE ($1),
NULL_TREE, 2);
{ start_function (NULL_TREE, $1->fndecl, NULL_TREE, 2);
reinit_parse_for_function (); }
pending_inline:
fn.defpen maybe_return_init ctor_initializer_opt compstmt_or_error
{
int nested = (hack_decl_function_context
(current_function_decl) != NULL_TREE);
finish_function (lineno, (int)$3 | 2, nested);
finish_function (lineno, (int)$3 | 2);
process_next_inline ($1);
}
| fn.defpen maybe_return_init function_try_block
{
int nested = (hack_decl_function_context
(current_function_decl) != NULL_TREE);
finish_function (lineno, (int)$3 | 2, nested);
finish_function (lineno, (int)$3 | 2);
process_next_inline ($1);
}
| fn.defpen maybe_return_init error
......
......@@ -27,6 +27,7 @@ Boston, MA 02111-1307, USA. */
#include "flags.h"
#include "rtl.h"
#include "toplev.h"
#include "ggc.h"
static tree bot_manip PROTO((tree));
static tree perm_manip PROTO((tree));
......@@ -39,6 +40,7 @@ static int avoid_overlap PROTO((tree, tree));
static cp_lvalue_kind lvalue_p_1 PROTO((tree, int));
static tree no_linkage_helper PROTO((tree));
static tree build_srcloc PROTO((char *, int));
static void mark_list_hash PROTO ((void *));
#define CEIL(x,y) (((x) + (y) - 1) / (y))
......@@ -1299,25 +1301,6 @@ debug_binfo (elem)
}
}
/* Initialize an CPLUS_BINDING node that does not live on an obstack. */
tree
binding_init (node)
struct tree_binding* node;
{
static struct tree_binding* source;
if (!source)
{
extern struct obstack permanent_obstack;
push_obstacks (&permanent_obstack, &permanent_obstack);
source = (struct tree_binding*)make_node (CPLUS_BINDING);
pop_obstacks ();
}
*node = *source;
TREE_PERMANENT ((tree)node) = 0;
return (tree)node;
}
int
count_functions (t)
tree t;
......@@ -2870,11 +2853,28 @@ make_ptrmem_cst (type, member)
return ptrmem_cst;
}
/* Initialize unsave for C++. */
/* Mark ARG (which is really a list_hash_table **) for GC. */
static void
mark_list_hash (arg)
void *arg;
{
struct list_hash *lh;
for (lh = * ((struct list_hash **) arg); lh; lh = lh->next)
ggc_mark_tree (lh->list);
}
/* Initialize tree.c. */
void
init_cplus_unsave ()
init_tree ()
{
lang_unsave_expr_now = cplus_unsave_expr_now;
ggc_add_root (list_hash_table,
sizeof (list_hash_table) / sizeof (struct list_hash *),
sizeof (struct list_hash *),
mark_list_hash);
}
/* The C++ version of unsave_expr_now.
......
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