From 52bf7d5d090f026c1e72949f6556b392fdd839ec Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Mon, 26 Oct 1998 23:48:58 +0000 Subject: [PATCH] error.c (dump_decl): Deal with TEMPLATE_DECLs that are VAR_DECLs. * error.c (dump_decl): Deal with TEMPLATE_DECLs that are VAR_DECLs. Handle vtables whose DECL_CONTEXT is not a type. * class.c (finish_struct_1): Use build_cplus_array_type to build array types. * decl.c (init_decl_processing): Likewise. * except.c (expand_end_eh_spec): Likewise. * search.c (expand_upcast_fixups): Simplify very slightly. From-SVN: r23359 --- gcc/cp/ChangeLog | 11 +++++++++++ gcc/cp/class.c | 2 +- gcc/cp/decl.c | 2 +- gcc/cp/error.c | 10 +++++++++- gcc/cp/except.c | 2 +- gcc/cp/search.c | 2 +- 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 55065688452..8c3123b3935 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +1998-10-26 Mark Mitchell + + * error.c (dump_decl): Deal with TEMPLATE_DECLs that are + VAR_DECLs. Handle vtables whose DECL_CONTEXT is not a type. + + * class.c (finish_struct_1): Use build_cplus_array_type to build + array types. + * decl.c (init_decl_processing): Likewise. + * except.c (expand_end_eh_spec): Likewise. + * search.c (expand_upcast_fixups): Simplify very slightly. + 1998-10-26 Jason Merrill * decl.c (grokdeclarator): Complain about a variable using diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 8141db18341..6245700de6e 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -4155,7 +4155,7 @@ finish_struct_1 (t, warn_anon) { /* Use size_int so values are memoized in common cases. */ tree itype = build_index_type (size_int (has_virtual)); - tree atype = build_array_type (vtable_entry_type, itype); + tree atype = build_cplus_array_type (vtable_entry_type, itype); layout_type (atype); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f5167467e4f..87b8d508112 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6208,7 +6208,7 @@ init_decl_processing () record_builtin_type (RID_MAX, VTBL_PTR_TYPE, vtable_entry_type); vtbl_type_node - = build_array_type (vtable_entry_type, NULL_TREE); + = build_cplus_array_type (vtable_entry_type, NULL_TREE); layout_type (vtbl_type_node); vtbl_type_node = build_qualified_type (vtbl_type_node, TYPE_QUAL_CONST); record_builtin_type (RID_MAX, NULL_PTR, vtbl_type_node); diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 002473a781b..bd7d178879e 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -729,7 +729,13 @@ dump_decl (t, v) if (DECL_NAME (t) && VTABLE_NAME_P (DECL_NAME (t))) { OB_PUTS ("vtable for "); - dump_type (DECL_CONTEXT (t), v); + if (TYPE_P (DECL_CONTEXT (t))) + dump_type (DECL_CONTEXT (t), v); + else + /* This case can arise with -fno-vtable-thunks. See + expand_upcast_fixups. It's not clear what to print + here. */ + OB_PUTS ("{unknown type}"); break; } /* else fall through */ @@ -863,6 +869,8 @@ dump_decl (t, v) if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL) dump_type (TREE_TYPE (t), v); + else if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == VAR_DECL) + dump_decl (DECL_TEMPLATE_RESULT (t), v); else if (TREE_TYPE (t) == NULL_TREE) my_friendly_abort (353); else switch (NEXT_CODE (t)) diff --git a/gcc/cp/except.c b/gcc/cp/except.c index c21ac240eff..2d069dac6fd 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -774,7 +774,7 @@ expand_end_eh_spec (raises) TREE_HAS_CONSTRUCTOR (types) = 1; /* We can't pass the CONSTRUCTOR directly, so stick it in a variable. */ - tmp = build_array_type (const_ptr_type_node, NULL_TREE); + tmp = build_cplus_array_type (const_ptr_type_node, NULL_TREE); decl = build_decl (VAR_DECL, NULL_TREE, tmp); DECL_ARTIFICIAL (decl) = 1; DECL_INITIAL (decl) = types; diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 5af1c7d67c4..c49fd2268d4 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -2542,7 +2542,7 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t, /* Dup it if it isn't in local scope yet. */ nvtbl = build_decl (VAR_DECL, DECL_NAME (vtbl), - TYPE_MAIN_VARIANT (TREE_TYPE (BINFO_VTABLE (binfo)))); + TYPE_MAIN_VARIANT (TREE_TYPE (vtbl))); DECL_ALIGN (nvtbl) = MAX (TYPE_ALIGN (double_type_node), DECL_ALIGN (nvtbl)); TREE_READONLY (nvtbl) = 0; -- 2.30.2