From 2e7ca5794ac06891be086dbe5b5ea94d5ea8f2d9 Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 22 May 2001 19:42:30 +0000 Subject: [PATCH] * class.c, cp-tree.h, rtti.c: Remove com_interface attribute support. * tree.c (cp_valid_lang_attribute): Warn about use of com_interface attribute. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42465 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/class.c | 16 ---------------- gcc/cp/cp-tree.h | 6 ------ gcc/cp/rtti.c | 10 ---------- gcc/cp/tree.c | 10 ++++------ gcc/testsuite/g++.old-deja/g++.ext/comint1.C | 24 ------------------------ 6 files changed, 10 insertions(+), 62 deletions(-) delete mode 100644 gcc/testsuite/g++.old-deja/g++.ext/comint1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 241b2c3b9a0..956d01708c3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2001-05-22 Jason Merrill + + * class.c, cp-tree.h, rtti.c: Remove com_interface attribute support. + * tree.c (cp_valid_lang_attribute): Warn about use of com_interface + attribute. + 2001-05-22 Joseph S. Myers * parse.y: Refer to compound literals as such, not as diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 4566200f3ac..eca199fb72a 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1690,18 +1690,6 @@ check_bases (t, cant_have_default_ctor_p, cant_have_const_ctor_p, TYPE_OVERLOADS_ARRAY_REF (t) |= TYPE_OVERLOADS_ARRAY_REF (basetype); TYPE_OVERLOADS_ARROW (t) |= TYPE_OVERLOADS_ARROW (basetype); TYPE_POLYMORPHIC_P (t) |= TYPE_POLYMORPHIC_P (basetype); - - /* Derived classes can implicitly become COMified if their bases - are COM. */ - if (CLASSTYPE_COM_INTERFACE (basetype)) - CLASSTYPE_COM_INTERFACE (t) = 1; - else if (i == 0 && CLASSTYPE_COM_INTERFACE (t)) - { - cp_error - ("COM interface type `%T' with non-COM leftmost base class `%T'", - t, basetype); - CLASSTYPE_COM_INTERFACE (t) = 0; - } } } @@ -7993,10 +7981,6 @@ build_rtti_vtbl_entries (binfo, vid) basetype = BINFO_TYPE (binfo); t = BINFO_TYPE (vid->rtti_binfo); - /* For a COM object there is no RTTI entry. */ - if (CLASSTYPE_COM_INTERFACE (basetype)) - return; - /* To find the complete object, we will first convert to our most primary base, and then add the offset in the vtbl to that value. */ b = binfo; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 91e723b60a6..e5065e4cec6 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -132,8 +132,6 @@ Boston, MA 02111-1307, USA. */ use a virtual thunk, as opposed to an ordinary thunk. The BV_FN is the declaration for the virtual function itself. - When CLASSTYPE_COM_INTERFACE_P does not hold, the first entry - does not have a BV_FN; it is just an offset. The BV_OVERRIDING_BASE is the binfo for the final overrider for this function. (That binfo's BINFO_TYPE will always be the same @@ -1578,10 +1576,6 @@ struct lang_type #define CLASSTYPE_NEARLY_EMPTY_P(NODE) \ (TYPE_LANG_SPECIFIC (NODE)->nearly_empty_p) -/* Nonzero means that this type is meant for communication via COM. */ -#define CLASSTYPE_COM_INTERFACE(NODE) \ - (TYPE_LANG_SPECIFIC(NODE)->com_interface) - /* 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. */ diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 1ce8f9895cf..d798f63c5f2 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -122,11 +122,6 @@ build_headof (exp) if (!TYPE_POLYMORPHIC_P (type)) return exp; - if (CLASSTYPE_COM_INTERFACE (type)) - { - cp_error ("RTTI not supported for COM interface type `%T'", type); - return error_mark_node; - } /* If we don't have rtti stuff, get to a sub-object that does. */ if (!CLASSTYPE_VFIELDS (TREE_TYPE (TREE_TYPE (exp)))) @@ -222,11 +217,6 @@ get_tinfo_decl_dynamic (exp) if (! flag_rtti) error ("taking dynamic typeid of object with -fno-rtti"); - if (CLASSTYPE_COM_INTERFACE (type)) - { - cp_error ("RTTI not supported for COM interface type `%T'", type); - return error_mark_node; - } /* If we don't have rtti stuff, get to a sub-object that does. */ if (! CLASSTYPE_VFIELDS (type)) diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 65ba7f6c55d..2dfc567caef 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2236,12 +2236,7 @@ cp_valid_lang_attribute (attr_name, attr_args, decl, type) } if (is_attribute_p ("com_interface", attr_name)) { - if (! flag_vtable_thunks) - { - error ("`com_interface' only supported with -fvtable-thunks"); - return 0; - } - + static int warned; if (attr_args != NULL_TREE || decl != NULL_TREE || ! CLASS_TYPE_P (type) @@ -2251,6 +2246,9 @@ cp_valid_lang_attribute (attr_name, attr_args, decl, type) return 0; } + if (! warned++) + warning ("\ +`com_interface' is obsolete; g++ vtables are now COM-compatible by default"); return 1; } else if (is_attribute_p ("init_priority", attr_name)) diff --git a/gcc/testsuite/g++.old-deja/g++.ext/comint1.C b/gcc/testsuite/g++.old-deja/g++.ext/comint1.C deleted file mode 100644 index 78d99e6c357..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.ext/comint1.C +++ /dev/null @@ -1,24 +0,0 @@ -// Test that we can use mixins with COM classes. - -struct A -{ - virtual int foo () = 0; - virtual int bar () = 0; -} __attribute__((__com_interface__)); - -struct B -{ - virtual int baz () { return 5; } -}; - -struct C : public A, public B -{ - int foo () { return 0; } - int bar () { return 1; } -}; - -int main () -{ - C c; - return c.foo (); -} -- 2.11.0