Commit 0401d499 by Jason Merrill Committed by Jason Merrill

class.c, [...]: Remove com_interface attribute support.

        * 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.

From-SVN: r42465
parent 766a4175
2001-05-22 Jason Merrill <jason_merrill@redhat.com>
* 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 <jsm28@cam.ac.uk> 2001-05-22 Joseph S. Myers <jsm28@cam.ac.uk>
* parse.y: Refer to compound literals as such, not as * parse.y: Refer to compound literals as such, not as
......
...@@ -1690,18 +1690,6 @@ check_bases (t, cant_have_default_ctor_p, cant_have_const_ctor_p, ...@@ -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_ARRAY_REF (t) |= TYPE_OVERLOADS_ARRAY_REF (basetype);
TYPE_OVERLOADS_ARROW (t) |= TYPE_OVERLOADS_ARROW (basetype); TYPE_OVERLOADS_ARROW (t) |= TYPE_OVERLOADS_ARROW (basetype);
TYPE_POLYMORPHIC_P (t) |= TYPE_POLYMORPHIC_P (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) ...@@ -7993,10 +7981,6 @@ build_rtti_vtbl_entries (binfo, vid)
basetype = BINFO_TYPE (binfo); basetype = BINFO_TYPE (binfo);
t = BINFO_TYPE (vid->rtti_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 /* 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. */ primary base, and then add the offset in the vtbl to that value. */
b = binfo; b = binfo;
......
...@@ -132,8 +132,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -132,8 +132,6 @@ Boston, MA 02111-1307, USA. */
use a virtual thunk, as opposed to an ordinary thunk. use a virtual thunk, as opposed to an ordinary thunk.
The BV_FN is the declaration for the virtual function itself. 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 The BV_OVERRIDING_BASE is the binfo for the final overrider for
this function. (That binfo's BINFO_TYPE will always be the same this function. (That binfo's BINFO_TYPE will always be the same
...@@ -1578,10 +1576,6 @@ struct lang_type ...@@ -1578,10 +1576,6 @@ struct lang_type
#define CLASSTYPE_NEARLY_EMPTY_P(NODE) \ #define CLASSTYPE_NEARLY_EMPTY_P(NODE) \
(TYPE_LANG_SPECIFIC (NODE)->nearly_empty_p) (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 /* 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 TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
case of a template friend. */ case of a template friend. */
......
...@@ -122,11 +122,6 @@ build_headof (exp) ...@@ -122,11 +122,6 @@ build_headof (exp)
if (!TYPE_POLYMORPHIC_P (type)) if (!TYPE_POLYMORPHIC_P (type))
return exp; 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 we don't have rtti stuff, get to a sub-object that does. */
if (!CLASSTYPE_VFIELDS (TREE_TYPE (TREE_TYPE (exp)))) if (!CLASSTYPE_VFIELDS (TREE_TYPE (TREE_TYPE (exp))))
...@@ -222,11 +217,6 @@ get_tinfo_decl_dynamic (exp) ...@@ -222,11 +217,6 @@ get_tinfo_decl_dynamic (exp)
if (! flag_rtti) if (! flag_rtti)
error ("taking dynamic typeid of object with -fno-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 we don't have rtti stuff, get to a sub-object that does. */
if (! CLASSTYPE_VFIELDS (type)) if (! CLASSTYPE_VFIELDS (type))
......
...@@ -2236,12 +2236,7 @@ cp_valid_lang_attribute (attr_name, attr_args, decl, type) ...@@ -2236,12 +2236,7 @@ cp_valid_lang_attribute (attr_name, attr_args, decl, type)
} }
if (is_attribute_p ("com_interface", attr_name)) if (is_attribute_p ("com_interface", attr_name))
{ {
if (! flag_vtable_thunks) static int warned;
{
error ("`com_interface' only supported with -fvtable-thunks");
return 0;
}
if (attr_args != NULL_TREE if (attr_args != NULL_TREE
|| decl != NULL_TREE || decl != NULL_TREE
|| ! CLASS_TYPE_P (type) || ! CLASS_TYPE_P (type)
...@@ -2251,6 +2246,9 @@ cp_valid_lang_attribute (attr_name, attr_args, decl, type) ...@@ -2251,6 +2246,9 @@ cp_valid_lang_attribute (attr_name, attr_args, decl, type)
return 0; return 0;
} }
if (! warned++)
warning ("\
`com_interface' is obsolete; g++ vtables are now COM-compatible by default");
return 1; return 1;
} }
else if (is_attribute_p ("init_priority", attr_name)) else if (is_attribute_p ("init_priority", attr_name))
......
// 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 ();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment