aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog210
-rw-r--r--gcc/cp/Make-lang.in25
-rw-r--r--gcc/cp/call.c20
-rw-r--r--gcc/cp/class.c6
-rw-r--r--gcc/cp/config-lang.in2
-rw-r--r--gcc/cp/cp-lang.c8
-rw-r--r--gcc/cp/cp-tree.h498
-rw-r--r--gcc/cp/decl.c558
-rw-r--r--gcc/cp/decl.h4
-rw-r--r--gcc/cp/decl2.c26
-rw-r--r--gcc/cp/lex.c12
-rw-r--r--gcc/cp/lex.h6
-rw-r--r--gcc/cp/mangle.c4
-rw-r--r--gcc/cp/parse.y65
-rw-r--r--gcc/cp/pt.c20
-rw-r--r--gcc/cp/repo.c8
-rw-r--r--gcc/cp/search.c4
-rw-r--r--gcc/cp/semantics.c21
-rw-r--r--gcc/cp/spew.c303
-rw-r--r--gcc/cp/tree.c44
20 files changed, 937 insertions, 907 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 75e7599..e3af880 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,213 @@
+2002-06-03 Geoffrey Keating <geoffk@redhat.com>
+
+ * pt.c (inline_parm_levels): Mark for GC.
+
+ * mangle.c (start_mangling): Allocate G.substitutions here...
+ (init_mangle): ... rather than here.
+ (finish_mangling): Clear the varray pointer when done with it.
+ * spew.c (yylexstring): Don't use VARRAY_FREE.
+ * search.c (bfs_walk): Don't use VARRAY_FREE.
+ * decl2.c (pending_statics): Use gengtype to mark.
+ (deferred_fns): Likewise.
+ (ssdf_decls): Likewise.
+ (init_decl2): Delete.
+ * decl.c (pop_from_top_level): Don't use VARRAY_FREE.
+ (cxx_init_decl_processing): Don't call init_decl2.
+ (cxx_pop_function_context): Don't use VARRAY_FREE.
+ * cp-tree.h (struct saved_scope): No need for special marking
+ of varrays.
+ (struct language_function): Likewise.
+ (local_classes): Use gengtype to mark.
+ (init_decl2): Delete prototype.
+ * class.c (init_class_processing): Don't use
+ ggc_add_tree_varray_root.
+ (build_vtbl_initializer): Don't use VARRAY_FREE.
+
+ * decl.c (typename_compare): Don't use same_type_p.
+
+ * decl.c: Include hashtab.h instead of hash.h.
+ (typename_hash): Update to use htab_h.
+ (typename_compare): Likewise.
+ (typename_htab): Use gengtype to mark.
+ (build_typename_type): Update to use htab_h.
+ * Make-lang.in (cp/decl.o): Use HASHTAB_H instead of hash.h.
+
+ * Make-lang.in (gt-cp-tree.h): New rule.
+ (cp/tree.o): Depend on gt-cp-tree.h.
+ * config-lang.in (gtfiles): Add cp/tree.c.
+ * tree.c: Include gt-cp-tree.h.
+ (list_hash_table): Use gengtype to mark.
+ (init_tree): Use gengtype to mark trees.
+
+ * Make-lang.in (cp/decl.o): Add debug.h dependency.
+ * call.c (struct z_candidate): Use gengtype.
+ (USER_CONV_CAND): Use WRAPPER_ZC.
+ (convert_class_to_reference): Use build_zc_wrapper.
+ (build_type_conversion_1): Likewise.
+ (build_over_call): Use WRAPPER_ZC.
+ (add_warning): Use build_zc_wrapper.
+ * cp-lang.c (LANG_HOOKS_MARK_TREE): Delete.
+ * cp-tree.h (struct lang_identifier): Use gengtype.
+ (struct template_parm_index_s): Likewise.
+ (struct ptrmem_cst): Likewise.
+ (struct tree_binding): Likewise.
+ (struct tree_overload): Likewise.
+ (struct tree_srcloc): Likewise.
+ (struct tree_wrapper): Likewise. Also modify to have a pointer
+ to struct z_candidate rather than void.
+ (enum cp_tree_node_structure_enum): New.
+ (union lang_tree_node): New.
+ (cxx_mark_tree): Delete prototype.
+ (cp_tree_node_structure): New prototype.
+ (build_ptr_wrapper): Delete prototype.
+ (build_int_wrapper): Delete prototype.
+ (build_zc_wrapper): New prototype.
+ * decl.c: Include debug.h
+ (cxx_mark_tree): Delete.
+ (cp_tree_node_structure): New.
+ * tree.c (build_ptr_wrapper): Delete.
+ (build_int_wrapper): Delete.
+ (build_zc_wrapper): New.
+
+ * cp-tree.h [! ENABLE_TREE_CHECKING] (LANG_TYPE_PTRMEM_CHECK):
+ Correct typo. Patch from k_fukui@highway.ne.jp.
+
+ * semantics.c (current_stmt_tree): Update for change to
+ struct language_function.
+ (finish_mem_initializers): Likewise.
+ * decl.c (cxx_init_decl_processing): Don't set mark_lang_status.
+ * cp-tree.h (struct language_function): Rename from
+ cp_language_function. Change all uses.
+ (cp_function_chain): Don't need to cast.
+
+ * class.c (duplicate_tag_error): Reset discriminator.
+ (check_bases_and_members): Update for data structure changes.
+ * cp-tree.h (struct lang_id2): Use gengtype.
+ (flagged_type_tree): Likewise.
+ (SET_LANG_ID): Use GGC on struct lang_id2.
+ (struct cp_language_function): Use gengtype. Remove field
+ 'x_vcalls_possible_p'.
+ (current_vcalls_possible_p): Delete.
+ (struct lang_type_header): New.
+ (struct lang_type_class): Rename from struct lang_type. Include
+ struct lang_type_header.
+ (struct lang_type_ptrmem): New.
+ (struct lang_type): New.
+ (LANG_TYPE_CLASS_CHECK): New. Use it in all the appropriate macros.
+ (LANG_TYPE_PTRMEM_CHECK): New. Use it in all the appropriate macros.
+ (TYPE_SET_PTRMEMFUNC_TYPE): Set discriminator, update for changes.
+ (struct lang_decl_flags): Use gengtype. Add discriminators.
+ (struct lang_decl): Use gengtype. Add and use discriminators.
+ Update the macros that reference moved fields.
+ (LANG_DECL_U2_CHECK): New function. Use it when appropriate.
+ (SET_DECL_THUNK_P): Set discriminator too.
+ (clear_inline_text_obstack): Delete prototype.
+ (finish_inline_definitions): Delete prototype.
+ (mark_pending_inlines): Delete prototype.
+ (lang_check_failed): New prototype.
+ * decl.c (struct named_label_use_list): Use gengtype.
+ (struct named_label_list): Likewise.
+ (mark_binding_level): Delete.
+ (mark_named_label_lists): Delete.
+ (push_local_name): Set discriminator on DECL_LANG_SPECIFIC.
+ (cxx_init_decl_processing): Use generated marker routine.
+ (begin_destructor_body): Delete dead set to
+ current_vcalls_possible_p.
+ (mark_lang_function): Delete.
+ (mark_cp_function_context): Delete.
+ (lang_mark_tree): Use generated marker routines.
+ * decl2.c (start_objects): Set discriminator when setting
+ GLOBAL_INIT_PRIORITY.
+ * lex.c (retrofit_lang_decl): Set discriminators.
+ (copy_lang_type): Update for changes to lang_type structure.
+ (cp_make_lang_type): Set discriminator.
+ * parse.y: Use gengtype on YYLVAL. Don't use dots in identifiers.
+ * search.c: Include ggc.h.
+ * semantics.c (anon_aggr_type_p): Use the macro, don't hand-code it.
+ (finish_inline_definitions): Delete.
+ * spew.c (struct token): Use gengtype.
+ (struct token_chunk): New.
+ (struct unparsed_text): Use gengtype. Store tokens in chunks.
+ (struct feed): Use gengtype.
+ (feed_obstack): Delete.
+ (feed): Mark as GC root.
+ (pending_inlines): Mark as GC root.
+ (pending_inlines_tail): Likewise.
+ (processing_these_inlines): Likewise.
+ (token_obstack): Make static.
+ (first_token): Likewise.
+ (init_spew): Don't initialise deleted things; use gengtype for roots.
+ (clear_inline_text_obstack): Delete.
+ (feed_input): Use GC for struct feed. Update for changes to
+ struct unparsed_text.
+ (mark_pending_inlines): Delete.
+ (next_token): Rename from add_token. Change all callers. Update
+ for changes to struct unparsed_text.
+ (space_for_token): New.
+ (remove_last_token): New.
+ (alloc_unparsed_text): New.
+ (snarf_block): Take an unparsed_text. Update for changes to struct
+ unparsed_text.
+ (snarf_method): Update for changes to struct unparsed_text.
+ (snarf_defarg): Update for changes to struct unparsed_text.
+ * tree.c (lang_check_failed): New.
+
+ * Make-lang.in (gt-cp-call.h gt-cp-decl2.h gt-cp-parse.h
+ gt-cp-pt.h gt-cp-repo.h gt-cp-spew.h): New rules.
+ (cp/spew.o): Add dependency on gt-<filename>.h.
+ (cp/decl2.o): Add dependency on gt-<filename>.h.
+ (cp/call.o): Add dependency on gt-<filename>.h.
+ (cp/pt.o): Add dependency on gt-<filename>.h.
+ (cp/repo.o): Add dependency on gt-<filename>.h.
+ (cp/parse.o): Add dependency on gt-<filename>.h.
+ * call.c: Use gengtype for roots.
+ * config-lang.in (gtfiles): Add cp-tree.h decl.h lex.h call.c
+ decl2.c parse.y pt.c repo.c spew.c.
+ * cp-tree.h: Use gengtype for roots.
+ (struct saved_scope): Use GGC, gengtype.
+ (cp_parse_init): Delete prototype.
+ (init_pt): Delete prototype.
+ * decl.c: Use gengtype for roots.
+ (mark_saved_scope): Delete.
+ (cxx_init_decl_processing): Don't call deleted initilisation
+ routines.
+ (signed_size_zero_node): Delete, unused.
+ * decl.h: Use gengtype for roots.
+ * decl2.c: Use gengtype for roots.
+ * lex.h: Use gengtype for roots.
+ * parse.y: Use gengtype for roots.
+ (cp_parse_init): Delete.
+ * pt.c: Use gengtype for roots.
+ (init_pt): Delete.
+ * repo.c: Use gengtype for roots.
+ * spew.c: Use gengtype for roots.
+
+ * Make-lang.in: Allow for filename changes. Add gtype-cp.h.
+ (cp/decl.o): Add dependency on gtype-cp.h.
+ * decl.c: Remove use of add_deletable_root, use GTY marker instead.
+ Include gtype-cp.h. Allow for filename changes.
+
+ * Make-lang.in (cp/gt-decl.h): Generate using gengtype.
+ (cp/decl.o): Add cp/gt-decl.h dependency.
+ * config-lang.in (gtfiles): New.
+ * tree.h: Rename struct binding_level to struct cp_binding_level.
+ * decl.c: Rename struct binding_level to struct cp_binding_level.
+ Include cp/gt-decl.h.
+ (struct cp_binding_level): Use gengtype.
+ (make_binding_level): Use GGC on struct cp_binding_level.
+ (mark_binding_level): Use gt_ggc_m_cp_binding_level.
+ (cxx_init_decl_processing): Mark free_binding_level as
+ deletable.
+
+ * decl.c (mark_cp_function_context): Update calling sequence.
+
+ * decl.c (start_function): Don't free 'struct
+ cp_language_function'.
+ (pop_cp_function_context): Likewise.
+ (save_function_data): Allocate it using GC.
+ * semantics.c (genrtl_start_function): Don't free 'struct
+ cp_language_function'.
+
2002-05-31 Matthew Woodcraft <mattheww@chiark.greenend.org.uk>
* lang-specs.h: Use cpp_debug_options.
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 029b646..104adf8 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -131,6 +131,10 @@ $(srcdir)/cp/parse.c: $(srcdir)/cp/parse.y
false ; \
fi
+gtype-cp.h gt-cp-call.h gt-cp-decl.h gt-cp-decl2.h : s-gtype; @true
+gt-cp-parse.h gt-cp-pt.h gt-cp-repo.h gt-cp-spew.h : s-gtype; @true
+gt-cp-tree.h : s-gtype; @true
+
#
# Build hooks:
@@ -247,24 +251,26 @@ CXX_TREE_H = $(TREE_H) cp/cp-tree.h c-common.h cp/cp-tree.def c-common.def \
function.h varray.h $(SYSTEM_H) $(CONFIG_H) $(TARGET_H) \
$(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h
-cp/spew.o: cp/spew.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h toplev.h
+cp/spew.o: cp/spew.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h toplev.h \
+ gt-cp-spew.h
cp/lex.o: cp/lex.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h c-pragma.h \
toplev.h output.h mbchar.h $(GGC_H) input.h diagnostic.h cp/operators.def \
$(TM_P_H)
cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) toplev.h langhooks.h $(LANGHOOKS_DEF_H) \
c-common.h
cp/decl.o: cp/decl.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h stack.h \
- output.h $(EXPR_H) except.h toplev.h hash.h $(GGC_H) $(RTL_H) \
- cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h
+ output.h $(EXPR_H) except.h toplev.h $(HASHTAB_H) $(GGC_H) $(RTL_H) \
+ cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h \
+ debug.h gt-cp-decl.h gtype-cp.h
cp/decl2.o: cp/decl2.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \
- output.h except.h toplev.h $(GGC_H) $(RTL_H) c-common.h
+ output.h except.h toplev.h $(GGC_H) $(RTL_H) c-common.h gt-cp-decl2.h
cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) flags.h toplev.h output.h $(TM_P_H) \
diagnostic.h
cp/typeck.o: cp/typeck.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
diagnostic.h
cp/class.o: cp/class.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) $(TARGET_H)
cp/call.o: cp/call.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) $(EXPR_H) \
- $(GGC_H) diagnostic.h
+ $(GGC_H) diagnostic.h gt-cp-call.h
cp/friend.o: cp/friend.c $(CXX_TREE_H) flags.h $(RTL_H) toplev.h $(EXPR_H)
cp/init.o: cp/init.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
$(GGC_H) except.h
@@ -273,7 +279,7 @@ cp/method.o: cp/method.c $(CXX_TREE_H) toplev.h $(GGC_H) $(RTL_H) $(EXPR_H) \
cp/cvt.o: cp/cvt.c $(CXX_TREE_H) cp/decl.h flags.h toplev.h convert.h
cp/search.o: cp/search.c $(CXX_TREE_H) stack.h flags.h toplev.h $(RTL_H)
cp/tree.o: cp/tree.c $(CXX_TREE_H) flags.h toplev.h $(GGC_H) $(RTL_H) \
- insn-config.h integrate.h tree-inline.h real.h
+ insn-config.h integrate.h tree-inline.h real.h gt-cp-tree.h
cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(SYSTEM_H)
cp/rtti.o: cp/rtti.c $(CXX_TREE_H) flags.h toplev.h
cp/except.o: cp/except.c $(CXX_TREE_H) flags.h $(RTL_H) except.h toplev.h \
@@ -281,10 +287,11 @@ cp/except.o: cp/except.c $(CXX_TREE_H) flags.h $(RTL_H) except.h toplev.h \
cp/expr.o: cp/expr.c $(CXX_TREE_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \
except.h $(TM_P_H)
cp/pt.o: cp/pt.c $(CXX_TREE_H) cp/decl.h cp/parse.h cp/lex.h toplev.h \
- $(GGC_H) $(RTL_H) except.h tree-inline.h
+ $(GGC_H) $(RTL_H) except.h tree-inline.h gt-cp-pt.h
cp/error.o: cp/error.c $(CXX_TREE_H) toplev.h diagnostic.h flags.h real.h \
$(LANGHOOKS_DEF_H)
-cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H) diagnostic.h
+cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H) diagnostic.h \
+ gt-cp-repo.h
cp/semantics.o: cp/semantics.c $(CXX_TREE_H) cp/lex.h except.h toplev.h \
flags.h $(GGC_H) debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \
tree-inline.h
@@ -294,7 +301,7 @@ cp/optimize.o: cp/optimize.c $(CXX_TREE_H) rtl.h integrate.h insn-config.h \
cp/mangle.o: cp/mangle.c $(CXX_TREE_H) toplev.h real.h
cp/parse.o: cp/parse.c $(CXX_TREE_H) flags.h cp/lex.h except.h output.h \
- $(SYSTEM_H) toplev.h $(GGC_H)
+ $(SYSTEM_H) toplev.h $(GGC_H) gt-cp-parse.h
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \
$(srcdir)/cp/parse.c $(OUTPUT_OPTION)
#
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 75fac88..ed6ab2e 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -535,7 +535,7 @@ build_method_call (instance, name, parms, basetype_path, flags)
/* New overloading code. */
-struct z_candidate {
+struct z_candidate GTY(()) {
tree fn;
tree convs;
tree second_conv;
@@ -572,8 +572,7 @@ struct z_candidate {
should be created to hold the result of the conversion. */
#define NEED_TEMPORARY_P(NODE) TREE_LANG_FLAG_4 (NODE)
-#define USER_CONV_CAND(NODE) \
- ((struct z_candidate *)WRAPPER_PTR (TREE_OPERAND (NODE, 1)))
+#define USER_CONV_CAND(NODE) WRAPPER_ZC (TREE_OPERAND (NODE, 1))
#define USER_CONV_FN(NODE) (USER_CONV_CAND (NODE)->fn)
int
@@ -1022,7 +1021,7 @@ convert_class_to_reference (t, s, expr)
conv = build1 (IDENTITY_CONV, s, expr);
conv = build_conv (USER_CONV, TREE_TYPE (TREE_TYPE (cand->fn)),
conv);
- TREE_OPERAND (conv, 1) = build_ptr_wrapper (cand);
+ TREE_OPERAND (conv, 1) = build_zc_wrapper (cand);
ICS_USER_FLAG (conv) = 1;
if (cand->viable == -1)
ICS_BAD_FLAG (conv) = 1;
@@ -2559,7 +2558,7 @@ build_user_type_conversion_1 (totype, expr, flags)
(USER_CONV,
(DECL_CONSTRUCTOR_P (cand->fn)
? totype : non_reference (TREE_TYPE (TREE_TYPE (cand->fn)))),
- expr, build_ptr_wrapper (cand));
+ expr, build_zc_wrapper (cand));
ICS_USER_FLAG (cand->second_conv) = ICS_USER_FLAG (*p) = 1;
if (cand->viable == -1)
@@ -3826,7 +3825,7 @@ convert_like_real (convs, expr, fn, argnum, inner)
case USER_CONV:
{
struct z_candidate *cand
- = WRAPPER_PTR (TREE_OPERAND (convs, 1));
+ = WRAPPER_ZC (TREE_OPERAND (convs, 1));
tree convfn = cand->fn;
tree args;
@@ -4160,7 +4159,7 @@ build_over_call (cand, args, flags)
/* Give any warnings we noticed during overload resolution. */
if (cand->warnings)
for (val = cand->warnings; val; val = TREE_CHAIN (val))
- joust (cand, WRAPPER_PTR (TREE_VALUE (val)), 1);
+ joust (cand, WRAPPER_ZC (TREE_VALUE (val)), 1);
if (DECL_FUNCTION_MEMBER_P (fn))
enforce_access (cand->basetype_path, fn);
@@ -4405,7 +4404,7 @@ build_over_call (cand, args, flags)
return convert_from_reference (fn);
}
-static tree java_iface_lookup_fn;
+static GTY(()) tree java_iface_lookup_fn;
/* Make an expression which yields the address of the Java interface
method FN. This is achieved by generating a call to libjava's
@@ -4430,7 +4429,6 @@ build_java_interface_fn_ref (fn, instance)
= builtin_function ("_Jv_LookupInterfaceMethodIdx",
build_function_type (ptr_type_node, t),
0, NOT_BUILT_IN, NULL);
- ggc_add_tree_root (&java_iface_lookup_fn, 1);
}
/* Look up the pointer to the runtime java.lang.Class object for `instance'.
@@ -5207,7 +5205,7 @@ add_warning (winner, loser)
struct z_candidate *winner, *loser;
{
winner->warnings = tree_cons (NULL_TREE,
- build_ptr_wrapper (loser),
+ build_zc_wrapper (loser),
winner->warnings);
}
@@ -5635,3 +5633,5 @@ initialize_reference (type, expr)
return convert_like (conv, expr);
}
+
+#include "gt-cp-call.h"
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 64b528a..72f9faa 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -2157,6 +2157,7 @@ duplicate_tag_error (t)
memset ((char *) TYPE_LANG_SPECIFIC (t), 0, sizeof (struct lang_type));
BINFO_BASETYPES(binfo) = NULL_TREE;
+ TYPE_LANG_SPECIFIC (t)->u.h.is_lang_type_class = 1;
TYPE_BINFO (t) = binfo;
CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, interface_unknown);
@@ -4379,7 +4380,7 @@ check_bases_and_members (t, empty_p)
/* Figure out whether or not we will need a cookie when dynamically
allocating an array of this type. */
- TYPE_LANG_SPECIFIC (t)->vec_new_uses_cookie
+ TYPE_LANG_SPECIFIC (t)->u.c.vec_new_uses_cookie
= type_requires_array_cookie (t);
}
@@ -5470,7 +5471,6 @@ init_class_processing ()
= (class_stack_node_t) xmalloc (current_class_stack_size
* sizeof (struct class_stack_node));
VARRAY_TREE_INIT (local_classes, 8, "local_classes");
- ggc_add_tree_varray_root (&local_classes, 1);
access_default_node = build_int_2 (0, 0);
access_public_node = build_int_2 (ak_public, 0);
@@ -7511,8 +7511,6 @@ build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo, non_fn_entries_p)
VARRAY_TREE_INIT (vid.fns, 32, "fns");
/* Add the vcall and vbase offset entries. */
build_vcall_and_vbase_vtbl_entries (binfo, &vid);
- /* Clean up. */
- VARRAY_FREE (vid.fns);
/* Clear BINFO_VTABLE_PATH_MARKED; it's set by
build_vbase_offset_vtbl_entries. */
for (vbase = CLASSTYPE_VBASECLASSES (t);
diff --git a/gcc/cp/config-lang.in b/gcc/cp/config-lang.in
index c07408d..ba3708b 100644
--- a/gcc/cp/config-lang.in
+++ b/gcc/cp/config-lang.in
@@ -33,3 +33,5 @@ compilers="cc1plus\$(exeext)"
stagestuff="g++\$(exeext) g++-cross\$(exeext) cc1plus\$(exeext)"
target_libs="${libstdcxx_version} target-gperf"
+
+gtfiles="\$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/lex.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/parse.y \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/spew.c \$(srcdir)/cp/tree.c"
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index ce5165e..f482582 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -66,8 +66,6 @@ static bool cxx_warn_unused_global_decl PARAMS ((tree));
#define LANG_HOOKS_TRUTHVALUE_CONVERSION c_common_truthvalue_conversion
#undef LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES
#define LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES cxx_insert_default_attributes
-#undef LANG_HOOKS_MARK_TREE
-#define LANG_HOOKS_MARK_TREE cxx_mark_tree
#undef LANG_HOOKS_UNSAFE_FOR_REEVAL
#define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval
#undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
@@ -93,10 +91,8 @@ static bool cxx_warn_unused_global_decl PARAMS ((tree));
#undef LANG_HOOKS_FUNCTION_INIT
#define LANG_HOOKS_FUNCTION_INIT cxx_push_function_context
-#undef LANG_HOOKS_FUNCTION_FREE
-#define LANG_HOOKS_FUNCTION_FREE cxx_pop_function_context
-#undef LANG_HOOKS_FUNCTION_MARK
-#define LANG_HOOKS_FUNCTION_MARK cxx_mark_function_context
+#undef LANG_HOOKS_FUNCTION_FINAL
+#define LANG_HOOKS_FUNCTION_FINAL cxx_pop_function_context
/* Attribute hooks. */
#undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 907bbd0..448cb88 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -233,9 +233,9 @@ extern int flag_huge_objects;
/* Language-dependent contents of an identifier. */
-struct lang_identifier
+struct lang_identifier GTY(())
{
- struct c_common_identifier ignore;
+ struct c_common_identifier c_common;
tree namespace_bindings;
tree bindings;
tree class_value;
@@ -255,20 +255,21 @@ extern const short rid_to_yy[RID_MAX];
#define LANG_IDENTIFIER_CAST(NODE) \
((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE))
-struct lang_id2
+struct lang_id2 GTY(())
{
- tree label_value, implicit_decl;
+ tree label_value;
+ tree implicit_decl;
tree error_locus;
};
-typedef struct
+typedef struct flagged_type_tree_s GTY(())
{
tree t;
int new_type_flag;
tree lookups;
} flagged_type_tree;
-typedef struct
+typedef struct template_parm_index_s GTY(())
{
struct tree_common common;
HOST_WIDE_INT index;
@@ -277,14 +278,15 @@ typedef struct
tree decl;
} template_parm_index;
-typedef struct ptrmem_cst
+struct ptrmem_cst GTY(())
{
struct tree_common common;
/* This isn't used, but the middle-end expects all constants to have
this field. */
rtx rtl;
tree member;
-}* ptrmem_cst_t;
+};
+typedef struct ptrmem_cst * ptrmem_cst_t;
/* Nonzero if this binding is for a local scope, as opposed to a class
or namespace scope. */
@@ -346,13 +348,13 @@ typedef struct ptrmem_cst
&& MAIN_NAME_P (DECL_NAME (NODE)))
-struct tree_binding
+struct tree_binding GTY(())
{
struct tree_common common;
- union {
- tree scope;
- struct binding_level *level;
- } scope;
+ union tree_binding_u {
+ tree GTY ((tag ("0"))) scope;
+ struct cp_binding_level * GTY ((tag ("1"))) level;
+ } GTY ((desc ("BINDING_HAS_LEVEL_P ((tree)&%0)"))) scope;
tree value;
};
@@ -370,7 +372,7 @@ struct tree_binding
is not important for this node. */
#define OVL_USED(NODE) TREE_USED (NODE)
-struct tree_overload
+struct tree_overload GTY(())
{
struct tree_common common;
tree function;
@@ -384,21 +386,17 @@ struct tree_overload
#define SET_BASELINK_P(NODE) \
(TREE_LANG_FLAG_1 (NODE) = 1)
-#define WRAPPER_PTR(NODE) (((struct tree_wrapper*)WRAPPER_CHECK (NODE))->u.ptr)
-#define WRAPPER_INT(NODE) (((struct tree_wrapper*)WRAPPER_CHECK (NODE))->u.i)
+#define WRAPPER_ZC(NODE) (((struct tree_wrapper*)WRAPPER_CHECK (NODE))->z_c)
-struct tree_wrapper
+struct tree_wrapper GTY(())
{
struct tree_common common;
- union {
- void *ptr;
- int i;
- } u;
+ struct z_candidate *z_c;
};
#define SRCLOC_FILE(NODE) (((struct tree_srcloc*)SRCLOC_CHECK (NODE))->filename)
#define SRCLOC_LINE(NODE) (((struct tree_srcloc*)SRCLOC_CHECK (NODE))->linenum)
-struct tree_srcloc
+struct tree_srcloc GTY(())
{
struct tree_common common;
const char *filename;
@@ -450,10 +448,10 @@ struct tree_srcloc
(LANG_IDENTIFIER_CAST (NODE)->x \
? LANG_IDENTIFIER_CAST (NODE)->x->NAME : 0)
-#define SET_LANG_ID(NODE, VALUE, NAME) \
- (LANG_IDENTIFIER_CAST (NODE)->x == 0 \
- ? LANG_IDENTIFIER_CAST (NODE)->x \
- = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \
+#define SET_LANG_ID(NODE, VALUE, NAME) \
+ (LANG_IDENTIFIER_CAST (NODE)->x == 0 \
+ ? LANG_IDENTIFIER_CAST (NODE)->x \
+ = (struct lang_id2 *)ggc_alloc_cleared (sizeof (struct lang_id2)) : 0, \
LANG_IDENTIFIER_CAST (NODE)->x->NAME = (VALUE))
#define IDENTIFIER_LABEL_VALUE(NODE) \
@@ -495,11 +493,36 @@ struct tree_srcloc
/* Store a value in that field. */
#define C_SET_EXP_ORIGINAL_CODE(EXP, CODE) \
(TREE_COMPLEXITY (EXP) = (int)(CODE))
-
-/* If non-zero, a VAR_DECL whose cleanup will cause a throw to the
- next exception handler. */
-extern tree exception_throw_decl;
+enum cp_tree_node_structure_enum {
+ TS_CP_COMMON,
+ TS_CP_GENERIC,
+ TS_CP_IDENTIFIER,
+ TS_CP_TPI,
+ TS_CP_PTRMEM,
+ TS_CP_BINDING,
+ TS_CP_OVERLOAD,
+ TS_CP_WRAPPER,
+ TS_CP_SRCLOC,
+ LAST_TS_CP_ENUM
+};
+
+/* The resulting tree type. */
+union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)")))
+{
+ struct tree_common GTY ((tag ("TS_CP_COMMON"))) common;
+ union tree_node GTY ((tag ("TS_CP_GENERIC"),
+ desc ("tree_node_structure (&%h)"))) generic;
+ struct template_parm_index_s GTY ((tag ("TS_CP_TPI"))) tpi;
+ struct ptrmem_cst GTY ((tag ("TS_CP_PTRMEM"))) ptrmem;
+ struct tree_binding GTY ((tag ("TS_CP_BINDING"))) binding;
+ struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload;
+ struct tree_wrapper GTY ((tag ("TS_CP_WRAPPER"))) wrapper;
+ struct tree_srcloc GTY ((tag ("TS_CP_SRCLOC"))) srcloc;
+ struct lang_identifier GTY ((tag ("TS_CP_IDENTIFIER"))) identifier;
+};
+
+
enum cp_tree_index
{
CPTI_JAVA_BYTE_TYPE,
@@ -586,7 +609,7 @@ enum cp_tree_index
CPTI_MAX
};
-extern tree cp_global_trees[CPTI_MAX];
+extern GTY(()) tree cp_global_trees[CPTI_MAX];
#define java_byte_type_node cp_global_trees[CPTI_JAVA_BYTE_TYPE]
#define java_short_type_node cp_global_trees[CPTI_JAVA_SHORT_TYPE]
@@ -715,7 +738,7 @@ extern tree cp_global_trees[CPTI_MAX];
/* Global state. */
-struct saved_scope
+struct saved_scope GTY(())
{
tree old_bindings;
tree old_namespace;
@@ -740,8 +763,8 @@ struct saved_scope
struct stmt_tree_s x_stmt_tree;
- struct binding_level *class_bindings;
- struct binding_level *bindings;
+ struct cp_binding_level *class_bindings;
+ struct cp_binding_level *bindings;
struct saved_scope *prev;
};
@@ -798,15 +821,15 @@ struct saved_scope
#define type_lookups scope_chain->lookups
-extern struct saved_scope *scope_chain;
+extern GTY(()) struct saved_scope *scope_chain;
struct unparsed_text;
/* Global state pertinent to the current function. */
-struct cp_language_function
+struct language_function GTY(())
{
- struct language_function base;
+ struct c_language_function base;
tree x_dtor_label;
tree x_current_class_ptr;
@@ -816,8 +839,6 @@ struct cp_language_function
tree x_vtt_parm;
tree x_return_value;
- tree *x_vcalls_possible_p;
-
int returns_value;
int returns_null;
int returns_abnormally;
@@ -826,7 +847,7 @@ struct cp_language_function
struct named_label_use_list *x_named_label_uses;
struct named_label_list *x_named_labels;
- struct binding_level *bindings;
+ struct cp_binding_level *bindings;
varray_type x_local_names;
const char *cannot_inline;
@@ -835,8 +856,7 @@ struct cp_language_function
/* The current C++-specific per-function global variables. */
-#define cp_function_chain \
- ((struct cp_language_function *) (cfun->language))
+#define cp_function_chain (cfun->language)
/* In a destructor, the point at which all derived class destroying
has been done, just before any base class destroying will be done. */
@@ -867,12 +887,6 @@ struct cp_language_function
#define current_vtt_parm cp_function_chain->x_vtt_parm
-/* In destructors, this is a pointer to a condition in an
- if-statement. If the pointed-to value is boolean_true_node, then
- there may be virtual function calls in this destructor. */
-
-#define current_vcalls_possible_p cp_function_chain->x_vcalls_possible_p
-
/* Set to 0 at beginning of a function definition, set to 1 if
a return statement that specifies a return value is seen. */
@@ -908,7 +922,7 @@ struct cp_language_function
#define current_function_return_value \
(cp_function_chain->x_return_value)
-extern tree global_namespace;
+extern GTY(()) tree global_namespace;
#define ansi_opname(CODE) \
(operator_name_info[(int) (CODE)].identifier)
@@ -1176,6 +1190,22 @@ enum languages { lang_c, lang_cplusplus, lang_java };
#define PUBLICLY_UNIQUELY_DERIVED_P(PARENT, TYPE) \
lookup_base ((TYPE), (PARENT), ba_not_special | ba_quiet, NULL)
+/* This is a few header flags for 'struct lang_type'. Actually,
+ all but the first are used only for lang_type_class; they
+ are put in this structure to save space. */
+struct lang_type_header GTY(())
+{
+ unsigned is_lang_type_class : 1;
+
+ unsigned has_type_conversion : 1;
+ unsigned has_init_ref : 1;
+ unsigned has_default_ctor : 1;
+ unsigned uses_multiple_inheritance : 1;
+ unsigned const_needs_init : 1;
+ unsigned ref_needs_init : 1;
+ unsigned has_const_assign_ref : 1;
+};
+
/* This structure provides additional information above and beyond
what is provide in the ordinary tree_type. In the past, we used it
for the types of class types, template parameters types, typename
@@ -1189,19 +1219,12 @@ enum languages { lang_c, lang_cplusplus, lang_java };
many (i.e., thousands) of classes can easily be generated.
Therefore, we should endeavor to keep the size of this structure to
a minimum. */
-struct lang_type
+struct lang_type_class GTY(())
{
+ struct lang_type_header h;
+
unsigned char align;
- unsigned has_type_conversion : 1;
- unsigned has_init_ref : 1;
- unsigned has_default_ctor : 1;
- unsigned uses_multiple_inheritance : 1;
- unsigned const_needs_init : 1;
- unsigned ref_needs_init : 1;
- unsigned has_const_assign_ref : 1;
- unsigned anon_aggr : 1;
-
unsigned has_mutable : 1;
unsigned com_interface : 1;
unsigned non_pod_class : 1;
@@ -1240,6 +1263,7 @@ struct lang_type
unsigned is_partial_instantiation : 1;
unsigned java_interface : 1;
+ unsigned anon_aggr : 1;
unsigned non_zero_init : 1;
/* When adding a flag here, consider whether or not it ought to
@@ -1249,7 +1273,7 @@ struct lang_type
/* There are some bits left to fill out a 32-bit word. Keep track
of this by updating the size of this bitfield whenever you add or
remove a flag. */
- unsigned dummy : 7;
+ unsigned dummy : 6;
int vsize;
@@ -1267,12 +1291,50 @@ struct lang_type
tree befriending_classes;
};
+struct lang_type_ptrmem GTY(())
+{
+ struct lang_type_header h;
+ tree record;
+};
+
+struct lang_type GTY(())
+{
+ union lang_type_u
+ {
+ struct lang_type_header GTY((tag ("2"))) h;
+ struct lang_type_class GTY((tag ("1"))) c;
+ struct lang_type_ptrmem GTY((tag ("0"))) ptrmem;
+ } GTY((desc ("%h.h.is_lang_type_class"))) u;
+};
+
+#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
+
+#define LANG_TYPE_CLASS_CHECK(NODE) \
+({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \
+ if (! lt->u.h.is_lang_type_class) \
+ lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
+ &lt->u.c; })
+
+#define LANG_TYPE_PTRMEM_CHECK(NODE) \
+({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \
+ if (lt->u.h.is_lang_type_class) \
+ lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
+ &lt->u.ptrmem; })
+
+#else
+
+#define LANG_TYPE_CLASS_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.c)
+#define LANG_TYPE_PTRMEM_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.ptrmem)
+
+#endif /* ENABLE_TREE_CHECKING */
+
/* Indicates whether or not (and how) a template was expanded for this class.
0=no information yet/non-template class
1=implicit template instantiation
2=explicit template specialization
3=explicit template instantiation */
-#define CLASSTYPE_USE_TEMPLATE(NODE) (TYPE_LANG_SPECIFIC (NODE)->use_template)
+#define CLASSTYPE_USE_TEMPLATE(NODE) \
+ (LANG_TYPE_CLASS_CHECK (NODE)->use_template)
/* Fields used for storing information before the class is defined.
After the class is defined, these fields hold other information. */
@@ -1281,66 +1343,66 @@ struct lang_type
#define CLASSTYPE_INLINE_FRIENDS(NODE) CLASSTYPE_PURE_VIRTUALS (NODE)
/* Nonzero for _CLASSTYPE means that operator delete is defined. */
-#define TYPE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC (NODE)->gets_delete)
+#define TYPE_GETS_DELETE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->gets_delete)
#define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1)
/* Nonzero if `new NODE[x]' should cause the allocation of extra
storage to indicate how many array elements are in use. */
#define TYPE_VEC_NEW_USES_COOKIE(NODE) \
(CLASS_TYPE_P (NODE) \
- && TYPE_LANG_SPECIFIC (NODE)->vec_new_uses_cookie)
+ && LANG_TYPE_CLASS_CHECK (NODE)->vec_new_uses_cookie)
/* Nonzero means that this _CLASSTYPE node defines ways of converting
itself to other types. */
#define TYPE_HAS_CONVERSION(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->has_type_conversion)
+ (LANG_TYPE_CLASS_CHECK (NODE)->h.has_type_conversion)
/* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
-#define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_assign_ref)
+#define TYPE_HAS_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_assign_ref)
#define TYPE_HAS_CONST_ASSIGN_REF(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->has_const_assign_ref)
+ (LANG_TYPE_CLASS_CHECK (NODE)->h.has_const_assign_ref)
/* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */
-#define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_init_ref)
+#define TYPE_HAS_INIT_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->h.has_init_ref)
#define TYPE_HAS_CONST_INIT_REF(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->has_const_init_ref)
+ (LANG_TYPE_CLASS_CHECK (NODE)->has_const_init_ref)
/* Nonzero if this class defines an overloaded operator new. (An
operator new [] doesn't count.) */
#define TYPE_HAS_NEW_OPERATOR(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->has_new)
+ (LANG_TYPE_CLASS_CHECK (NODE)->has_new)
/* Nonzero if this class defines an overloaded operator new[]. */
#define TYPE_HAS_ARRAY_NEW_OPERATOR(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->has_array_new)
+ (LANG_TYPE_CLASS_CHECK (NODE)->has_array_new)
/* Nonzero means that this type is being defined. I.e., the left brace
starting the definition of this type has been seen. */
-#define TYPE_BEING_DEFINED(NODE) (TYPE_LANG_SPECIFIC (NODE)->being_defined)
+#define TYPE_BEING_DEFINED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->being_defined)
/* Nonzero means that this type has been redefined. In this case, if
convenient, don't reprocess any methods that appear in its redefinition. */
-#define TYPE_REDEFINED(NODE) (TYPE_LANG_SPECIFIC (NODE)->redefined)
+#define TYPE_REDEFINED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->redefined)
/* The is the basetype that contains NODE's rtti. */
-#define CLASSTYPE_RTTI(NODE) (TYPE_LANG_SPECIFIC (NODE)->rtti)
+#define CLASSTYPE_RTTI(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->rtti)
/* Nonzero means that this _CLASSTYPE node overloads operator(). */
#define TYPE_OVERLOADS_CALL_EXPR(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->has_call_overloaded)
+ (LANG_TYPE_CLASS_CHECK (NODE)->has_call_overloaded)
/* Nonzero means that this _CLASSTYPE node overloads operator[]. */
#define TYPE_OVERLOADS_ARRAY_REF(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->has_array_ref_overloaded)
+ (LANG_TYPE_CLASS_CHECK (NODE)->has_array_ref_overloaded)
/* Nonzero means that this _CLASSTYPE node overloads operator->. */
#define TYPE_OVERLOADS_ARROW(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->has_arrow_overloaded)
+ (LANG_TYPE_CLASS_CHECK (NODE)->has_arrow_overloaded)
/* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
multiple inheritance. If this is 0 for the root of a type
hierarchy, then we can use more efficient search techniques. */
#define TYPE_USES_MULTIPLE_INHERITANCE(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->uses_multiple_inheritance)
+ (LANG_TYPE_CLASS_CHECK (NODE)->h.uses_multiple_inheritance)
/* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
virtual base classes. If this is 0 for the root of a type
@@ -1359,7 +1421,7 @@ struct lang_type
functions. There may be empty entries at the end of the vector.
The conversion operators are unsorted. The ordinary member
functions are sorted, once the class is complete. */
-#define CLASSTYPE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC (NODE)->methods)
+#define CLASSTYPE_METHOD_VEC(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->methods)
/* The slot in the CLASSTYPE_METHOD_VEC where constructors go. */
#define CLASSTYPE_CONSTRUCTOR_SLOT 0
@@ -1385,19 +1447,19 @@ struct lang_type
/* Get the value of the Nth mark bit. */
#define CLASSTYPE_MARKED_N(NODE, N) \
- (((CLASS_TYPE_P (NODE) ? TYPE_LANG_SPECIFIC (NODE)->marks \
+ (((CLASS_TYPE_P (NODE) ? LANG_TYPE_CLASS_CHECK (NODE)->marks \
: ((unsigned) TYPE_ALIAS_SET (NODE))) & (1 << (N))) != 0)
/* Set the Nth mark bit. */
#define SET_CLASSTYPE_MARKED_N(NODE, N) \
(CLASS_TYPE_P (NODE) \
- ? (void) (TYPE_LANG_SPECIFIC (NODE)->marks |= (1 << (N))) \
+ ? (void) (LANG_TYPE_CLASS_CHECK (NODE)->marks |= (1 << (N))) \
: (void) (TYPE_ALIAS_SET (NODE) |= (1 << (N))))
/* Clear the Nth mark bit. */
#define CLEAR_CLASSTYPE_MARKED_N(NODE, N) \
(CLASS_TYPE_P (NODE) \
- ? (void) (TYPE_LANG_SPECIFIC (NODE)->marks &= ~(1 << (N))) \
+ ? (void) (LANG_TYPE_CLASS_CHECK (NODE)->marks &= ~(1 << (N))) \
: (void) (TYPE_ALIAS_SET (NODE) &= ~(1 << (N))))
/* Get the value of the mark bits. */
@@ -1426,7 +1488,7 @@ struct lang_type
found within this class. The TREE_PURPOSE of each node is the name
of the type; the TREE_VALUE is the type itself. This list includes
nested member class templates. */
-#define CLASSTYPE_TAGS(NODE) (TYPE_LANG_SPECIFIC (NODE)->tags)
+#define CLASSTYPE_TAGS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->tags)
/* Nonzero if NODE has a primary base class, i.e., a base class with
which it shares the virtual function table pointer. */
@@ -1437,11 +1499,11 @@ struct lang_type
the base class which contains the virtual function table pointer
for this class. */
#define CLASSTYPE_PRIMARY_BINFO(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->primary_base)
+ (LANG_TYPE_CLASS_CHECK (NODE)->primary_base)
/* The number of virtual functions present in this class' virtual
function table. */
-#define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC (NODE)->vsize)
+#define CLASSTYPE_VSIZE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vsize)
/* A chain of BINFOs for the direct and indirect virtual base classes
that this type uses in a post-order depth-first left-to-right
@@ -1451,7 +1513,7 @@ struct lang_type
list are all "real"; they are the same BINFOs that will be
encountered when using dfs_unmarked_real_bases_queue_p and related
functions. */
-#define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC (NODE)->vbases)
+#define CLASSTYPE_VBASECLASSES(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vbases)
/* For a non-virtual BINFO, the BINFO itself; for a virtual BINFO, the
binfo_for_vbase. C is the most derived class for the hierarchy
@@ -1467,10 +1529,10 @@ struct lang_type
/* These are the size and alignment of the type without its virtual
base classes, for when we use this type as a base itself. */
-#define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC (NODE)->size)
-#define CLASSTYPE_SIZE_UNIT(NODE) (TYPE_LANG_SPECIFIC (NODE)->size_unit)
-#define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC (NODE)->align)
-#define CLASSTYPE_USER_ALIGN(NODE) (TYPE_LANG_SPECIFIC (NODE)->user_align)
+#define CLASSTYPE_SIZE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->size)
+#define CLASSTYPE_SIZE_UNIT(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->size_unit)
+#define CLASSTYPE_ALIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->align)
+#define CLASSTYPE_USER_ALIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->user_align)
/* The alignment of NODE, without its virtual bases, in bytes. */
#define CLASSTYPE_ALIGN_UNIT(NODE) \
@@ -1478,70 +1540,71 @@ struct lang_type
/* True if this a Java interface type, declared with
'__attribute__ ((java_interface))'. */
-#define TYPE_JAVA_INTERFACE(NODE) (TYPE_LANG_SPECIFIC (NODE)->java_interface)
+#define TYPE_JAVA_INTERFACE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->java_interface)
/* A cons list of virtual functions which cannot be inherited by
derived classes. When deriving from this type, the derived
class must provide its own definition for each of these functions. */
-#define CLASSTYPE_PURE_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC (NODE)->pure_virtuals)
+#define CLASSTYPE_PURE_VIRTUALS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->pure_virtuals)
/* Nonzero means that this aggr type has been `closed' by a semicolon. */
-#define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->got_semicolon)
+#define CLASSTYPE_GOT_SEMICOLON(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->got_semicolon)
/* Nonzero means that the main virtual function table pointer needs to be
set because base constructors have placed the wrong value there.
If this is zero, it means that they placed the right value there,
and there is no need to change it. */
#define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->needs_virtual_reinit)
+ (LANG_TYPE_CLASS_CHECK (NODE)->needs_virtual_reinit)
/* Nonzero means that this type has an X() constructor. */
#define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->has_default_ctor)
+ (LANG_TYPE_CLASS_CHECK (NODE)->h.has_default_ctor)
/* Nonzero means that this type contains a mutable member */
-#define CLASSTYPE_HAS_MUTABLE(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_mutable)
+#define CLASSTYPE_HAS_MUTABLE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_mutable)
#define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
/* Nonzero means that this class type is a non-POD class. */
-#define CLASSTYPE_NON_POD_P(NODE) (TYPE_LANG_SPECIFIC (NODE)->non_pod_class)
+#define CLASSTYPE_NON_POD_P(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->non_pod_class)
/* Nonzero means that this class contains pod types whose default
initialization is not a zero initialization (namely, pointers to
data members). */
-#define CLASSTYPE_NON_ZERO_INIT_P(NODE) (TYPE_LANG_SPECIFIC (NODE)->non_zero_init)
+#define CLASSTYPE_NON_ZERO_INIT_P(NODE) \
+ (LANG_TYPE_CLASS_CHECK (NODE)->non_zero_init)
/* Nonzero if this class is "nearly empty", i.e., contains only a
virtual function table pointer. */
#define CLASSTYPE_NEARLY_EMPTY_P(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->nearly_empty_p)
+ (LANG_TYPE_CLASS_CHECK (NODE)->nearly_empty_p)
/* A list of class types of which this type is a friend. The
TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
case of a template friend. */
#define CLASSTYPE_FRIEND_CLASSES(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->friend_classes)
+ (LANG_TYPE_CLASS_CHECK (NODE)->friend_classes)
/* A list of the classes which grant friendship to this class. */
#define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->befriending_classes)
+ (LANG_TYPE_CLASS_CHECK (NODE)->befriending_classes)
/* Say whether this node was declared as a "class" or a "struct". */
#define CLASSTYPE_DECLARED_CLASS(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->declared_class)
+ (LANG_TYPE_CLASS_CHECK (NODE)->declared_class)
/* Nonzero if this class has const members which have no specified initialization. */
#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->const_needs_init)
+ (LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init)
/* Nonzero if this class has ref members which have no specified initialization. */
#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->ref_needs_init)
+ (LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init)
/* Nonzero if this class is included from a header file which employs
`#pragma interface', and it is not included in its implementation file. */
#define CLASSTYPE_INTERFACE_ONLY(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->interface_only)
+ (LANG_TYPE_CLASS_CHECK (NODE)->interface_only)
/* True if we have already determined whether or not vtables, VTTs,
typeinfo, and other similar per-class data should be emitted in
@@ -1549,21 +1612,21 @@ struct lang_type
these items should be emitted; it only indicates that we know one
way or the other. */
#define CLASSTYPE_INTERFACE_KNOWN(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->interface_unknown == 0)
+ (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown == 0)
/* The opposite of CLASSTYPE_INTERFANCE_KNOWN. */
#define CLASSTYPE_INTERFACE_UNKNOWN(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->interface_unknown)
+ (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown)
#define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) \
- (TYPE_LANG_SPECIFIC (NODE)->interface_unknown = !!(X))
+ (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = !!(X))
#define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->interface_unknown = 1)
+ (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 1)
#define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->interface_unknown = 0)
+ (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 0)
/* Nonzero if a _DECL node requires us to output debug info for this class. */
#define CLASSTYPE_DEBUG_REQUESTED(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->debug_requested)
+ (LANG_TYPE_CLASS_CHECK (NODE)->debug_requested)
/* Additional macros for inheritance information. */
@@ -1676,7 +1739,7 @@ struct lang_type
TREE_PURPOSE is NULL. Otherwise, the TREE_PURPOSE is the BINFO for
the class containing the vfield. The TREE_VALUE is the class where
the vfield was first defined. */
-#define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC (NODE)->vfields)
+#define CLASSTYPE_VFIELDS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vfields)
/* Get the assoc info that caused this vfield to exist. */
#define VF_BINFO_VALUE(NODE) TREE_PURPOSE (NODE)
@@ -1736,7 +1799,7 @@ struct lang_type
|| TREE_CODE (NODE) == FIELD_DECL \
|| TREE_CODE (NODE) == USING_DECL))
-struct lang_decl_flags
+struct lang_decl_flags GTY(())
{
struct c_lang_decl base;
@@ -1757,28 +1820,29 @@ struct lang_decl_flags
unsigned not_really_extern : 1;
unsigned needs_final_overrider : 1;
unsigned initialized_in_class : 1;
- unsigned pending_inline_p : 1;
+ unsigned assignment_operator_p : 1;
unsigned global_ctor_p : 1;
unsigned global_dtor_p : 1;
- unsigned assignment_operator_p : 1;
unsigned anticipated_p : 1;
unsigned template_conv_p : 1;
-
- unsigned unused : 3; /* Three unused bits. */
+ unsigned u1sel : 1;
+ unsigned u2sel : 1;
+ unsigned can_be_full : 1;
+ unsigned unused : 1; /* One unused bit. */
- union {
+ union lang_decl_u {
/* In a FUNCTION_DECL, VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this
is DECL_TEMPLATE_INFO. */
- tree template_info;
+ tree GTY ((tag ("0"))) template_info;
/* In a NAMESPACE_DECL, this is NAMESPACE_LEVEL. */
- struct binding_level *level;
- } u;
+ struct cp_binding_level * GTY ((tag ("1"))) level;
+ } GTY ((desc ("%1.u1sel"))) u;
- union {
+ union lang_decl_u2 {
/* This is DECL_ACCESS. */
- tree access;
+ tree GTY ((tag ("0"))) access;
/* For VAR_DECL in function, this is DECL_DISCRIMINATOR. */
int discriminator;
@@ -1789,36 +1853,59 @@ struct lang_decl_flags
/* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
THUNK_VCALL_OFFSET. */
- tree vcall_offset;
- } u2;
+ tree GTY((tag ("2"))) vcall_offset;
+ } GTY ((desc ("%1.u2sel"))) u2;
};
-struct lang_decl
+struct lang_decl GTY(())
{
struct lang_decl_flags decl_flags;
- tree befriending_classes;
+ union lang_decl_u4
+ {
+ struct full_lang_decl
+ {
+ tree befriending_classes;
+
+ /* For a virtual FUNCTION_DECL, this is DECL_VIRTUAL_CONTEXT. For a
+ non-virtual FUNCTION_DECL, this is DECL_FRIEND_CONTEXT. */
+ tree context;
+
+ /* In a FUNCTION_DECL, this is DECL_CLONED_FUNCTION. */
+ tree cloned_function;
+
+ /* In an overloaded operator, this is the value of
+ DECL_OVERLOADED_OPERATOR_P. */
+ enum tree_code operator_code;
+
+ unsigned u3sel : 1;
+ unsigned pending_inline_p : 1;
+
+ union lang_decl_u3
+ {
+ tree GTY ((tag ("0"))) sorted_fields;
+ struct unparsed_text * GTY ((tag ("2"))) pending_inline_info;
+ struct language_function * GTY ((tag ("1")))
+ saved_language_function;
+ } GTY ((desc ("%1.u3sel + %1.pending_inline_p"))) u;
+ } GTY ((tag ("1"))) f;
+ } GTY ((desc ("%1.decl_flags.can_be_full"))) u;
+};
- /* For a virtual FUNCTION_DECL, this is DECL_VIRTUAL_CONTEXT. For a
- non-virtual FUNCTION_DECL, this is DECL_FRIEND_CONTEXT. */
- tree context;
+#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
- /* In a FUNCTION_DECL, this is DECL_CLONED_FUNCTION. */
- tree cloned_function;
+#define LANG_DECL_U2_CHECK(NODE, TF) \
+({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \
+ if (lt->decl_flags.u2sel != TF) \
+ lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
+ &lt->decl_flags.u2; })
- union
- {
- tree sorted_fields;
- struct unparsed_text *pending_inline_info;
- struct cp_language_function *saved_language_function;
- } u;
-
- union {
- /* In an overloaded operator, this is the value of
- DECL_OVERLOADED_OPERATOR_P. */
- enum tree_code operator_code;
- } u2;
-};
+#else
+
+#define LANG_DECL_U2_CHECK(NODE, TF) \
+ (&DECL_LANG_SPECIFIC (NODE)->decl_flags.u2)
+
+#endif /* ENABLE_TREE_CHECKING */
#define DEFARG_POINTER(NODE) (DEFAULT_ARG_CHECK (NODE)->identifier.id.str)
@@ -1927,7 +2014,7 @@ struct lang_decl
/* If DECL_CLONED_FUNCTION_P holds, this is the function that was
cloned. */
#define DECL_CLONED_FUNCTION(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->cloned_function)
+ (DECL_LANG_SPECIFIC (NODE)->u.f.cloned_function)
/* Nonzero if NODE has DECL_DISCRIMINATOR and not DECL_ACCESS. */
#define DECL_DISCRIMINATOR_P(NODE) \
@@ -1935,8 +2022,7 @@ struct lang_decl
&& DECL_FUNCTION_SCOPE_P (NODE))
/* Discriminator for name mangling. */
-#define DECL_DISCRIMINATOR(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->decl_flags.u2.discriminator)
+#define DECL_DISCRIMINATOR(NODE) (LANG_DECL_U2_CHECK (NODE, 1)->discriminator)
/* Non-zero if the VTT parm has been added to NODE. */
#define DECL_HAS_VTT_PARM_P(NODE) \
@@ -1961,7 +2047,7 @@ struct lang_decl
/* Set the overloaded operator code for NODE to CODE. */
#define SET_OVERLOADED_OPERATOR_CODE(NODE, CODE) \
- (DECL_LANG_SPECIFIC (NODE)->u2.operator_code = (CODE))
+ (DECL_LANG_SPECIFIC (NODE)->u.f.operator_code = (CODE))
/* If NODE is an overloaded operator, then this returns the TREE_CODE
associcated with the overloaded operator.
@@ -1972,7 +2058,7 @@ struct lang_decl
to test whether or not NODE is an overloaded operator. */
#define DECL_OVERLOADED_OPERATOR_P(NODE) \
(IDENTIFIER_OPNAME_P (DECL_NAME (NODE)) \
- ? DECL_LANG_SPECIFIC (NODE)->u2.operator_code : ERROR_MARK)
+ ? DECL_LANG_SPECIFIC (NODE)->u.f.operator_code : ERROR_MARK)
/* Non-zero if NODE is an assignment operator. */
#define DECL_ASSIGNMENT_OPERATOR_P(NODE) \
@@ -2007,7 +2093,7 @@ struct lang_decl
/* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */
#define DECL_BEFRIENDING_CLASSES(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->befriending_classes)
+ (DECL_LANG_SPECIFIC (NODE)->u.f.befriending_classes)
/* Nonzero for FUNCTION_DECL means that this decl is a static
member function. */
@@ -2081,8 +2167,9 @@ struct lang_decl
(DECL_NON_THUNK_FUNCTION_P (NODE) && DECL_EXTERN_C_P (NODE))
/* Set DECL_THUNK_P for node. */
-#define SET_DECL_THUNK_P(NODE) \
- (DECL_LANG_FLAG_7 (NODE) = 1)
+#define SET_DECL_THUNK_P(NODE) \
+ (DECL_LANG_FLAG_7 (NODE) = 1, \
+ DECL_LANG_SPECIFIC (NODE)->u.f.u3sel = 1)
/* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a
template function. */
@@ -2102,12 +2189,12 @@ struct lang_decl
the DECL_FRIEND_CONTEXT for `f' will be `S'. */
#define DECL_FRIEND_CONTEXT(NODE) \
((DECL_FRIEND_P (NODE) && !DECL_FUNCTION_MEMBER_P (NODE)) \
- ? DECL_LANG_SPECIFIC (NODE)->context \
+ ? DECL_LANG_SPECIFIC (NODE)->u.f.context \
: NULL_TREE)
/* Set the DECL_FRIEND_CONTEXT for NODE to CONTEXT. */
#define SET_DECL_FRIEND_CONTEXT(NODE, CONTEXT) \
- (DECL_LANG_SPECIFIC (NODE)->context = (CONTEXT))
+ (DECL_LANG_SPECIFIC (NODE)->u.f.context = (CONTEXT))
/* NULL_TREE in DECL_CONTEXT represents the global namespace. */
#define CP_DECL_CONTEXT(NODE) \
@@ -2117,7 +2204,7 @@ struct lang_decl
/* For a virtual function, the base where we find its vtable entry.
For a non-virtual function, the base where it is defined. */
#define DECL_VIRTUAL_CONTEXT(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->context)
+ (DECL_LANG_SPECIFIC (NODE)->u.f.context)
/* 1 iff NODE has namespace scope, including the global namespace. */
#define DECL_NAMESPACE_SCOPE_P(NODE) \
@@ -2176,17 +2263,17 @@ struct lang_decl
the class definition. We have saved away the text of the function,
but have not yet processed it. */
#define DECL_PENDING_INLINE_P(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->decl_flags.pending_inline_p)
+ (DECL_LANG_SPECIFIC (NODE)->u.f.pending_inline_p)
/* If DECL_PENDING_INLINE_P holds, this is the saved text of the
function. */
#define DECL_PENDING_INLINE_INFO(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->u.pending_inline_info)
+ (DECL_LANG_SPECIFIC (NODE)->u.f.u.pending_inline_info)
/* For a TYPE_DECL: if this function has many fields, we'll sort them
and put them into a TREE_VEC. */
#define DECL_SORTED_FIELDS(NODE) \
- (DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE))->u.sorted_fields)
+ (DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE))->u.f.u.sorted_fields)
/* True if on the deferred_fns (see decl2.c) list. */
#define DECL_DEFERRED_FN(DECL) \
@@ -2200,7 +2287,7 @@ struct lang_decl
/* Template information for a RECORD_TYPE or UNION_TYPE. */
#define CLASSTYPE_TEMPLATE_INFO(NODE) \
- (TYPE_LANG_SPECIFIC (RECORD_OR_UNION_TYPE_CHECK (NODE))->template_info)
+ (LANG_TYPE_CLASS_CHECK (RECORD_OR_UNION_TYPE_CHECK (NODE))->template_info)
/* Template information for an ENUMERAL_TYPE. Although an enumeration may
not be a primary template, it may be declared within the scope of a
@@ -2210,7 +2297,7 @@ struct lang_decl
/* Template information for a template template parameter. */
#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) \
- (TYPE_LANG_SPECIFIC (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK (NODE)) \
+ (LANG_TYPE_CLASS_CHECK (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK (NODE)) \
->template_info)
/* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE. */
@@ -2348,8 +2435,9 @@ struct lang_decl
#define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
/* In a FUNCTION_DECL, the saved language-specific per-function data. */
-#define DECL_SAVED_FUNCTION_DATA(NODE) \
- (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE))->u.saved_language_function)
+#define DECL_SAVED_FUNCTION_DATA(NODE) \
+ (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE)) \
+ ->u.f.u.saved_language_function)
#define NEW_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
#define DELETE_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
@@ -2488,15 +2576,15 @@ extern int flag_new_for_scope;
/* Nonzero means that an object of this type can not be initialized using
an initializer list. */
#define CLASSTYPE_NON_AGGREGATE(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->non_aggregate)
+ (LANG_TYPE_CLASS_CHECK (NODE)->non_aggregate)
#define TYPE_NON_AGGREGATE_CLASS(NODE) \
(IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
/* Nonzero if there is a user-defined X::op=(x&) for this class. */
-#define TYPE_HAS_REAL_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_real_assign_ref)
-#define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_complex_assign_ref)
-#define TYPE_HAS_ABSTRACT_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_abstract_assign_ref)
-#define TYPE_HAS_COMPLEX_INIT_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_complex_init_ref)
+#define TYPE_HAS_REAL_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_real_assign_ref)
+#define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_assign_ref)
+#define TYPE_HAS_ABSTRACT_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_abstract_assign_ref)
+#define TYPE_HAS_COMPLEX_INIT_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_init_ref)
/* Nonzero if TYPE has a trivial destructor. From [class.dtor]:
@@ -2555,7 +2643,7 @@ extern int flag_new_for_scope;
&& TYPE_PTRMEMFUNC_FLAG (NODE))
#define TYPE_PTRMEMFUNC_FLAG(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->ptrmemfunc_flag)
+ (LANG_TYPE_CLASS_CHECK (NODE)->ptrmemfunc_flag)
/* Indicates when overload resolution may resolve to a pointer to
member function. [expr.unary.op]/3 */
@@ -2600,9 +2688,17 @@ enum ptrmemfunc_vbit_where_t
/* These are use to manipulate the canonical RECORD_TYPE from the
hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */
#define TYPE_GET_PTRMEMFUNC_TYPE(NODE) \
- ((tree)TYPE_LANG_SPECIFIC (NODE))
-#define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) \
- (TYPE_LANG_SPECIFIC (NODE) = ((struct lang_type *)(void*)(VALUE)))
+ (TYPE_LANG_SPECIFIC (NODE) ? LANG_TYPE_PTRMEM_CHECK (NODE)->record : NULL)
+#define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) \
+ do { \
+ if (TYPE_LANG_SPECIFIC (NODE) == NULL) \
+ { \
+ TYPE_LANG_SPECIFIC (NODE) = \
+ ggc_alloc_cleared (sizeof (struct lang_type_ptrmem)); \
+ TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.h.is_lang_type_class = 0; \
+ } \
+ TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.record = (VALUE); \
+ } while (0)
/* Returns the pfn field from a TYPE_PTRMEMFUNC_P. */
#define PFN_FROM_PTRMEMFUNC(NODE) pfn_from_ptrmemfunc ((NODE))
@@ -2647,9 +2743,9 @@ enum ptrmemfunc_vbit_where_t
flag for this because "A union for which objects or pointers are
declared is not an anonymous union" [class.union]. */
#define ANON_AGGR_TYPE_P(NODE) \
- (CLASS_TYPE_P (NODE) && TYPE_LANG_SPECIFIC (NODE)->anon_aggr)
+ (CLASS_TYPE_P (NODE) && LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr)
#define SET_ANON_AGGR_TYPE_P(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->anon_aggr = 1)
+ (LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr = 1)
/* Nonzero if TYPE is an anonymous union type. */
#define ANON_UNION_TYPE_P(NODE) \
@@ -2659,7 +2755,7 @@ enum ptrmemfunc_vbit_where_t
/* Define fields and accessors for nodes representing declared names. */
-#define TYPE_WAS_ANONYMOUS(NODE) (TYPE_LANG_SPECIFIC (NODE)->was_anonymous)
+#define TYPE_WAS_ANONYMOUS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->was_anonymous)
/* C++: all of these are overloaded! These apply only to TYPE_DECLs. */
@@ -2684,7 +2780,7 @@ enum ptrmemfunc_vbit_where_t
For example, if a member that would normally be public in a
derived class is made protected, then the derived class and the
protected_access_node will appear in the DECL_ACCESS for the node. */
-#define DECL_ACCESS(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.u2.access)
+#define DECL_ACCESS(NODE) (LANG_DECL_U2_CHECK (NODE, 0)->access)
/* Nonzero if the FUNCTION_DECL is a global constructor. */
#define DECL_GLOBAL_CTOR_P(NODE) \
@@ -2699,7 +2795,7 @@ enum ptrmemfunc_vbit_where_t
with lower numbers should be run first. Destructors should be run
in the reverse order of constructors. */
#define GLOBAL_INIT_PRIORITY(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->decl_flags.u2.init_priority)
+ (LANG_DECL_U2_CHECK (NODE, 1)->init_priority)
/* Accessor macros for C++ template decl nodes. */
@@ -2882,7 +2978,7 @@ enum ptrmemfunc_vbit_where_t
i.e., an instantiation whose instantiation arguments involve
template types. */
#define PARTIAL_INSTANTIATION_P(TYPE) \
- (TYPE_LANG_SPECIFIC (TYPE)->is_partial_instantiation)
+ (LANG_TYPE_CLASS_CHECK (TYPE)->is_partial_instantiation)
/* Non-zero iff we are currently processing a declaration for an
entity with its own template parameter list, and which is not a
@@ -2947,7 +3043,7 @@ enum ptrmemfunc_vbit_where_t
is always located at offset zero from the f `this' pointer.) If
NULL, then there is no vcall offset. */
#define THUNK_VCALL_OFFSET(DECL) \
- (DECL_LANG_SPECIFIC (DECL)->decl_flags.u2.vcall_offset)
+ (LANG_DECL_U2_CHECK (DECL, 0)->vcall_offset)
/* These macros provide convenient access to the various _STMT nodes
created when parsing template declarations. */
@@ -3124,7 +3220,7 @@ extern int warn_nontemplate_friend;
/* in decl{2}.c */
/* A node that is a list (length 1) of error_mark_nodes. */
-extern tree error_mark_list;
+extern GTY(()) tree error_mark_list;
/* Node for "pointer to (virtual) function".
This may be distinct from ptr_type_node so gdb can distinguish them. */
@@ -3132,9 +3228,10 @@ extern tree error_mark_list;
/* For building calls to `delete'. */
-extern tree integer_two_node, integer_three_node;
+extern GTY(()) tree integer_two_node;
+extern GTY(()) tree integer_three_node;
-extern tree anonymous_namespace_name;
+extern GTY(()) tree anonymous_namespace_name;
/* The number of function bodies which we are currently processing.
(Zero if we are at namespace scope, one inside the body of a
@@ -3165,13 +3262,9 @@ typedef enum unification_kind_t {
extern int current_class_depth;
-/* Points to the name of that function. May not be the DECL_NAME
- of CURRENT_FUNCTION_DECL due to overloading */
-extern tree original_function_name;
-
/* An array of all local classes present in this translation unit, in
declaration order. */
-extern varray_type local_classes;
+extern GTY(()) varray_type local_classes;
/* Here's where we control how name mangling takes place. */
@@ -3331,8 +3424,8 @@ extern int at_eof;
/* Functions called along with real static constructors and destructors. */
-extern tree static_ctors;
-extern tree static_dtors;
+extern GTY(()) tree static_ctors;
+extern GTY(()) tree static_dtors;
enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
@@ -3652,7 +3745,8 @@ extern void insert_block PARAMS ((tree));
extern void set_block PARAMS ((tree));
extern tree pushdecl PARAMS ((tree));
extern void cxx_init_decl_processing PARAMS ((void));
-extern void cxx_mark_tree PARAMS ((tree));
+enum cp_tree_node_structure_enum cp_tree_node_structure
+ PARAMS ((union lang_tree_node *));
extern void cxx_insert_default_attributes PARAMS ((tree));
extern bool cxx_mark_addressable PARAMS ((tree));
extern void cxx_push_function_context PARAMS ((struct function *));
@@ -3669,13 +3763,13 @@ extern void finish_scope PARAMS ((void));
extern void note_level_for_for PARAMS ((void));
extern void note_level_for_try PARAMS ((void));
extern void note_level_for_catch PARAMS ((void));
-extern void resume_level PARAMS ((struct binding_level *));
+extern void resume_level PARAMS ((struct cp_binding_level *));
extern void delete_block PARAMS ((tree));
extern void add_block_current_level PARAMS ((tree));
extern void pushlevel_class PARAMS ((void));
extern void poplevel_class PARAMS ((void));
extern void print_binding_stack PARAMS ((void));
-extern void print_binding_level PARAMS ((struct binding_level *));
+extern void print_binding_level PARAMS ((struct cp_binding_level *));
extern void push_namespace PARAMS ((tree));
extern void pop_namespace PARAMS ((void));
extern void push_nested_namespace PARAMS ((tree));
@@ -3764,7 +3858,7 @@ extern tree finish_method PARAMS ((tree));
extern void maybe_register_incomplete_var PARAMS ((tree));
extern void complete_vars PARAMS ((tree));
extern void finish_stmt PARAMS ((void));
-extern void print_other_binding_stack PARAMS ((struct binding_level *));
+extern void print_other_binding_stack PARAMS ((struct cp_binding_level *));
extern void revert_static_member_fn PARAMS ((tree));
extern void fixup_anonymous_aggr PARAMS ((tree));
extern int check_static_variable_definition PARAMS ((tree, tree));
@@ -3799,7 +3893,6 @@ extern tmpl_spec_kind current_tmpl_spec_kind PARAMS ((int));
extern tree cp_fname_init PARAMS ((const char *));
/* in decl2.c */
-extern void init_decl2 PARAMS ((void));
extern int check_java_method PARAMS ((tree));
extern int cxx_decode_option PARAMS ((int, char **));
extern int grok_method_quals PARAMS ((tree, tree, tree));
@@ -3857,9 +3950,6 @@ extern tree get_guard PARAMS ((tree));
extern tree get_guard_cond PARAMS ((tree));
extern tree set_guard PARAMS ((tree));
-/* in parse.y */
-extern void cp_parse_init PARAMS ((void));
-
extern void cp_error_at PARAMS ((const char *msgid, ...));
extern void cp_warning_at PARAMS ((const char *msgid, ...));
extern void cp_pedwarn_at PARAMS ((const char *msgid, ...));
@@ -3968,7 +4058,6 @@ extern tree make_aggr_type PARAMS ((enum tree_code));
extern void compiler_error PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1;
extern void yyerror PARAMS ((const char *));
-extern void clear_inline_text_obstack PARAMS ((void));
extern void yyhook PARAMS ((int));
extern int cp_type_qual_from_rid PARAMS ((tree));
extern const char *cxx_init PARAMS ((const char *));
@@ -3992,7 +4081,6 @@ extern int calls_setjmp_p PARAMS ((tree));
extern int maybe_clone_body PARAMS ((tree));
/* in pt.c */
-extern void init_pt PARAMS ((void));
extern void check_template_shadow PARAMS ((tree));
extern tree get_innermost_template_args PARAMS ((tree, int));
extern tree tsubst PARAMS ((tree, tree, tsubst_flags_t, tree));
@@ -4192,7 +4280,6 @@ extern tree begin_class_definition PARAMS ((tree));
extern tree finish_class_definition PARAMS ((tree, tree, int, int));
extern void finish_default_args PARAMS ((void));
extern void begin_inline_definitions PARAMS ((void));
-extern void finish_inline_definitions PARAMS ((void));
extern tree finish_member_class_template PARAMS ((tree));
extern void finish_template_decl PARAMS ((tree));
extern tree finish_template_type PARAMS ((tree, tree, int));
@@ -4219,7 +4306,6 @@ extern tree finish_global_stmt_expr PARAMS ((tree));
/* in spew.c */
extern void init_spew PARAMS ((void));
-extern void mark_pending_inlines PARAMS ((PTR));
extern int peekyylex PARAMS ((void));
extern tree arbitrate_lookup PARAMS ((tree, tree, tree));
extern tree frob_opname PARAMS ((tree));
@@ -4232,8 +4318,10 @@ extern void replace_defarg PARAMS ((tree, tree));
extern void end_input PARAMS ((void));
/* in tree.c */
-extern tree stabilize_expr PARAMS ((tree, tree *));
-extern tree cxx_unsave_expr_now PARAMS ((tree));
+extern void lang_check_failed PARAMS ((const char *, int,
+ const char *));
+extern tree stabilize_expr PARAMS ((tree, tree *));
+extern tree cxx_unsave_expr_now PARAMS ((tree));
extern tree cxx_maybe_build_cleanup PARAMS ((tree));
extern void init_tree PARAMS ((void));
extern int pod_type_p PARAMS ((tree));
@@ -4242,7 +4330,8 @@ extern tree canonical_type_variant PARAMS ((tree));
extern void unshare_base_binfos PARAMS ((tree));
extern int member_p PARAMS ((tree));
extern cp_lvalue_kind real_lvalue_p PARAMS ((tree));
-extern tree build_min PARAMS ((enum tree_code, tree, ...));
+extern tree build_min PARAMS ((enum tree_code, tree,
+ ...));
extern tree build_min_nt PARAMS ((enum tree_code, ...));
extern tree build_cplus_new PARAMS ((tree, tree));
extern tree get_target_expr PARAMS ((tree));
@@ -4275,8 +4364,7 @@ extern tree vec_binfo_member PARAMS ((tree, tree));
extern tree decl_namespace_context PARAMS ((tree));
extern tree lvalue_type PARAMS ((tree));
extern tree error_type PARAMS ((tree));
-extern tree build_ptr_wrapper PARAMS ((void *));
-extern tree build_int_wrapper PARAMS ((int));
+extern tree build_zc_wrapper PARAMS ((struct z_candidate *));
extern tree build_srcloc_here PARAMS ((void));
extern int varargs_function_p PARAMS ((tree));
extern int really_overloaded_fn PARAMS ((tree));
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index dbaf685..de6a293 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -41,23 +41,24 @@ Boston, MA 02111-1307, USA. */
#include "output.h"
#include "except.h"
#include "toplev.h"
-#include "../hash.h"
+#include "hashtab.h"
#include "ggc.h"
#include "tm_p.h"
#include "target.h"
#include "c-common.h"
#include "c-pragma.h"
#include "diagnostic.h"
+#include "debug.h"
static tree grokparms PARAMS ((tree));
static const char *redeclaration_error_message PARAMS ((tree, tree));
-static void push_binding_level PARAMS ((struct binding_level *, int,
+static void push_binding_level PARAMS ((struct cp_binding_level *, int,
int));
static void pop_binding_level PARAMS ((void));
static void suspend_binding_level PARAMS ((void));
-static void resume_binding_level PARAMS ((struct binding_level *));
-static struct binding_level *make_binding_level PARAMS ((void));
+static void resume_binding_level PARAMS ((struct cp_binding_level *));
+static struct cp_binding_level *make_binding_level PARAMS ((void));
static void declare_namespace_level PARAMS ((void));
static int decl_jump_unsafe PARAMS ((tree));
static void storedecls PARAMS ((tree));
@@ -77,9 +78,9 @@ static tree grokfndecl PARAMS ((tree, tree, tree, tree, int,
static tree grokvardecl PARAMS ((tree, tree, RID_BIT_TYPE *, int, int, tree));
static tree follow_tag_typedef PARAMS ((tree));
static tree lookup_tag PARAMS ((enum tree_code, tree,
- struct binding_level *, int));
+ struct cp_binding_level *, int));
static void set_identifier_type_value_with_scope
- PARAMS ((tree, tree, struct binding_level *));
+ PARAMS ((tree, tree, struct cp_binding_level *));
static void record_unknown_type PARAMS ((tree, const char *));
static tree builtin_function_1 PARAMS ((const char *, tree, tree, int,
enum built_in_class, const char *));
@@ -87,11 +88,11 @@ static tree build_library_fn_1 PARAMS ((tree, enum tree_code, tree));
static int member_function_or_else PARAMS ((tree, tree, enum overload_flags));
static void bad_specifiers PARAMS ((tree, const char *, int, int, int, int,
int));
-static tree maybe_process_template_type_declaration PARAMS ((tree, int, struct binding_level*));
+static tree maybe_process_template_type_declaration PARAMS ((tree, int, struct cp_binding_level*));
static void check_for_uninitialized_const_var PARAMS ((tree));
-static unsigned long typename_hash PARAMS ((hash_table_key));
-static bool typename_compare PARAMS ((hash_table_key, hash_table_key));
-static void push_binding PARAMS ((tree, tree, struct binding_level*));
+static hashval_t typename_hash PARAMS ((const void *));
+static int typename_compare PARAMS ((const void *, const void *));
+static void push_binding PARAMS ((tree, tree, struct cp_binding_level*));
static int add_binding PARAMS ((tree, tree));
static void pop_binding PARAMS ((tree, tree));
static tree local_variable_p_walkfn PARAMS ((tree *, int *, void *));
@@ -102,17 +103,17 @@ static tree qualify_lookup PARAMS ((tree, int));
static tree record_builtin_java_type PARAMS ((const char *, int));
static const char *tag_name PARAMS ((enum tag_types code));
static void find_class_binding_level PARAMS ((void));
-static struct binding_level *innermost_nonclass_level PARAMS ((void));
+static struct cp_binding_level *innermost_nonclass_level PARAMS ((void));
static void warn_about_implicit_typename_lookup PARAMS ((tree, tree));
static int walk_namespaces_r PARAMS ((tree, walk_namespaces_fn, void *));
static int walk_globals_r PARAMS ((tree, void *));
-static void add_decl_to_level PARAMS ((tree, struct binding_level *));
+static void add_decl_to_level PARAMS ((tree, struct cp_binding_level *));
static tree make_label_decl PARAMS ((tree, int));
static void use_label PARAMS ((tree));
-static void check_previous_goto_1 PARAMS ((tree, struct binding_level *, tree,
+static void check_previous_goto_1 PARAMS ((tree, struct cp_binding_level *, tree,
const char *, int));
static void check_previous_goto PARAMS ((struct named_label_use_list *));
-static void check_switch_goto PARAMS ((struct binding_level *));
+static void check_switch_goto PARAMS ((struct cp_binding_level *));
static void check_previous_gotos PARAMS ((tree));
static void pop_label PARAMS ((tree, tree));
static void pop_labels PARAMS ((tree));
@@ -121,10 +122,6 @@ static void layout_var_decl PARAMS ((tree));
static void maybe_commonize_var PARAMS ((tree));
static tree check_initializer PARAMS ((tree, tree));
static void make_rtl_for_nonlocal_decl PARAMS ((tree, tree, const char *));
-static void mark_binding_level PARAMS ((void *));
-static void mark_named_label_lists PARAMS ((void *, void *));
-static void mark_saved_scope PARAMS ((void *));
-static void mark_lang_function PARAMS ((struct cp_language_function *));
static void save_function_data PARAMS ((tree));
static void check_function_type PARAMS ((tree, tree));
static void destroy_local_var PARAMS ((tree));
@@ -146,7 +143,7 @@ static tree build_cp_library_fn PARAMS ((tree, enum tree_code, tree));
static void store_parm_decls PARAMS ((tree));
static int cp_missing_noreturn_ok_p PARAMS ((tree));
-#if defined (DEBUG_CP_BINDING_LEVELS)
+#if defined (DEBUG_BINDING_LEVELS)
static void indent PARAMS ((void));
#endif
@@ -203,7 +200,7 @@ tree cp_global_trees[CPTI_MAX];
/* Indicates that there is a type value in some namespace, although
that is not necessarily in scope at the moment. */
-static tree global_type_node;
+static GTY(()) tree global_type_node;
/* Expect only namespace names now. */
static int only_namespace_names;
@@ -211,9 +208,9 @@ static int only_namespace_names;
/* Used only for jumps to as-yet undefined labels, since jumps to
defined labels can have their validity checked immediately. */
-struct named_label_use_list
+struct named_label_use_list GTY(())
{
- struct binding_level *binding_level;
+ struct cp_binding_level *binding_level;
tree names_in_scope;
tree label_decl;
const char *filename_o_goto;
@@ -244,9 +241,9 @@ tree last_function_parms;
we can clear out their names' definitions at the end of the
function, and so we can check the validity of jumps to these labels. */
-struct named_label_list
+struct named_label_list GTY(())
{
- struct binding_level *binding_level;
+ struct cp_binding_level *binding_level;
tree names_in_scope;
tree old_value;
tree label_decl;
@@ -283,10 +280,6 @@ extern int flag_conserve_space;
/* C and C++ flags are in decl2.c. */
-/* A expression of value 0 with the same precision as a sizetype
- node, but signed. */
-tree signed_size_zero_node;
-
/* The name of the anonymous namespace, throughout this translation
unit. */
tree anonymous_namespace_name;
@@ -337,7 +330,7 @@ int adding_implicit_members = 0;
/* Note that the information in the `names' component of the global contour
is duplicated in the IDENTIFIER_GLOBAL_VALUEs of all identifiers. */
-struct binding_level
+struct cp_binding_level GTY(())
{
/* A chain of _DECL nodes for all variables, constants, functions,
and typedef types. These are in the reverse of the order
@@ -387,7 +380,7 @@ struct binding_level
tree this_class;
/* The binding level which this one is contained in (inherits from). */
- struct binding_level *level_chain;
+ struct cp_binding_level *level_chain;
/* List of VAR_DECLS saved from a previous for statement.
These would be dead in ISO-conforming code, but might
@@ -438,13 +431,11 @@ struct binding_level
/* Three bits left for this word. */
-#if defined(DEBUG_CP_BINDING_LEVELS)
/* Binding depth at which this level began. */
unsigned binding_depth;
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
};
-#define NULL_BINDING_LEVEL ((struct binding_level *) NULL)
+#define NULL_BINDING_LEVEL ((struct cp_binding_level *) NULL)
/* The binding level currently in effect. */
@@ -459,13 +450,13 @@ struct binding_level
/* A chain of binding_level structures awaiting reuse. */
-static struct binding_level *free_binding_level;
+static GTY((deletable (""))) struct cp_binding_level *free_binding_level;
/* The outermost binding level, for names of file scope.
This is created when the compiler is started and exists
through the entire run. */
-static struct binding_level *global_binding_level;
+static GTY(()) struct cp_binding_level *global_binding_level;
/* Nonzero means unconditionally make a BLOCK for the next level pushed. */
@@ -475,9 +466,9 @@ static int keep_next_level_flag;
UNION_TYPE; the TREE_VALUE is a VAR_DECL with that type. At the
time the VAR_DECL was declared, the type was incomplete. */
-static tree incomplete_vars;
+static GTY(()) tree incomplete_vars;
-#if defined(DEBUG_CP_BINDING_LEVELS)
+#if defined(DEBUG_BINDING_LEVELS)
static int binding_depth = 0;
static int is_class_level = 0;
@@ -489,32 +480,32 @@ indent ()
for (i = 0; i < binding_depth*2; i++)
putc (' ', stderr);
}
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
+#endif /* defined(DEBUG_BINDING_LEVELS) */
-static tree pushdecl_with_scope PARAMS ((tree, struct binding_level *));
+static tree pushdecl_with_scope PARAMS ((tree, struct cp_binding_level *));
static void
push_binding_level (newlevel, tag_transparent, keep)
- struct binding_level *newlevel;
+ struct cp_binding_level *newlevel;
int tag_transparent, keep;
{
/* Add this level to the front of the chain (stack) of levels that
are active. */
- memset ((char*) newlevel, 0, sizeof (struct binding_level));
+ memset ((char*) newlevel, 0, sizeof (struct cp_binding_level));
newlevel->level_chain = current_binding_level;
current_binding_level = newlevel;
newlevel->tag_transparent = tag_transparent;
newlevel->more_cleanups_ok = 1;
newlevel->keep = keep;
-#if defined(DEBUG_CP_BINDING_LEVELS)
+#if defined(DEBUG_BINDING_LEVELS)
newlevel->binding_depth = binding_depth;
indent ();
fprintf (stderr, "push %s level 0x%08x line %d\n",
(is_class_level) ? "class" : "block", newlevel, lineno);
is_class_level = 0;
binding_depth++;
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
+#endif /* defined(DEBUG_BINDING_LEVELS) */
}
/* Find the innermost enclosing class scope, and reset
@@ -523,7 +514,7 @@ push_binding_level (newlevel, tag_transparent, keep)
static void
find_class_binding_level ()
{
- struct binding_level *level = current_binding_level;
+ struct cp_binding_level *level = current_binding_level;
while (level && level->parm_flag != 2)
level = level->level_chain;
@@ -543,7 +534,7 @@ pop_binding_level ()
abort ();
}
/* Pop the current level, and free the structure for reuse. */
-#if defined(DEBUG_CP_BINDING_LEVELS)
+#if defined(DEBUG_BINDING_LEVELS)
binding_depth--;
indent ();
fprintf (stderr, "pop %s level 0x%08x line %d\n",
@@ -555,15 +546,15 @@ pop_binding_level ()
fprintf (stderr, "XXX is_class_level != (current_binding_level == class_binding_level)\n");
}
is_class_level = 0;
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
+#endif /* defined(DEBUG_BINDING_LEVELS) */
{
- register struct binding_level *level = current_binding_level;
+ register struct cp_binding_level *level = current_binding_level;
current_binding_level = current_binding_level->level_chain;
level->level_chain = free_binding_level;
-#if 0 /* defined(DEBUG_CP_BINDING_LEVELS) */
+#if 0 /* defined(DEBUG_BINDING_LEVELS) */
if (level->binding_depth != binding_depth)
abort ();
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
+#endif /* defined(DEBUG_BINDING_LEVELS) */
free_binding_level = level;
find_class_binding_level ();
}
@@ -582,7 +573,7 @@ suspend_binding_level ()
abort ();
}
/* Suspend the current level. */
-#if defined(DEBUG_CP_BINDING_LEVELS)
+#if defined(DEBUG_BINDING_LEVELS)
binding_depth--;
indent ();
fprintf (stderr, "suspend %s level 0x%08x line %d\n",
@@ -594,14 +585,14 @@ suspend_binding_level ()
fprintf (stderr, "XXX is_class_level != (current_binding_level == class_binding_level)\n");
}
is_class_level = 0;
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
+#endif /* defined(DEBUG_BINDING_LEVELS) */
current_binding_level = current_binding_level->level_chain;
find_class_binding_level ();
}
static void
resume_binding_level (b)
- struct binding_level *b;
+ struct cp_binding_level *b;
{
/* Resuming binding levels is meant only for namespaces,
and those cannot nest into classes. */
@@ -609,24 +600,24 @@ resume_binding_level (b)
/* Also, resuming a non-directly nested namespace is a no-no. */
my_friendly_assert(b->level_chain == current_binding_level, 386);
current_binding_level = b;
-#if defined(DEBUG_CP_BINDING_LEVELS)
+#if defined(DEBUG_BINDING_LEVELS)
b->binding_depth = binding_depth;
indent ();
fprintf (stderr, "resume %s level 0x%08x line %d\n",
(is_class_level) ? "class" : "block", b, lineno);
is_class_level = 0;
binding_depth++;
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
+#endif /* defined(DEBUG_BINDING_LEVELS) */
}
-/* Create a new `struct binding_level'. */
+/* Create a new `struct cp_binding_level'. */
static
-struct binding_level *
+struct cp_binding_level *
make_binding_level ()
{
/* NOSTRICT */
- return (struct binding_level *) xmalloc (sizeof (struct binding_level));
+ return (struct cp_binding_level *) ggc_alloc (sizeof (struct cp_binding_level));
}
/* Nonzero if we are currently in the global binding level. */
@@ -639,10 +630,10 @@ global_bindings_p ()
/* Return the innermost binding level that is not for a class scope. */
-static struct binding_level *
+static struct cp_binding_level *
innermost_nonclass_level ()
{
- struct binding_level *b;
+ struct cp_binding_level *b;
b = current_binding_level;
while (b->parm_flag == 2)
@@ -660,7 +651,7 @@ innermost_nonclass_level ()
int
toplevel_bindings_p ()
{
- struct binding_level *b = innermost_nonclass_level ();
+ struct cp_binding_level *b = innermost_nonclass_level ();
return b->namespace_p || b->template_parms_p;
}
@@ -672,7 +663,7 @@ toplevel_bindings_p ()
int
namespace_bindings_p ()
{
- struct binding_level *b = innermost_nonclass_level ();
+ struct cp_binding_level *b = innermost_nonclass_level ();
return b->namespace_p;
}
@@ -726,7 +717,7 @@ current_tmpl_spec_kind (n_class_scopes)
int n_template_parm_scopes = 0;
int seen_specialization_p = 0;
int innermost_specialization_p = 0;
- struct binding_level *b;
+ struct cp_binding_level *b;
/* Scan through the template parameter scopes. */
for (b = current_binding_level; b->template_parms_p; b = b->level_chain)
@@ -819,17 +810,17 @@ void
pushlevel (tag_transparent)
int tag_transparent;
{
- struct binding_level *newlevel;
+ struct cp_binding_level *newlevel;
if (cfun && !doing_semantic_analysis_p ())
return;
/* Reuse or create a struct for this binding level. */
-#if defined(DEBUG_CP_BINDING_LEVELS)
+#if defined(DEBUG_BINDING_LEVELS)
if (0)
-#else /* !defined(DEBUG_CP_BINDING_LEVELS) */
+#else /* !defined(DEBUG_BINDING_LEVELS) */
if (free_binding_level)
-#endif /* !defined(DEBUG_CP_BINDING_LEVELS) */
+#endif /* !defined(DEBUG_BINDING_LEVELS) */
{
newlevel = free_binding_level;
free_binding_level = free_binding_level->level_chain;
@@ -914,14 +905,14 @@ note_level_for_catch ()
}
/* For a binding between a name and an entity at a block scope,
- this is the `struct binding_level' for the block. */
+ this is the `struct cp_binding_level' for the block. */
#define BINDING_LEVEL(NODE) \
(((struct tree_binding*)(NODE))->scope.level)
/* A free list of CPLUS_BINDING nodes, connected by their
TREE_CHAINs. */
-static tree free_bindings;
+static GTY((deletable (""))) tree free_bindings;
/* Make DECL the innermost binding for ID. The LEVEL is the binding
level at which this declaration is being bound. */
@@ -930,7 +921,7 @@ static void
push_binding (id, decl, level)
tree id;
tree decl;
- struct binding_level* level;
+ struct cp_binding_level* level;
{
tree binding;
@@ -1033,7 +1024,7 @@ add_binding (id, decl)
static void
add_decl_to_level (decl, b)
tree decl;
- struct binding_level *b;
+ struct cp_binding_level *b;
{
/* We build up the list in reverse order, and reverse it later if
necessary. */
@@ -1052,7 +1043,7 @@ push_local_binding (id, decl, flags)
tree decl;
int flags;
{
- struct binding_level *b;
+ struct cp_binding_level *b;
/* Skip over any local classes. This makes sense if we call
push_local_binding with a friend decl of a local class. */
@@ -1303,7 +1294,7 @@ poplevel (keep, reverse, functionbody)
under constraints of next binding contour. */
if (cfun && !functionbody)
{
- struct binding_level *level_chain;
+ struct cp_binding_level *level_chain;
level_chain = current_binding_level->level_chain;
if (level_chain)
{
@@ -1626,14 +1617,14 @@ set_block (block)
void
pushlevel_class ()
{
- register struct binding_level *newlevel;
+ register struct cp_binding_level *newlevel;
/* Reuse or create a struct for this binding level. */
-#if defined(DEBUG_CP_BINDING_LEVELS)
+#if defined(DEBUG_BINDING_LEVELS)
if (0)
-#else /* !defined(DEBUG_CP_BINDING_LEVELS) */
+#else /* !defined(DEBUG_BINDING_LEVELS) */
if (free_binding_level)
-#endif /* !defined(DEBUG_CP_BINDING_LEVELS) */
+#endif /* !defined(DEBUG_BINDING_LEVELS) */
{
newlevel = free_binding_level;
free_binding_level = free_binding_level->level_chain;
@@ -1641,9 +1632,9 @@ pushlevel_class ()
else
newlevel = make_binding_level ();
-#if defined(DEBUG_CP_BINDING_LEVELS)
+#if defined(DEBUG_BINDING_LEVELS)
is_class_level = 1;
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
+#endif /* defined(DEBUG_BINDING_LEVELS) */
push_binding_level (newlevel, 0, 0);
@@ -1657,7 +1648,7 @@ pushlevel_class ()
void
poplevel_class ()
{
- register struct binding_level *level = class_binding_level;
+ register struct cp_binding_level *level = class_binding_level;
tree shadowed;
my_friendly_assert (level != 0, 354);
@@ -1669,7 +1660,7 @@ poplevel_class ()
next time we're entering a class scope, it is the same class. */
if (current_class_depth != 1)
{
- struct binding_level* b;
+ struct cp_binding_level* b;
/* Clear out our IDENTIFIER_CLASS_VALUEs. */
for (shadowed = level->class_shadowed;
@@ -1719,9 +1710,9 @@ poplevel_class ()
/* Now, pop out of the binding level which we created up in the
`pushlevel_class' routine. */
-#if defined(DEBUG_CP_BINDING_LEVELS)
+#if defined(DEBUG_BINDING_LEVELS)
is_class_level = 1;
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
+#endif /* defined(DEBUG_BINDING_LEVELS) */
pop_binding_level ();
}
@@ -1931,57 +1922,13 @@ wrapup_globals_for_namespace (namespace, data)
}
-/* Mark ARG (which is really a struct binding_level **) for GC. */
-
-static void
-mark_binding_level (arg)
- void *arg;
-{
- struct binding_level *lvl = *(struct binding_level **)arg;
-
- for (; lvl; lvl = lvl->level_chain)
- {
- ggc_mark_tree (lvl->names);
- ggc_mark_tree (lvl->tags);
- ggc_mark_tree (lvl->usings);
- ggc_mark_tree (lvl->using_directives);
- ggc_mark_tree (lvl->class_shadowed);
- ggc_mark_tree (lvl->type_shadowed);
- ggc_mark_tree (lvl->shadowed_labels);
- ggc_mark_tree (lvl->blocks);
- ggc_mark_tree (lvl->this_class);
- ggc_mark_tree (lvl->dead_vars_from_for);
- }
-}
-
-static void
-mark_named_label_lists (labs, uses)
- void *labs;
- void *uses;
-{
- struct named_label_list *l = *(struct named_label_list **)labs;
- struct named_label_use_list *u = *(struct named_label_use_list **)uses;
-
- for (; l; l = l->next)
- {
- ggc_mark (l);
- mark_binding_level (l->binding_level);
- ggc_mark_tree (l->old_value);
- ggc_mark_tree (l->label_decl);
- ggc_mark_tree (l->bad_decls);
- }
-
- for (; u; u = u->next)
- ggc_mark (u);
-}
-
/* For debugging. */
static int no_print_functions = 0;
static int no_print_builtins = 0;
void
print_binding_level (lvl)
- struct binding_level *lvl;
+ struct cp_binding_level *lvl;
{
tree t;
int i = 0, len;
@@ -2082,9 +2029,9 @@ print_binding_level (lvl)
void
print_other_binding_stack (stack)
- struct binding_level *stack;
+ struct cp_binding_level *stack;
{
- struct binding_level *level;
+ struct cp_binding_level *level;
for (level = stack; level != global_binding_level; level = level->level_chain)
{
fprintf (stderr, "binding level ");
@@ -2097,7 +2044,7 @@ print_other_binding_stack (stack)
void
print_binding_stack ()
{
- struct binding_level *b;
+ struct cp_binding_level *b;
fprintf (stderr, "current_binding_level=");
fprintf (stderr, HOST_PTR_PRINTF, current_binding_level);
fprintf (stderr, "\nclass_binding_level=");
@@ -2363,38 +2310,6 @@ pop_nested_namespace (ns)
scope isn't enough, because more binding levels may be pushed. */
struct saved_scope *scope_chain;
-/* Mark ARG (which is really a struct saved_scope **) for GC. */
-
-static void
-mark_saved_scope (arg)
- void *arg;
-{
- struct saved_scope *t = *(struct saved_scope **)arg;
- while (t)
- {
- mark_binding_level (&t->class_bindings);
- ggc_mark_tree (t->old_bindings);
- ggc_mark_tree (t->old_namespace);
- ggc_mark_tree (t->decl_ns_list);
- ggc_mark_tree (t->class_name);
- ggc_mark_tree (t->class_type);
- ggc_mark_tree (t->access_specifier);
- ggc_mark_tree (t->function_decl);
- if (t->lang_base)
- ggc_mark_tree_varray (t->lang_base);
- ggc_mark_tree (t->lang_name);
- ggc_mark_tree (t->template_parms);
- ggc_mark_tree (t->x_previous_class_type);
- ggc_mark_tree (t->x_previous_class_values);
- ggc_mark_tree (t->x_saved_tree);
- ggc_mark_tree (t->lookups);
-
- mark_stmt_tree (&t->x_stmt_tree);
- mark_binding_level (&t->bindings);
- t = t->prev;
- }
-}
-
static tree
store_bindings (names, old_bindings)
tree names, old_bindings;
@@ -2443,11 +2358,11 @@ maybe_push_to_top_level (pseudo)
int pseudo;
{
struct saved_scope *s;
- struct binding_level *b;
+ struct cp_binding_level *b;
tree old_bindings;
int need_pop;
- s = (struct saved_scope *) xcalloc (1, sizeof (struct saved_scope));
+ s = (struct saved_scope *) ggc_alloc_cleared (sizeof (struct saved_scope));
b = scope_chain ? current_binding_level : 0;
@@ -2517,7 +2432,7 @@ pop_from_top_level ()
if (previous_class_type)
invalidate_class_lookup_cache ();
- VARRAY_FREE (current_lang_base);
+ current_lang_base = 0;
scope_chain = s->prev;
for (t = s->old_bindings; t; t = TREE_CHAIN (t))
@@ -2535,8 +2450,6 @@ pop_from_top_level ()
pop_function_context_from (NULL_TREE);
current_function_decl = s->function_decl;
last_function_parms = s->last_parms;
-
- free (s);
}
/* Push a definition of struct, union or enum tag "name".
@@ -2556,7 +2469,7 @@ static void
set_identifier_type_value_with_scope (id, type, b)
tree id;
tree type;
- struct binding_level *b;
+ struct cp_binding_level *b;
{
if (!b->namespace_p)
{
@@ -2613,7 +2526,7 @@ identifier_type_value (id)
void
pop_everything ()
{
-#ifdef DEBUG_CP_BINDING_LEVELS
+#ifdef DEBUG_BINDING_LEVELS
fprintf (stderr, "XXX entering pop_everything ()\n");
#endif
while (!toplevel_bindings_p ())
@@ -2623,7 +2536,7 @@ pop_everything ()
else
poplevel (0, 0, 0);
}
-#ifdef DEBUG_CP_BINDING_LEVELS
+#ifdef DEBUG_BINDING_LEVELS
fprintf (stderr, "XXX leaving pop_everything ()\n");
#endif
}
@@ -2641,7 +2554,7 @@ static tree
maybe_process_template_type_declaration (type, globalize, b)
tree type;
int globalize;
- struct binding_level* b;
+ struct cp_binding_level* b;
{
tree decl = TYPE_NAME (type);
@@ -2739,6 +2652,7 @@ push_local_name (decl)
{
if (!DECL_LANG_SPECIFIC (decl))
retrofit_lang_decl (decl);
+ DECL_LANG_SPECIFIC (decl)->decl_flags.u2sel = 1;
if (DECL_LANG_SPECIFIC (t))
DECL_DISCRIMINATOR (decl) = DECL_DISCRIMINATOR (t) + 1;
else
@@ -2762,7 +2676,7 @@ pushtag (name, type, globalize)
tree name, type;
int globalize;
{
- register struct binding_level *b;
+ register struct cp_binding_level *b;
b = current_binding_level;
while (b->tag_transparent
@@ -2893,7 +2807,7 @@ make_anon_name ()
void
clear_anon_tags ()
{
- register struct binding_level *b;
+ register struct cp_binding_level *b;
register tree tags;
static int last_cnt = 0;
@@ -3654,7 +3568,8 @@ duplicate_decls (newdecl, olddecl)
/* Don't really know how much of the language-specific
values we should copy from old to new. */
DECL_IN_AGGR_P (newdecl) = DECL_IN_AGGR_P (olddecl);
- DECL_ACCESS (newdecl) = DECL_ACCESS (olddecl);
+ DECL_LANG_SPECIFIC (newdecl)->decl_flags.u2 =
+ DECL_LANG_SPECIFIC (olddecl)->decl_flags.u2;
DECL_NONCONVERTING_P (newdecl) = DECL_NONCONVERTING_P (olddecl);
DECL_TEMPLATE_INFO (newdecl) = DECL_TEMPLATE_INFO (olddecl);
DECL_INITIALIZED_IN_CLASS_P (newdecl)
@@ -4212,7 +4127,7 @@ pushdecl (x)
{
/* Go to where the parms should be and see if we find
them there. */
- struct binding_level *b = current_binding_level->level_chain;
+ struct cp_binding_level *b = current_binding_level->level_chain;
/* ARM $8.3 */
if (b->parm_flag == 1)
@@ -4271,9 +4186,9 @@ pushdecl (x)
static tree
pushdecl_with_scope (x, level)
tree x;
- struct binding_level *level;
+ struct cp_binding_level *level;
{
- register struct binding_level *b;
+ register struct cp_binding_level *b;
tree function_decl = current_function_decl;
current_function_decl = NULL_TREE;
@@ -4302,7 +4217,7 @@ tree
pushdecl_namespace_level (x)
tree x;
{
- register struct binding_level *b = current_binding_level;
+ register struct cp_binding_level *b = current_binding_level;
register tree t;
t = pushdecl_with_scope (x, NAMESPACE_LEVEL (current_namespace));
@@ -4945,14 +4860,14 @@ decl_jump_unsafe (decl)
static void
check_previous_goto_1 (decl, level, names, file, line)
tree decl;
- struct binding_level *level;
+ struct cp_binding_level *level;
tree names;
const char *file;
int line;
{
int identified = 0;
int saw_eh = 0;
- struct binding_level *b = current_binding_level;
+ struct cp_binding_level *b = current_binding_level;
for (; b; b = b->level_chain)
{
tree new_decls = b->names;
@@ -5019,7 +4934,7 @@ check_previous_goto (use)
static void
check_switch_goto (level)
- struct binding_level *level;
+ struct cp_binding_level *level;
{
check_previous_goto_1 (NULL_TREE, level, level->names, NULL, 0);
}
@@ -5121,7 +5036,7 @@ define_label (filename, line, name)
{
tree decl = lookup_label (name);
struct named_label_list *ent;
- register struct binding_level *p;
+ register struct cp_binding_level *p;
for (ent = named_labels; ent; ent = ent->next)
if (ent->label_decl == decl)
@@ -5159,7 +5074,7 @@ define_label (filename, line, name)
struct cp_switch
{
- struct binding_level *level;
+ struct cp_binding_level *level;
struct cp_switch *next;
/* The SWITCH_STMT being built. */
tree switch_stmt;
@@ -5215,7 +5130,7 @@ finish_case_label (low_value, high_value)
tree high_value;
{
tree cond, r;
- register struct binding_level *p;
+ register struct cp_binding_level *p;
if (! switch_stack)
{
@@ -5353,10 +5268,10 @@ static tree
lookup_tag (form, name, binding_level, thislevel_only)
enum tree_code form;
tree name;
- struct binding_level *binding_level;
+ struct cp_binding_level *binding_level;
int thislevel_only;
{
- register struct binding_level *level;
+ register struct cp_binding_level *level;
/* Non-zero if, we should look past a template parameter level, even
if THISLEVEL_ONLY. */
int allow_template_parms_p = 1;
@@ -5472,7 +5387,7 @@ lookup_tag_reverse (type, name)
tree type;
tree name;
{
- register struct binding_level *level;
+ register struct cp_binding_level *level;
for (level = current_binding_level; level; level = level->level_chain)
{
@@ -5572,26 +5487,25 @@ lookup_namespace_name (namespace, name)
/* Hash a TYPENAME_TYPE. K is really of type `tree'. */
-static unsigned long
+static hashval_t
typename_hash (k)
- hash_table_key k;
+ const void * k;
{
- unsigned long hash;
- tree t;
+ hashval_t hash;
+ tree t = (tree) k;
- t = (tree) k;
- hash = (((unsigned long) TYPE_CONTEXT (t))
- ^ ((unsigned long) DECL_NAME (TYPE_NAME (t))));
+ hash = (((hashval_t) TYPE_CONTEXT (t))
+ ^ ((hashval_t) DECL_NAME (TYPE_NAME (t))));
return hash;
}
/* Compare two TYPENAME_TYPEs. K1 and K2 are really of type `tree'. */
-static bool
+static int
typename_compare (k1, k2)
- hash_table_key k1;
- hash_table_key k2;
+ const void * k1;
+ const void * k2;
{
tree t1;
tree t2;
@@ -5604,7 +5518,7 @@ typename_compare (k1, k2)
d2 = TYPE_NAME (t2);
return (DECL_NAME (d1) == DECL_NAME (d2)
- && same_type_p (TYPE_CONTEXT (t1), TYPE_CONTEXT (t2))
+ && TYPE_CONTEXT (t1) == TYPE_CONTEXT (t2)
&& ((TREE_TYPE (t1) != NULL_TREE)
== (TREE_TYPE (t2) != NULL_TREE))
&& same_type_p (TREE_TYPE (t1), TREE_TYPE (t2))
@@ -5619,6 +5533,8 @@ typename_compare (k1, k2)
Returns the new TYPENAME_TYPE. */
+static GTY ((param_is (union tree_node))) htab_t typename_htab;
+
tree
build_typename_type (context, name, fullname, base_type)
tree context;
@@ -5628,16 +5544,12 @@ build_typename_type (context, name, fullname, base_type)
{
tree t;
tree d;
- struct hash_entry *e;
+ PTR *e;
- static struct hash_table ht;
-
- if (!ht.table)
+ if (typename_htab == NULL)
{
- static struct hash_table *h = &ht;
-
- hash_table_init (&ht, &hash_newfunc, &typename_hash, &typename_compare);
- ggc_add_tree_hash_table_root (&h, 1);
+ typename_htab = htab_create_ggc (61, &typename_hash,
+ &typename_compare, NULL);
}
/* Build the TYPENAME_TYPE. */
@@ -5654,12 +5566,11 @@ build_typename_type (context, name, fullname, base_type)
DECL_ARTIFICIAL (d) = 1;
/* See if we already have this type. */
- e = hash_lookup (&ht, t, /*create=*/false, /*copy=*/0);
- if (e)
- t = (tree) e->key;
+ e = htab_find_slot (typename_htab, t, INSERT);
+ if (*e)
+ t = (tree) *e;
else
- /* Insert the type into the table. */
- hash_lookup (&ht, t, /*create=*/true, /*copy=*/0);
+ *e = t;
return t;
}
@@ -5890,7 +5801,7 @@ unqualified_namespace_lookup (name, flags, spacesp)
tree initial = current_decl_namespace ();
tree scope = initial;
tree siter;
- struct binding_level *level;
+ struct cp_binding_level *level;
tree val = NULL_TREE;
if (spacesp)
@@ -6238,7 +6149,7 @@ tree
lookup_name_current_level (name)
tree name;
{
- struct binding_level *b;
+ struct cp_binding_level *b;
tree t = NULL_TREE;
b = current_binding_level;
@@ -6284,7 +6195,7 @@ lookup_type_current_level (name)
if (REAL_IDENTIFIER_TYPE_VALUE (name) != NULL_TREE
&& REAL_IDENTIFIER_TYPE_VALUE (name) != global_type_node)
{
- struct binding_level *b = current_binding_level;
+ struct cp_binding_level *b = current_binding_level;
while (1)
{
if (purpose_member (name, b->type_shadowed))
@@ -6476,10 +6387,6 @@ cxx_init_decl_processing ()
/* Fill in back-end hooks. */
lang_missing_noreturn_ok_p = &cp_missing_noreturn_ok_p;
- cp_parse_init ();
- init_decl2 ();
- init_pt ();
-
/* Create the global variables. */
push_to_top_level ();
@@ -6554,9 +6461,6 @@ cxx_init_decl_processing ()
boolean_true_node = build_int_2 (1, 0);
TREE_TYPE (boolean_true_node) = boolean_type_node;
- signed_size_zero_node = build_int_2 (0, 0);
- TREE_TYPE (signed_size_zero_node) = make_signed_type (TYPE_PRECISION (sizetype));
-
empty_except_spec = build_tree_list (NULL_TREE, NULL_TREE);
#if 0
@@ -6666,36 +6570,6 @@ cxx_init_decl_processing ()
say -fwritable-strings? */
if (flag_writable_strings)
flag_const_strings = 0;
-
- /* Add GC roots for all of our global variables. */
- ggc_add_tree_root (c_global_trees, ARRAY_SIZE (c_global_trees));
- ggc_add_tree_root (cp_global_trees, ARRAY_SIZE (cp_global_trees));
- ggc_add_tree_root (&integer_three_node, 1);
- ggc_add_tree_root (&integer_two_node, 1);
- ggc_add_tree_root (&signed_size_zero_node, 1);
- ggc_add_tree_root (&size_one_node, 1);
- ggc_add_tree_root (&size_zero_node, 1);
- ggc_add_root (&global_binding_level, 1, sizeof global_binding_level,
- mark_binding_level);
- ggc_add_root (&scope_chain, 1, sizeof scope_chain, &mark_saved_scope);
- ggc_add_tree_root (&static_ctors, 1);
- ggc_add_tree_root (&static_dtors, 1);
- ggc_add_tree_root (&lastiddecl, 1);
-
- ggc_add_tree_root (&last_function_parms, 1);
- ggc_add_tree_root (&error_mark_list, 1);
-
- ggc_add_tree_root (&global_namespace, 1);
- ggc_add_tree_root (&global_type_node, 1);
- ggc_add_tree_root (&anonymous_namespace_name, 1);
-
- ggc_add_tree_root (&got_object, 1);
- ggc_add_tree_root (&got_scope, 1);
-
- ggc_add_tree_root (&current_lang_name, 1);
- ggc_add_tree_root (&static_aggregates, 1);
- ggc_add_tree_root (&free_bindings, 1);
- ggc_add_tree_root (&incomplete_vars, 1);
}
/* Generate an initializer for a function naming variable from
@@ -8017,7 +7891,7 @@ maybe_inject_for_scope_var (decl)
if (current_binding_level->is_for_scope)
{
- struct binding_level *outer
+ struct cp_binding_level *outer
= current_binding_level->level_chain;
/* Check to see if the same name is already bound at the outer
@@ -10097,7 +9971,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (decl_context == NORMAL && !toplevel_bindings_p ())
{
- struct binding_level *b = current_binding_level;
+ struct cp_binding_level *b = current_binding_level;
current_binding_level = b->level_chain;
if (current_binding_level != 0 && toplevel_bindings_p ())
decl_context = PARM;
@@ -12804,7 +12678,7 @@ xref_tag (code_type_node, name, globalize)
enum tag_types tag_code;
enum tree_code code;
register tree ref, t;
- struct binding_level *b = current_binding_level;
+ struct cp_binding_level *b = current_binding_level;
tree attributes = NULL_TREE;
tree context = NULL_TREE;
@@ -13000,14 +12874,14 @@ xref_tag (code_type_node, name, globalize)
}
else
{
- struct binding_level *old_b = class_binding_level;
+ struct cp_binding_level *old_b = class_binding_level;
ref = make_aggr_type (code);
TYPE_CONTEXT (ref) = context;
#ifdef NONNESTED_CLASSES
/* Class types don't nest the way enums do. */
- class_binding_level = (struct binding_level *)0;
+ class_binding_level = (struct cp_binding_level *)0;
#endif
pushtag (name, ref, globalize);
class_binding_level = old_b;
@@ -13239,7 +13113,7 @@ start_enum (name)
tree name;
{
register tree enumtype = NULL_TREE;
- struct binding_level *b = current_binding_level;
+ struct cp_binding_level *b = current_binding_level;
/* If this is the real definition for a previous forward reference,
fill in the contents in the same object that used to be the
@@ -13586,7 +13460,7 @@ start_function (declspecs, declarator, attrs, flags)
extern int have_extern_spec;
extern int used_extern_spec;
int doing_friend = 0;
- struct binding_level *bl;
+ struct cp_binding_level *bl;
tree current_function_parms;
/* Sanity check. */
@@ -13810,12 +13684,8 @@ start_function (declspecs, declarator, attrs, flags)
/* If we are (erroneously) defining a function that we have already
defined before, wipe out what we knew before. */
- if (!DECL_PENDING_INLINE_P (decl1)
- && DECL_SAVED_FUNCTION_DATA (decl1))
- {
- free (DECL_SAVED_FUNCTION_DATA (decl1));
- DECL_SAVED_FUNCTION_DATA (decl1) = NULL;
- }
+ if (!DECL_PENDING_INLINE_P (decl1))
+ DECL_SAVED_FUNCTION_DATA (decl1) = NULL;
if (ctype && !doing_friend && !DECL_STATIC_FUNCTION_P (decl1))
{
@@ -14024,7 +13894,7 @@ static void
save_function_data (decl)
tree decl;
{
- struct cp_language_function *f;
+ struct language_function *f;
/* Save the language-specific per-function data so that we can
get it back when we really expand this function. */
@@ -14032,9 +13902,9 @@ save_function_data (decl)
19990908);
/* Make a copy. */
- f = ((struct cp_language_function *)
- xmalloc (sizeof (struct cp_language_function)));
- memcpy (f, cp_function_chain, sizeof (struct cp_language_function));
+ f = ((struct language_function *)
+ ggc_alloc (sizeof (struct language_function)));
+ memcpy (f, cp_function_chain, sizeof (struct language_function));
DECL_SAVED_FUNCTION_DATA (decl) = f;
/* Clear out the bits we don't need. */
@@ -14105,7 +13975,6 @@ begin_destructor_body ()
appropriately, so we just assume that we always need to
initialize the vtables.) */
finish_if_stmt_cond (boolean_true_node, if_stmt);
- current_vcalls_possible_p = &IF_COND (if_stmt);
compound_stmt = begin_compound_stmt (/*has_no_scope=*/0);
@@ -14688,10 +14557,10 @@ void
cxx_push_function_context (f)
struct function *f;
{
- struct cp_language_function *p
- = ((struct cp_language_function *)
- xcalloc (1, sizeof (struct cp_language_function)));
- f->language = (struct language_function *) p;
+ struct language_function *p
+ = ((struct language_function *)
+ ggc_alloc_cleared (sizeof (struct language_function)));
+ f->language = p;
/* It takes an explicit call to expand_body to generate RTL for a
function. */
@@ -14709,137 +14578,27 @@ void
cxx_pop_function_context (f)
struct function *f;
{
- if (f->language)
- {
- struct cp_language_function *cp =
- (struct cp_language_function *) f->language;
- if (cp->x_local_names)
- VARRAY_FREE (cp->x_local_names);
- free (f->language);
- }
f->language = 0;
}
-/* Mark P for GC. */
-
-static void
-mark_lang_function (p)
- struct cp_language_function *p;
-{
- if (!p)
- return;
-
- mark_c_language_function (&p->base);
-
- ggc_mark_tree (p->x_dtor_label);
- ggc_mark_tree (p->x_current_class_ptr);
- ggc_mark_tree (p->x_current_class_ref);
- ggc_mark_tree (p->x_eh_spec_block);
- ggc_mark_tree_varray (p->x_local_names);
-
- mark_named_label_lists (&p->x_named_labels, &p->x_named_label_uses);
- mark_binding_level (&p->bindings);
- mark_pending_inlines (&p->unparsed_inlines);
-}
+/* Return which tree structure is used by T, or TS_CP_GENERIC if T is
+ one of the language-independent trees. */
-/* Mark the language-specific data in F for GC. */
-
-void
-cxx_mark_function_context (f)
- struct function *f;
-{
- mark_lang_function ((struct cp_language_function *) f->language);
-}
-
-void
-cxx_mark_tree (t)
- tree t;
+enum cp_tree_node_structure_enum
+cp_tree_node_structure (t)
+ union lang_tree_node *t;
{
- enum tree_code code = TREE_CODE (t);
- if (code == IDENTIFIER_NODE)
+ switch (TREE_CODE (&t->generic))
{
- struct lang_identifier *li = (struct lang_identifier *) t;
- struct lang_id2 *li2 = li->x;
- ggc_mark_tree (li->namespace_bindings);
- ggc_mark_tree (li->bindings);
- ggc_mark_tree (li->class_value);
- ggc_mark_tree (li->class_template_info);
-
- if (li2)
- {
- ggc_mark_tree (li2->label_value);
- ggc_mark_tree (li2->implicit_decl);
- ggc_mark_tree (li2->error_locus);
- }
- }
- else if (code == CPLUS_BINDING)
- {
- if (BINDING_HAS_LEVEL_P (t))
- mark_binding_level (&BINDING_LEVEL (t));
- else
- ggc_mark_tree (BINDING_SCOPE (t));
- ggc_mark_tree (BINDING_VALUE (t));
- }
- else if (code == OVERLOAD)
- ggc_mark_tree (OVL_FUNCTION (t));
- else if (code == TEMPLATE_PARM_INDEX)
- ggc_mark_tree (TEMPLATE_PARM_DECL (t));
- else if (TREE_CODE_CLASS (code) == 'd')
- {
- struct lang_decl *ld = DECL_LANG_SPECIFIC (t);
-
- if (ld)
- {
- ggc_mark (ld);
- c_mark_lang_decl (&ld->decl_flags.base);
- if (!DECL_GLOBAL_CTOR_P (t)
- && !DECL_GLOBAL_DTOR_P (t)
- && !DECL_THUNK_P (t)
- && !DECL_DISCRIMINATOR_P (t))
- ggc_mark_tree (ld->decl_flags.u2.access);
- else if (DECL_THUNK_P (t))
- ggc_mark_tree (ld->decl_flags.u2.vcall_offset);
- if (TREE_CODE (t) != NAMESPACE_DECL)
- ggc_mark_tree (ld->decl_flags.u.template_info);
- else
- mark_binding_level (&NAMESPACE_LEVEL (t));
- if (CAN_HAVE_FULL_LANG_DECL_P (t))
- {
- ggc_mark_tree (ld->befriending_classes);
- ggc_mark_tree (ld->context);
- ggc_mark_tree (ld->cloned_function);
- if (TREE_CODE (t) == TYPE_DECL)
- ggc_mark_tree (ld->u.sorted_fields);
- else if (TREE_CODE (t) == FUNCTION_DECL
- && !DECL_PENDING_INLINE_P (t))
- mark_lang_function (DECL_SAVED_FUNCTION_DATA (t));
- }
- }
- }
- else if (TREE_CODE_CLASS (code) == 't')
- {
- struct lang_type *lt = TYPE_LANG_SPECIFIC (t);
-
- if (lt && !(TREE_CODE (t) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (t)) == METHOD_TYPE))
- {
- ggc_mark (lt);
- ggc_mark_tree (lt->primary_base);
- ggc_mark_tree (lt->vfields);
- ggc_mark_tree (lt->vbases);
- ggc_mark_tree (lt->tags);
- ggc_mark_tree (lt->size);
- ggc_mark_tree (lt->pure_virtuals);
- ggc_mark_tree (lt->friend_classes);
- ggc_mark_tree (lt->rtti);
- ggc_mark_tree (lt->methods);
- ggc_mark_tree (lt->template_info);
- ggc_mark_tree (lt->befriending_classes);
- }
- else if (lt)
- /* In the case of pointer-to-member function types, the
- TYPE_LANG_SPECIFIC is really just a tree. */
- ggc_mark_tree ((tree) lt);
+ case DEFAULT_ARG: return TS_CP_IDENTIFIER;
+ case IDENTIFIER_NODE: return TS_CP_IDENTIFIER;
+ case CPLUS_BINDING: return TS_CP_BINDING;
+ case OVERLOAD: return TS_CP_OVERLOAD;
+ case TEMPLATE_PARM_INDEX: return TS_CP_TPI;
+ case PTRMEM_CST: return TS_CP_PTRMEM;
+ case WRAPPER: return TS_CP_WRAPPER;
+ case SRCLOC: return TS_CP_SRCLOC;
+ default: return TS_CP_GENERIC;
}
}
@@ -14869,3 +14628,6 @@ cp_missing_noreturn_ok_p (decl)
/* A missing noreturn is ok for the `main' function. */
return DECL_MAIN_P (decl);
}
+
+#include "gt-cp-decl.h"
+#include "gtype-cp.h"
diff --git a/gcc/cp/decl.h b/gcc/cp/decl.h
index 2316f06..eeac80f 100644
--- a/gcc/cp/decl.h
+++ b/gcc/cp/decl.h
@@ -36,13 +36,13 @@ extern tree grokdeclarator PARAMS ((tree, tree, enum decl_context, int,
/* Parsing a function declarator leaves a list of parameter names
or a chain or parameter decls here. */
-extern tree last_function_parms;
+extern GTY(()) tree last_function_parms;
/* A list of objects which have constructors or destructors
which reside in the global scope. The decl is stored in
the TREE_VALUE slot and the initializer is stored
in the TREE_PURPOSE slot. */
-extern tree static_aggregates;
+extern GTY(()) tree static_aggregates;
#ifdef DEBUG_CP_BINDING_LEVELS
/* Purely for debugging purposes. */
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 238bde8..c63c48b 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -95,13 +95,13 @@ static tree get_guard_bits PARAMS ((tree));
/* A list of static class variables. This is needed, because a
static class variable can be declared inside the class without
an initializer, and then initialized, statically, outside the class. */
-static varray_type pending_statics;
+static GTY(()) varray_type pending_statics;
#define pending_statics_used \
(pending_statics ? pending_statics->elements_used : 0)
/* A list of functions which were declared inline, but which we
may need to emit outline anyway. */
-static varray_type deferred_fns;
+static GTY(()) varray_type deferred_fns;
#define deferred_fns_used \
(deferred_fns ? deferred_fns->elements_used : 0)
@@ -2712,6 +2712,7 @@ start_objects (method_type, initp)
DECL_GLOBAL_CTOR_P (current_function_decl) = 1;
else
DECL_GLOBAL_DTOR_P (current_function_decl) = 1;
+ DECL_LANG_SPECIFIC (current_function_decl)->decl_flags.u2sel = 1;
GLOBAL_INIT_PRIORITY (current_function_decl) = initp;
body = begin_compound_stmt (/*has_no_scope=*/0);
@@ -2768,17 +2769,17 @@ finish_objects (method_type, initp, body)
#define SSDF_IDENTIFIER "__static_initialization_and_destruction"
/* The declaration for the __INITIALIZE_P argument. */
-static tree initialize_p_decl;
+static GTY(()) tree initialize_p_decl;
/* The declaration for the __PRIORITY argument. */
-static tree priority_decl;
+static GTY(()) tree priority_decl;
/* The declaration for the static storage duration function. */
-static tree ssdf_decl;
+static GTY(()) tree ssdf_decl;
/* All the static storage duration functions created in this
translation unit. */
-static varray_type ssdf_decls;
+static GTY(()) varray_type ssdf_decls;
/* A map from priority levels to information about that priority
level. There may be many such levels, so efficient lookup is
@@ -5280,15 +5281,4 @@ handle_class_head (aggr, scope, id, defn_p, new_type_p)
return decl;
}
-/* Initialize decl2.c. */
-
-void
-init_decl2 ()
-{
- ggc_add_tree_varray_root (&deferred_fns, 1);
- ggc_add_tree_varray_root (&pending_statics, 1);
- ggc_add_tree_varray_root (&ssdf_decls, 1);
- ggc_add_tree_root (&ssdf_decl, 1);
- ggc_add_tree_root (&priority_decl, 1);
- ggc_add_tree_root (&initialize_p_decl, 1);
-}
+#include "gt-cp-decl2.h"
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 7be5acb..dad7df6 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -1434,6 +1434,12 @@ retrofit_lang_decl (t)
ld = (struct lang_decl *) ggc_alloc_cleared (size);
+ ld->decl_flags.can_be_full = CAN_HAVE_FULL_LANG_DECL_P (t) ? 1 : 0;
+ ld->decl_flags.u1sel = TREE_CODE (t) == NAMESPACE_DECL ? 1 : 0;
+ ld->decl_flags.u2sel = 0;
+ if (ld->decl_flags.can_be_full)
+ ld->u.f.u3sel = TREE_CODE (t) == FUNCTION_DECL ? 1 : 0;
+
DECL_LANG_SPECIFIC (t) = ld;
if (current_lang_name == lang_name_cplusplus)
SET_DECL_LANGUAGE (t, lang_cplusplus);
@@ -1498,7 +1504,10 @@ copy_lang_type (node)
if (! TYPE_LANG_SPECIFIC (node))
return;
- size = sizeof (struct lang_type);
+ if (TYPE_LANG_SPECIFIC (node)->u.h.is_lang_type_class)
+ size = sizeof (struct lang_type);
+ else
+ size = sizeof (struct lang_type_ptrmem);
lt = (struct lang_type *) ggc_alloc (size);
memcpy (lt, TYPE_LANG_SPECIFIC (node), size);
TYPE_LANG_SPECIFIC (node) = lt;
@@ -1538,6 +1547,7 @@ cxx_make_type (code)
ggc_alloc_cleared (sizeof (struct lang_type)));
TYPE_LANG_SPECIFIC (t) = pi;
+ pi->u.c.h.is_lang_type_class = 1;
#ifdef GATHER_STATISTICS
tree_node_counts[(int)lang_type] += 1;
diff --git a/gcc/cp/lex.h b/gcc/cp/lex.h
index 9f86833..15de168 100644
--- a/gcc/cp/lex.h
+++ b/gcc/cp/lex.h
@@ -68,15 +68,15 @@ typedef unsigned long RID_BIT_TYPE; /* assumed at least 32 bits */
yylex must look this up to detect typedefs, which get token type TYPENAME,
so it is left around in case the identifier is not a typedef but is
used in a context which makes it a reference to a variable. */
-extern tree lastiddecl;
+extern GTY(()) tree lastiddecl;
/* Back-door communication channel to the lexer. */
extern int looking_for_typename;
extern int looking_for_template;
/* Tell the lexer where to look for names. */
-extern tree got_scope;
-extern tree got_object;
+extern GTY(()) tree got_scope;
+extern GTY(()) tree got_object;
/* Pending language change.
Positive is push count, negative is pop count. */
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 8365b03..12888ac 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -2166,6 +2166,7 @@ write_substitution (seq_id)
static inline void
start_mangling ()
{
+ VARRAY_TREE_INIT (G.substitutions, 1, "mangling substitutions");
obstack_free (&G.name_obstack, obstack_base (&G.name_obstack));
}
@@ -2175,7 +2176,7 @@ static inline const char *
finish_mangling ()
{
/* Clear all the substitutions. */
- VARRAY_POP_ALL (G.substitutions);
+ G.substitutions = 0;
/* Null-terminate the string. */
write_char ('\0');
@@ -2189,7 +2190,6 @@ void
init_mangle ()
{
gcc_obstack_init (&G.name_obstack);
- VARRAY_TREE_INIT (G.substitutions, 1, "mangling substitutions");
/* Cache these identifiers for quick comparison when checking for
standard substitutions. */
diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y
index b6abd0b..e815add 100644
--- a/gcc/cp/parse.y
+++ b/gcc/cp/parse.y
@@ -103,21 +103,21 @@ int have_extern_spec;
int used_extern_spec;
/* List of types and structure classes of the current declaration. */
-static tree current_declspecs;
+static GTY(()) tree current_declspecs;
/* List of prefix attributes in effect.
Prefix attributes are parsed by the reserved_declspecs and declmods
rules. They create a list that contains *both* declspecs and attrs. */
/* ??? It is not clear yet that all cases where an attribute can now appear in
a declspec list have been updated. */
-static tree prefix_attributes;
+static GTY(()) tree prefix_attributes;
/* When defining an enumeration, this is the type of the enumeration. */
-static tree current_enum_type;
+static GTY(()) tree current_enum_type;
/* When parsing a conversion operator name, this is the scope of the
operator itself. */
-static tree saved_scopes;
+static GTY(()) tree saved_scopes;
static tree empty_parms PARAMS ((void));
static tree parse_decl0 PARAMS ((tree, tree, tree, tree, int));
@@ -263,19 +263,11 @@ check_class_key (key, aggr)
: key == record_type_node ? "struct" : "class", aggr);
}
-void
-cp_parse_init ()
-{
- ggc_add_tree_root (&current_declspecs, 1);
- ggc_add_tree_root (&prefix_attributes, 1);
- ggc_add_tree_root (&current_enum_type, 1);
- ggc_add_tree_root (&saved_scopes, 1);
-}
%}
%start program
-%union {
+%union { GTY(())
long itype;
tree ttype;
char *strtype;
@@ -388,7 +380,7 @@ cp_parse_init ()
%type <ttype> paren_expr_or_null nontrivial_exprlist SELFNAME
%type <ttype> expr_no_commas expr_no_comma_rangle
%type <ttype> cast_expr unary_expr primary STRING
-%type <ttype> reserved_declspecs boolean.literal
+%type <ttype> reserved_declspecs boolean_literal
%type <ttype> reserved_typespecquals
%type <ttype> SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier
%type <ttype> init initlist maybeasm maybe_init defarg defarg1
@@ -436,13 +428,13 @@ cp_parse_init ()
%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 constructor_declarator
-%type <ttype> .begin_function_body
+%type <ttype> fn_def2 return_id constructor_declarator
+%type <ttype> begin_function_body_
%type <ttype> class_head class_head_apparent_template
%type <ftype> class_head_decl class_head_defn
%type <ttype> base_class_list
%type <ttype> base_class_access_list
-%type <ttype> base_class maybe_base_class_list base_class.1
+%type <ttype> base_class maybe_base_class_list base_class_1
%type <ttype> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
%type <ttype> operator_name
%type <ttype> object aggr
@@ -470,7 +462,7 @@ cp_parse_init ()
%token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
%type <ttype> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
%type <ttype> handler_args
-%type <ttype> self_template_type .finish_template_type
+%type <ttype> self_template_type finish_template_type_
%token NSNAME
%type <ttype> NSNAME
@@ -815,7 +807,7 @@ eat_saved_input:
mem-initializer-list, so we open one there and suppress the one that
actually corresponds to the curly braces. */
function_body:
- .begin_function_body ctor_initializer_opt save_lineno '{'
+ begin_function_body_ ctor_initializer_opt save_lineno '{'
{ $<ttype>$ = begin_compound_stmt (/*has_no_scope=*/1); }
compstmtend
{
@@ -909,7 +901,7 @@ component_constructor_declarator:
/* more C++ complexity. See component_decl for a comment on the
reduce/reduce conflict introduced by these rules. */
-fn.def2:
+fn_def2:
declmods component_constructor_declarator
{ $$ = parse_method ($2, $1.t, $1.lookups);
rest_of_mdef:
@@ -963,7 +955,7 @@ base_init:
}
;
-.begin_function_body:
+begin_function_body_:
/* empty */
{
$$ = begin_function_body ();
@@ -1095,10 +1087,10 @@ end_explicit_instantiation:
template_type:
PTYPENAME '<' template_arg_list_opt template_close_bracket
- .finish_template_type
+ finish_template_type_
{ $$ = $5; }
| TYPENAME '<' template_arg_list_opt template_close_bracket
- .finish_template_type
+ finish_template_type_
{ $$ = $5; }
| self_template_type
;
@@ -1106,17 +1098,17 @@ template_type:
apparent_template_type:
template_type
| identifier '<' template_arg_list_opt '>'
- .finish_template_type
+ finish_template_type_
{ $$ = $5; }
;
self_template_type:
SELFNAME '<' template_arg_list_opt template_close_bracket
- .finish_template_type
+ finish_template_type_
{ $$ = $5; }
;
-.finish_template_type:
+finish_template_type_:
{
if (yychar == YYEMPTY)
yychar = YYLEX;
@@ -1615,7 +1607,7 @@ primary:
$$ = finish_id_expr ($1);
}
| CONSTANT
- | boolean.literal
+ | boolean_literal
| STRING
{
$$ = fix_string_type ($$);
@@ -1813,7 +1805,7 @@ delete:
{ got_scope = NULL_TREE; $$ = 1; }
;
-boolean.literal:
+boolean_literal:
CXX_TRUE
{ $$ = boolean_true_node; }
| CXX_FALSE
@@ -2372,7 +2364,6 @@ structsp:
}
pending_inlines
{
- finish_inline_definitions ();
$$.t = $<ttype>8;
$$.new_type_flag = 1;
}
@@ -2550,13 +2541,13 @@ base_class_list:
;
base_class:
- base_class.1
+ base_class_1
{ $$ = finish_base_specifier (access_default_node, $1); }
- | base_class_access_list see_typename base_class.1
+ | base_class_access_list see_typename base_class_1
{ $$ = finish_base_specifier ($1, $3); }
;
-base_class.1:
+base_class_1:
typename_sub
{ if (!TYPE_P ($$))
$$ = error_mark_node; }
@@ -2632,13 +2623,13 @@ component_decl:
yyungetc ('}', 0); }
/* C++: handle constructors, destructors and inline functions */
/* note that INLINE is like a TYPESPEC */
- | fn.def2 ':' /* base_init compstmt */
+ | fn_def2 ':' /* base_init compstmt */
{ $$ = finish_method ($$); }
- | fn.def2 TRY /* base_init compstmt */
+ | fn_def2 TRY /* base_init compstmt */
{ $$ = finish_method ($$); }
- | fn.def2 RETURN_KEYWORD /* base_init compstmt */
+ | fn_def2 RETURN_KEYWORD /* base_init compstmt */
{ $$ = finish_method ($$); }
- | fn.def2 '{' /* nodecls compstmt */
+ | fn_def2 '{' /* nodecls compstmt */
{ $$ = finish_method ($$); }
| ';'
{ $$ = NULL_TREE; }
@@ -4026,3 +4017,5 @@ free_parser_stacks ()
free (malloced_yyvs);
}
}
+
+#include "gt-cp-parse.h"
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index e54ab8e..873e5a3 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -56,17 +56,17 @@ extern struct obstack permanent_obstack;
the instantiate request occurred; the TREE_VALUE is a either a DECL
(for a function or static data member), or a TYPE (for a class)
indicating what we are hoping to instantiate. */
-static tree pending_templates;
+static GTY(()) tree pending_templates;
static tree last_pending_template;
int processing_template_parmlist;
static int template_header_count;
-static tree saved_trees;
-static varray_type inline_parm_levels;
+static GTY(()) tree saved_trees;
+static GTY(()) varray_type inline_parm_levels;
static size_t inline_parm_levels_used;
-static tree current_tinst_level;
+static GTY(()) tree current_tinst_level;
/* A map from local variable declarations in the body of the template
presently being instantiated to the corresponding instantiated
@@ -170,16 +170,6 @@ static tree copy_default_args_to_explicit_spec_1 PARAMS ((tree, tree));
static void copy_default_args_to_explicit_spec PARAMS ((tree));
static int invalid_nontype_parm_type_p PARAMS ((tree, tsubst_flags_t));
-/* Called once to initialize pt.c. */
-
-void
-init_pt ()
-{
- ggc_add_tree_root (&pending_templates, 1);
- ggc_add_tree_root (&saved_trees, 1);
- ggc_add_tree_root (&current_tinst_level, 1);
-}
-
/* Do any processing required when DECL (a member template declaration
using TEMPLATE_PARAMETERS as its innermost parameter list) is
finished. Returns the TEMPLATE_DECL corresponding to DECL, unless
@@ -10426,3 +10416,5 @@ invalid_nontype_parm_type_p (type, complain)
type);
return 1;
}
+
+#include "gt-cp-pt.h"
diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c
index fe2eb62..6aacebf 100644
--- a/gcc/cp/repo.c
+++ b/gcc/cp/repo.c
@@ -42,8 +42,8 @@ static void open_repo_file PARAMS ((const char *));
static char *afgets PARAMS ((FILE *));
static void reopen_repo_file_for_write PARAMS ((void));
-static tree pending_repo;
-static tree original_repo;
+static GTY(()) tree pending_repo;
+static GTY(()) tree original_repo;
static char *repo_name;
static FILE *repo_file;
@@ -320,8 +320,6 @@ init_repo (filename)
if (! flag_use_repository)
return;
- ggc_add_tree_root (&pending_repo, 1);
- ggc_add_tree_root (&original_repo, 1);
gcc_obstack_init (&temporary_obstack);
open_repo_file (filename);
@@ -458,3 +456,5 @@ finish_repo ()
if (repo_file)
fclose (repo_file);
}
+
+#include "gt-cp-repo.h"
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 3884158..9617796 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA. */
#include "flags.h"
#include "rtl.h"
#include "output.h"
+#include "ggc.h"
#include "toplev.h"
#define obstack_chunk_alloc xmalloc
@@ -1673,9 +1674,6 @@ bfs_walk (binfo, fn, qfn, data)
}
}
- /* Clean up. */
- VARRAY_FREE (bfs_bases);
-
return rval;
}
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index ce1cbac..bbc2203 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -97,7 +97,7 @@ stmt_tree
current_stmt_tree ()
{
return (cfun
- ? &cfun->language->x_stmt_tree
+ ? &cfun->language->base.x_stmt_tree
: &scope_chain->x_stmt_tree);
}
@@ -109,7 +109,7 @@ int
anon_aggr_type_p (node)
tree node;
{
- return (CLASS_TYPE_P (node) && TYPE_LANG_SPECIFIC(node)->anon_aggr);
+ return ANON_AGGR_TYPE_P (node);
}
/* Finish a scope. */
@@ -1131,7 +1131,7 @@ finish_mem_initializers (init_list)
tree *
current_scope_stmt_stack ()
{
- return &cfun->language->x_scope_stmt_stack;
+ return &cfun->language->base.x_scope_stmt_stack;
}
/* Finish a parenthesized expression EXPR. */
@@ -1882,16 +1882,6 @@ begin_inline_definitions ()
do_pending_inlines ();
}
-/* Finish processing the inline function definitions cached during the
- processing of a class definition. */
-
-void
-finish_inline_definitions ()
-{
- if (current_class_type == NULL_TREE)
- clear_inline_text_obstack ();
-}
-
/* Finish processing the declaration of a member class template
TYPES whose template parameters are given by PARMS. */
@@ -2475,10 +2465,7 @@ genrtl_start_function (fn)
function; we need the named return value info for
cp_copy_res_decl_for_inlining. */
if (! DECL_INLINE (fn))
- {
- free (DECL_SAVED_FUNCTION_DATA (fn));
- DECL_SAVED_FUNCTION_DATA (fn) = NULL;
- }
+ DECL_SAVED_FUNCTION_DATA (fn) = NULL;
}
/* Keep track of how many functions we're presently expanding. */
diff --git a/gcc/cp/spew.c b/gcc/cp/spew.c
index c1aa954..d56f611 100644
--- a/gcc/cp/spew.c
+++ b/gcc/cp/spew.c
@@ -50,12 +50,12 @@ Boston, MA 02111-1307, USA. */
backtracking. */
/* fifo of tokens recognized and available to parser. */
-struct token
+struct token GTY(())
{
/* The values for YYCHAR will fit in a short. */
short yychar;
unsigned int lineno;
- YYSTYPE yylval;
+ YYSTYPE GTY ((desc ("%1.yychar"))) yylval;
};
/* Since inline methods can refer to text which has not yet been seen,
@@ -68,7 +68,14 @@ struct token
This function's FUNCTION_DECL will have a bit set in its common so
that we know to watch out for it. */
-struct unparsed_text
+#define TOKEN_CHUNK_SIZE 20
+struct token_chunk GTY(())
+{
+ struct token_chunk *next;
+ struct token toks[TOKEN_CHUNK_SIZE];
+};
+
+struct unparsed_text GTY(())
{
struct unparsed_text *next; /* process this one next */
tree decl; /* associated declaration */
@@ -76,26 +83,31 @@ struct unparsed_text
int lineno; /* line number we got the text from */
int interface; /* remembering interface_unknown and interface_only */
- struct token *pos; /* current position, when rescanning */
- struct token *limit; /* end of saved text */
+ struct token_chunk * tokens; /* Start of the token list. */
+
+ struct token_chunk *last_chunk; /* End of the token list. */
+ short last_pos; /* Number of tokens used in the last chunk of
+ TOKENS. */
+
+ short cur_pos; /* Current token in 'cur_chunk', when rescanning. */
+ struct token_chunk *cur_chunk; /* Current chunk, when rescanning. */
};
/* Stack of state saved off when we return to an inline method or
default argument that has been stored for later parsing. */
-struct feed
+struct feed GTY(())
{
struct unparsed_text *input;
const char *filename;
int lineno;
int yychar;
- YYSTYPE yylval;
+ YYSTYPE GTY ((desc ("%1.yychar"))) yylval;
int first_token;
- struct obstack token_obstack;
+ struct obstack GTY ((skip (""))) token_obstack;
struct feed *next;
-};
+};
-static struct obstack feed_obstack;
-static struct feed *feed;
+static GTY(()) struct feed *feed;
static SPEW_INLINE void do_aggr PARAMS ((void));
static SPEW_INLINE int identifier_type PARAMS ((tree));
@@ -107,25 +119,32 @@ static int read_token PARAMS ((struct token *));
static SPEW_INLINE int num_tokens PARAMS ((void));
static SPEW_INLINE struct token *nth_token PARAMS ((int));
-static SPEW_INLINE int add_token PARAMS ((struct token *));
+static SPEW_INLINE int next_token PARAMS ((struct token *));
static SPEW_INLINE int shift_token PARAMS ((void));
static SPEW_INLINE void push_token PARAMS ((struct token *));
static SPEW_INLINE void consume_token PARAMS ((void));
static SPEW_INLINE int read_process_identifier PARAMS ((YYSTYPE *));
static SPEW_INLINE void feed_input PARAMS ((struct unparsed_text *));
-static SPEW_INLINE void snarf_block PARAMS ((const char *, int));
+static SPEW_INLINE struct token * space_for_token
+ PARAMS ((struct unparsed_text *t));
+static SPEW_INLINE struct token * remove_last_token
+ PARAMS ((struct unparsed_text *t));
+static struct unparsed_text * alloc_unparsed_text
+ PARAMS ((const char *fn, int li, tree decl, int interface));
+
+static void snarf_block PARAMS ((struct unparsed_text *t));
static tree snarf_defarg PARAMS ((void));
static int frob_id PARAMS ((int, int, tree *));
/* The list of inline functions being held off until we reach the end of
the current class declaration. */
-static struct unparsed_text *pending_inlines;
-static struct unparsed_text *pending_inlines_tail;
+static GTY(()) struct unparsed_text *pending_inlines;
+static GTY(()) struct unparsed_text *pending_inlines_tail;
/* The list of previously-deferred inline functions currently being parsed.
This exists solely to be a GC root. */
-static struct unparsed_text *processing_these_inlines;
+static GTY(()) struct unparsed_text *processing_these_inlines;
static void begin_parsing_inclass_inline PARAMS ((struct unparsed_text *));
@@ -151,13 +170,8 @@ extern int yychar; /* the lookahead symbol */
extern YYSTYPE yylval; /* the semantic value of the */
/* lookahead symbol */
/* The token fifo lives in this obstack. */
-struct obstack token_obstack;
-int first_token;
-
-/* Sometimes we need to save tokens for later parsing. If so, they are
- stored on this obstack. */
-struct obstack inline_text_obstack;
-char *inline_text_firstobj;
+static struct obstack token_obstack;
+static int first_token;
/* When we see a default argument in a method declaration, we snarf it as
text using snarf_defarg. When we get up to namespace scope, we then go
@@ -168,35 +182,21 @@ char *inline_text_firstobj;
the TREE_TYPE is the current_class_type, TREE_VALUE is the FUNCTION_DECL,
and TREE_PURPOSE is the list unprocessed dependent functions. */
-static tree defarg_fns; /* list of functions with unprocessed defargs */
-static tree defarg_parm; /* current default parameter */
-static tree defarg_depfns; /* list of unprocessed fns met during current fn. */
-static tree defarg_fnsdone; /* list of fns with circular defargs */
+/* list of functions with unprocessed defargs */
+static GTY(()) tree defarg_fns;
+/* current default parameter */
+static GTY(()) tree defarg_parm;
+/* list of unprocessed fns met during current fn. */
+static GTY(()) tree defarg_depfns;
+/* list of fns with circular defargs */
+static GTY(()) tree defarg_fnsdone;
/* Initialize obstacks. Called once, from cxx_init. */
void
init_spew ()
{
- gcc_obstack_init (&inline_text_obstack);
- inline_text_firstobj = (char *) obstack_alloc (&inline_text_obstack, 0);
gcc_obstack_init (&token_obstack);
- gcc_obstack_init (&feed_obstack);
- ggc_add_tree_root (&defarg_fns, 1);
- ggc_add_tree_root (&defarg_parm, 1);
- ggc_add_tree_root (&defarg_depfns, 1);
- ggc_add_tree_root (&defarg_fnsdone, 1);
-
- ggc_add_root (&pending_inlines, 1, sizeof (struct unparsed_text *),
- mark_pending_inlines);
- ggc_add_root (&processing_these_inlines, 1, sizeof (struct unparsed_text *),
- mark_pending_inlines);
-}
-
-void
-clear_inline_text_obstack ()
-{
- obstack_free (&inline_text_obstack, inline_text_firstobj);
}
/* Subroutine of read_token. */
@@ -270,8 +270,6 @@ yylexstring (t)
t->yylval.ttype = combine_strings (strings);
last_token_id = t->yylval.ttype;
-
- VARRAY_FREE (strings);
}
/* We will have always read one token too many. */
@@ -396,10 +394,10 @@ feed_input (input)
abort ();
#endif
- f = obstack_alloc (&feed_obstack, sizeof (struct feed));
+ f = ggc_alloc (sizeof (struct feed));
- /* The token list starts just after the struct unparsed_text in memory. */
- input->pos = (struct token *) (input + 1);
+ input->cur_chunk = input->tokens;
+ input->cur_pos = 0;
#ifdef SPEW_DEBUG
if (spew_debug)
@@ -439,48 +437,12 @@ end_input ()
token_obstack = f->token_obstack;
feed = f->next;
- obstack_free (&feed_obstack, f);
-
#ifdef SPEW_DEBUG
if (spew_debug)
fprintf (stderr, "\treturning to %s:%d\n", input_filename, lineno);
#endif
}
-/* GC callback to mark memory pointed to by the pending inline queue. */
-void
-mark_pending_inlines (pi)
- PTR pi;
-{
- struct unparsed_text *up = * (struct unparsed_text **)pi;
-
- while (up)
- {
- struct token *t = (struct token *) (up + 1);
- struct token *l = up->limit;
-
- while (t < l)
- {
- /* Some of the possible values for yychar use yylval.code
- instead of yylval.ttype. We only have to worry about
- yychars that could have been returned by read_token. */
- switch (t->yychar)
- {
- case '+': case '-': case '*': case '/':
- case '%': case '&': case '|': case '^':
- case '>': case '<': case LSHIFT: case RSHIFT:
- case ASSIGN: case MIN_MAX: case EQCOMPARE: case ARITHCOMPARE:
- t++;
- continue;
- }
- if (t->yylval.ttype)
- ggc_mark_tree (t->yylval.ttype);
- t++;
- }
- up = up->next;
- }
-}
-
/* Token queue management. */
/* Return the number of tokens available on the fifo. */
@@ -510,16 +472,24 @@ static const struct token Tpad = { EMPTY, 0 UNION_INIT_ZERO };
/* Copy the next token into T and return its value. */
static SPEW_INLINE int
-add_token (t)
+next_token (t)
struct token *t;
{
if (!feed)
return read_token (t);
- if (feed->input->pos < feed->input->limit)
+ if (feed->input->cur_chunk != feed->input->last_chunk
+ || feed->input->cur_pos != feed->input->last_pos)
{
- memcpy (t, feed->input->pos, sizeof (struct token));
- return (feed->input->pos++)->yychar;
+ if (feed->input->cur_pos == TOKEN_CHUNK_SIZE)
+ {
+ feed->input->cur_chunk = feed->input->cur_chunk->next;
+ feed->input->cur_pos = 0;
+ }
+ memcpy (t, feed->input->cur_chunk->toks + feed->input->cur_pos,
+ sizeof (struct token));
+ feed->input->cur_pos++;
+ return t->yychar;
}
memcpy (t, &Teosi, sizeof (struct token));
@@ -532,7 +502,7 @@ shift_token ()
{
size_t point = obstack_object_size (&token_obstack);
obstack_blank (&token_obstack, sizeof (struct token));
- return add_token ((struct token *) (obstack_base (&token_obstack) + point));
+ return next_token ((struct token *) (obstack_base (&token_obstack) + point));
}
/* Consume the next token out of the fifo. */
@@ -1060,22 +1030,73 @@ process_next_inline (i)
extract_interface_info ();
}
}
+
+/* Create a new token at the end of the token list in T. */
+static SPEW_INLINE struct token *
+space_for_token (t)
+ struct unparsed_text *t;
+{
+ if (t->last_pos != TOKEN_CHUNK_SIZE)
+ return t->last_chunk->toks + (t->last_pos++);
+ t->last_chunk->next = ggc_alloc (sizeof (*t->last_chunk->next));
+ t->last_chunk = t->last_chunk->next;
+ t->last_chunk->next = NULL;
+
+ t->last_pos = 1;
+ return t->last_chunk->toks;
+}
+
+/* Shrink the token list in T by one token. */
+static SPEW_INLINE struct token *
+remove_last_token (t)
+ struct unparsed_text *t;
+{
+ struct token *result = t->last_chunk->toks + t->last_pos - 1;
+ if (t->last_pos == 0)
+ abort ();
+ t->last_pos--;
+ if (t->last_pos == 0 && t->last_chunk != t->tokens)
+ {
+ struct token_chunk **tc;
+ for (tc = &t->tokens; (*tc)->next != NULL; tc = &(*tc)->next)
+ ;
+ *tc = NULL;
+ t->last_pos = sizeof ((*tc)->toks) / sizeof ((*tc)->toks[0]);
+ }
+ return result;
+}
+
+/* Allocate an 'unparsed_text' structure, ready to use space_for_token. */
+static struct unparsed_text *
+alloc_unparsed_text (fn, li, decl, interface)
+ const char *fn;
+ int li;
+ tree decl;
+ int interface;
+{
+ struct unparsed_text *r;
+ r = ggc_alloc_cleared (sizeof (*r));
+ r->decl = decl;
+ r->filename = fn;
+ r->lineno = li;
+ r->interface = interface;
+ r->tokens = r->last_chunk = ggc_alloc_cleared (sizeof (*r->tokens));
+ return r;
+}
/* Subroutine of snarf_method, deals with actual absorption of the block. */
-static SPEW_INLINE void
-snarf_block (starting_file, starting_line)
- const char *starting_file;
- int starting_line;
+static void
+snarf_block (t)
+ struct unparsed_text *t;
{
int blev = 1;
int look_for_semicolon = 0;
int look_for_lbrac = 0;
int look_for_catch = 0;
int yyc;
- struct token tmp;
- size_t point;
+ struct token *current;
if (yychar == '{')
;
@@ -1092,17 +1113,14 @@ snarf_block (starting_file, starting_line)
yyerror ("parse error in method specification");
/* The current token is the first one to be recorded. */
- tmp.yychar = yychar;
- tmp.yylval = yylval;
- tmp.lineno = lineno;
- obstack_grow (&inline_text_obstack, &tmp, sizeof (struct token));
+ current = space_for_token (t);
+ current->yychar = yychar;
+ current->yylval = yylval;
+ current->lineno = lineno;
for (;;)
{
- point = obstack_object_size (&inline_text_obstack);
- obstack_blank (&inline_text_obstack, sizeof (struct token));
- yyc = add_token ((struct token *)
- (obstack_base (&inline_text_obstack) + point));
+ yyc = next_token (space_for_token (t));
if (yyc == '{')
{
@@ -1117,27 +1135,29 @@ snarf_block (starting_file, starting_line)
if (!look_for_catch)
break;
- if (add_token (&tmp) != CATCH)
+ if (next_token (space_for_token (t)) != CATCH)
{
- push_token (&tmp);
+ push_token (remove_last_token (t));
break;
}
look_for_lbrac = 1;
- obstack_grow (&inline_text_obstack, &tmp, sizeof (struct token));
}
}
else if (yyc == ';')
{
if (look_for_lbrac)
{
+ struct token *fake;
+
error ("function body for constructor missing");
/* fake a { } to avoid further errors */
- tmp.yylval.ttype = 0;
- tmp.yychar = '{';
- obstack_grow (&inline_text_obstack, &tmp, sizeof (struct token));
- tmp.yychar = '}';
- obstack_grow (&inline_text_obstack, &tmp, sizeof (struct token));
+ fake = space_for_token (t);
+ fake->yylval.ttype = 0;
+ fake->yychar = '{';
+ fake = space_for_token (t);
+ fake->yylval.ttype = 0;
+ fake->yychar = '}';
break;
}
else if (look_for_semicolon && blev == 0)
@@ -1145,7 +1165,7 @@ snarf_block (starting_file, starting_line)
}
else if (yyc == 0)
{
- error_with_file_and_line (starting_file, starting_line,
+ error_with_file_and_line (t->filename, t->lineno,
"end of file read inside definition");
break;
}
@@ -1160,37 +1180,24 @@ snarf_method (decl)
{
int starting_lineno = lineno;
const char *starting_filename = input_filename;
- size_t len;
-
struct unparsed_text *meth;
- /* Leave room for the header, then absorb the block. */
- obstack_blank (&inline_text_obstack, sizeof (struct unparsed_text));
- snarf_block (starting_filename, starting_lineno);
+ meth = alloc_unparsed_text (starting_filename, starting_lineno, decl,
+ (interface_unknown ? 1
+ : (interface_only ? 0 : 2)));
- len = obstack_object_size (&inline_text_obstack);
- meth = (struct unparsed_text *) obstack_finish (&inline_text_obstack);
+ snarf_block (meth);
/* Happens when we get two declarations of the same function in the
same scope. */
if (decl == void_type_node
|| (current_class_type && TYPE_REDEFINED (current_class_type)))
- {
- obstack_free (&inline_text_obstack, (char *)meth);
- return;
- }
-
- meth->decl = decl;
- meth->filename = starting_filename;
- meth->lineno = starting_lineno;
- meth->limit = (struct token *) ((char *)meth + len);
- meth->interface = (interface_unknown ? 1 : (interface_only ? 0 : 2));
- meth->next = 0;
+ return;
#ifdef SPEW_DEBUG
if (spew_debug)
fprintf (stderr, "\tsaved method of %d tokens from %s:%d\n",
- meth->limit - (struct token *) (meth + 1),
+ meth->limit,
starting_filename, starting_lineno);
#endif
@@ -1204,8 +1211,8 @@ snarf_method (decl)
pending_inlines_tail = meth;
}
-/* Consume a no-commas expression - a default argument - and save it
- on the inline_text_obstack. */
+/* Consume a no-commas expression - a default argument - and return
+ a DEFAULT_ARG tree node. */
static tree
snarf_defarg ()
@@ -1214,19 +1221,14 @@ snarf_defarg ()
const char *starting_filename = input_filename;
int yyc;
int plev = 0;
- size_t point;
- size_t len;
struct unparsed_text *buf;
tree arg;
- obstack_blank (&inline_text_obstack, sizeof (struct unparsed_text));
+ buf = alloc_unparsed_text (starting_filename, starting_lineno, 0, 0);
for (;;)
{
- point = obstack_object_size (&inline_text_obstack);
- obstack_blank (&inline_text_obstack, sizeof (struct token));
- yyc = add_token ((struct token *)
- (obstack_base (&inline_text_obstack) + point));
+ yyc = next_token (space_for_token (buf));
if (plev <= 0 && (yyc == ')' || yyc == ','))
break;
@@ -1243,24 +1245,13 @@ snarf_defarg ()
}
/* Unget the last token. */
- push_token ((struct token *) (obstack_base (&inline_text_obstack) + point));
- /* This is the documented way to shrink a growing obstack block. */
- obstack_blank (&inline_text_obstack, - (int) sizeof (struct token));
+ push_token (remove_last_token (buf));
done:
- len = obstack_object_size (&inline_text_obstack);
- buf = (struct unparsed_text *) obstack_finish (&inline_text_obstack);
-
- buf->decl = 0;
- buf->filename = starting_filename;
- buf->lineno = starting_lineno;
- buf->limit = (struct token *) ((char *)buf + len);
- buf->next = 0;
-
#ifdef SPEW_DEBUG
if (spew_debug)
fprintf (stderr, "\tsaved defarg of %d tokens from %s:%d\n",
- buf->limit - (struct token *) (buf + 1),
+ buf->limit,
starting_filename, starting_lineno);
#endif
@@ -1531,3 +1522,5 @@ yyerror (msgid)
else
error ("%s before `%s' token", string, NAME (last_token));
}
+
+#include "gt-cp-spew.h"
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index a144c6d..0752d7b 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -710,7 +710,7 @@ unshare_base_binfos (binfo)
While all these live in the same table, they are completely independent,
and the hash code is computed differently for each of these. */
-static htab_t list_hash_table;
+static GTY ((param_is (union tree_node))) htab_t list_hash_table;
struct list_proxy
{
@@ -1720,25 +1720,15 @@ cp_tree_equal (t1, t2)
return -1;
}
-/* Build a wrapper around some pointer PTR so we can use it as a tree. */
+/* Build a wrapper around a 'struct z_candidate' so we can use it as a
+ tree. */
tree
-build_ptr_wrapper (ptr)
- void *ptr;
+build_zc_wrapper (ptr)
+ struct z_candidate *ptr;
{
tree t = make_node (WRAPPER);
- WRAPPER_PTR (t) = ptr;
- return t;
-}
-
-/* Build a wrapper around some integer I so we can use it as a tree. */
-
-tree
-build_int_wrapper (i)
- int i;
-{
- tree t = make_node (WRAPPER);
- WRAPPER_INT (t) = i;
+ WRAPPER_ZC (t) = ptr;
return t;
}
@@ -2326,10 +2316,7 @@ void
init_tree ()
{
lang_statement_code_p = cp_statement_code_p;
- list_hash_table = htab_create (31, list_hash, list_hash_eq, NULL);
- ggc_add_root (&list_hash_table, 1,
- sizeof (list_hash_table),
- mark_tree_hashtable);
+ list_hash_table = htab_create_ggc (31, list_hash, list_hash_eq, NULL);
}
/* Called via walk_tree. If *TP points to a DECL_STMT for a local
@@ -2557,3 +2544,20 @@ stabilize_expr (exp, initp)
*initp = init_expr;
return exp;
}
+
+#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
+/* Complain that some language-specific thing hanging off a tree
+ node has been accessed improperly. */
+
+void
+lang_check_failed (file, line, function)
+ const char *file;
+ int line;
+ const char *function;
+{
+ internal_error ("lang_* check: failed in %s, at %s:%d",
+ function, trim_filename (file), line);
+}
+#endif /* ENABLE_TREE_CHECKING */
+
+#include "gt-cp-tree.h"