diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/cp/cp-lang.c | 4 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 1 | ||||
-rw-r--r-- | gcc/cp/init.c | 7 | ||||
-rw-r--r-- | gcc/cp/pt.c | 3 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 11 | ||||
-rw-r--r-- | gcc/cp/tree.c | 24 |
8 files changed, 68 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a0a3f49fb14..443f07fe7be 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,20 @@ +2001-12-05 Jason Merrill <jason@redhat.com> + + * cp-lang.c (LANG_HOOKS_TREE_INLINING_START_INLINING): Define. + (LANG_HOOKS_TREE_INLINING_END_INLINING): Define. + * tree.c (cp_start_inlining, cp_end_inlining): New fns. + * pt.c (push_tinst_level): No longer static. + * cp-tree.h: Declare them. + + * init.c (resolve_offset_ref): Don't check access for the base + conversion to access a FIELD_DECL. + + * cp-tree.h (TYPE_REFFN_P): New macro. + * decl.c (bad_specifiers): Check it, too. + + * rtti.c (create_pseudo_type_info): Set CLASSTYPE_INTERFACE_ONLY + on the __*_type_info type if we haven't seen a definition. + 2001-12-05 Neil Booth <neil@daikokuya.demon.co.uk> * decl.c: Include c-common.h. diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index 598c3fc5c74..c40330bc319 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -83,6 +83,10 @@ static HOST_WIDE_INT cxx_get_alias_set PARAMS ((tree)); cp_copy_res_decl_for_inlining #undef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P #define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P anon_aggr_type_p +#undef LANG_HOOKS_TREE_INLINING_START_INLINING +#define LANG_HOOKS_TREE_INLINING_START_INLINING cp_start_inlining +#undef LANG_HOOKS_TREE_INLINING_END_INLINING +#define LANG_HOOKS_TREE_INLINING_END_INLINING cp_end_inlining #undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN #define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN cp_dump_tree #undef LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 4b6dd33ff79..420e2d9fed0 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2487,6 +2487,9 @@ extern int flag_new_for_scope; #define TYPE_PTRFN_P(NODE) \ (TREE_CODE (NODE) == POINTER_TYPE \ && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE) +#define TYPE_REFFN_P(NODE) \ + (TREE_CODE (NODE) == REFERENCE_TYPE \ + && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE) /* Nonzero for _TYPE node means that this type is a pointer to member function type. */ @@ -3968,6 +3971,7 @@ extern void do_decl_instantiation PARAMS ((tree, tree, tree)); extern void do_type_instantiation PARAMS ((tree, tree, int)); extern tree instantiate_decl PARAMS ((tree, int)); extern tree get_bindings PARAMS ((tree, tree, tree)); +extern int push_tinst_level PARAMS ((tree)); extern void pop_tinst_level PARAMS ((void)); extern int more_specialized_class PARAMS ((tree, tree)); extern int is_member_template PARAMS ((tree)); @@ -4240,6 +4244,8 @@ extern int cp_is_overload_p PARAMS ((tree)); extern int cp_auto_var_in_fn_p PARAMS ((tree,tree)); extern tree cp_copy_res_decl_for_inlining PARAMS ((tree, tree, tree, void*, int*, void*)); +extern int cp_start_inlining PARAMS ((tree)); +extern void cp_end_inlining PARAMS ((tree)); /* in typeck.c */ extern int string_conv_p PARAMS ((tree, tree, int)); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2df8b229182..66aa70d89c6 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8750,6 +8750,7 @@ bad_specifiers (object, type, virtualp, quals, inlinep, friendp, raises) if (raises && (TREE_CODE (object) == TYPE_DECL || (!TYPE_PTRFN_P (TREE_TYPE (object)) + && !TYPE_REFFN_P (TREE_TYPE (object)) && !TYPE_PTRMEMFUNC_P (TREE_TYPE (object))))) cp_error_at ("`%D' declared with an exception specification", object); } diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 169bc8c07a0..098697fa5a7 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1831,9 +1831,12 @@ resolve_offset_ref (exp) if (TREE_CODE (exp) == OFFSET_REF && TREE_CODE (type) == OFFSET_TYPE) base = build_scoped_ref (base, TYPE_OFFSET_BASETYPE (type)); - basetype = lookup_base (TREE_TYPE (base), basetype, ba_check, NULL); + /* Don't check access on the conversion; we might be after a member + promoted by an access- or using-declaration, and we have already + checked access for the member itself. */ + basetype = lookup_base (TREE_TYPE (base), basetype, ba_ignore, NULL); expr = build_base_path (PLUS_EXPR, base, basetype, 1); - + if (expr == error_mark_node) return error_mark_node; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index f383127edd9..8e620bea2c5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -98,7 +98,6 @@ static int try_one_overload PARAMS ((tree, tree, tree, tree, tree, unification_kind_t, int)); static int unify PARAMS ((tree, tree, tree, tree, int)); static void add_pending_template PARAMS ((tree)); -static int push_tinst_level PARAMS ((tree)); static void reopen_tinst_level PARAMS ((tree)); static tree classtype_mangled_name PARAMS ((tree)); static char *mangle_class_name_for_template PARAMS ((const char *, tree, tree)); @@ -4460,7 +4459,7 @@ static int last_template_error_tick; /* We're starting to instantiate D; record the template instantiation context for diagnostics and to restore it later. */ -static int +int push_tinst_level (d) tree d; { diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 3510cc10b38..a1b665e5927 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -1162,6 +1162,15 @@ create_pseudo_type_info VPARAMS((const char *real_name, int ident, ...)) /* Get the vtable decl. */ real_type = xref_tag (class_type_node, get_identifier (real_name), 1); + if (! TYPE_SIZE (real_type)) + { + /* We never saw a definition of this type, so we need to tell the + compiler that this is an exported class, as indeed all of the + __*_type_info classes are. */ + SET_CLASSTYPE_INTERFACE_KNOWN (real_type); + CLASSTYPE_INTERFACE_ONLY (real_type) = 1; + } + vtable_decl = get_vtable_decl (real_type, /*complete=*/1); vtable_decl = build_unary_op (ADDR_EXPR, vtable_decl, 0); @@ -1185,12 +1194,12 @@ create_pseudo_type_info VPARAMS((const char *real_name, int ident, ...)) pseudo_type = make_aggr_type (RECORD_TYPE); finish_builtin_type (pseudo_type, pseudo_name, fields, ix, ptr_type_node); TYPE_HAS_CONSTRUCTOR (pseudo_type) = 1; - VA_CLOSE (ap); result = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); TINFO_VTABLE_DECL (result) = vtable_decl; TINFO_PSEUDO_TYPE (result) = pseudo_type; + VA_CLOSE (ap); return result; } diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 600c6e3746d..1d0c32475ad 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2230,6 +2230,30 @@ cp_copy_res_decl_for_inlining (result, fn, caller, decl_map_, return var; } +/* Record that we're about to start inlining FN, and return non-zero if + that's OK. Used for lang_hooks.tree_inlining.start_inlining. */ + +int +cp_start_inlining (fn) + tree fn; +{ + if (DECL_TEMPLATE_INSTANTIATION (fn)) + return push_tinst_level (fn); + else + return 1; +} + +/* Record that we're done inlining FN. Used for + lang_hooks.tree_inlining.end_inlining. */ + +void +cp_end_inlining (fn) + tree fn ATTRIBUTE_UNUSED; +{ + if (DECL_TEMPLATE_INSTANTIATION (fn)) + pop_tinst_level (); +} + /* Initialize tree.c. */ void |