austern 02/07/31 12:53:15
Modified: gcc/cp class.c
Added: gcc/testsuite/g++.dg kext1.C
Log:
Bug #: 3008388
Reviewed by: Stan
Made it a compile-time error to use multiple or virtual
inheritance with -findirect-virtual-calls. Added a test
case to verify that the error message gets emitted.
(Note that -findirect-virtual-calls isn't usually used
by itself. It is implied by -fapple-kext.)
Revision Changes Path
1.29 +18 -1 gcc3/gcc/cp/class.c
Index: class.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/cp/class.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- class.c 2002/06/03 22:12:55 1.28
+++ class.c 2002/07/31 19:53:14 1.29
@@ -1350,6 +1350,9 @@
int i;
int seen_non_virtual_nearly_empty_base_p;
tree binfos;
+ /* APPLE LOCAL begin apple-kext Radar 3008388 */
+ int has_virtual_base = 0;
+ /* APPLE LOCAL end apple-kext Radar 3008388 */
binfos = TYPE_BINFO_BASETYPES (t);
n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
@@ -1416,7 +1419,9 @@
if (TREE_VIA_VIRTUAL (base_binfo))
/* A virtual base does not effect nearly emptiness. */
- ;
+ /* APPLE LOCAL begin apple-kext Radar 3008388 */
+ has_virtual_base = 1;
+ /* APPLE LOCAL end apple-kext Radar 3008388 */
else if (CLASSTYPE_NEARLY_EMPTY_P (basetype))
{
if (seen_non_virtual_nearly_empty_base_p)
@@ -1445,6 +1450,18 @@
TYPE_OVERLOADS_ARROW (t) |= TYPE_OVERLOADS_ARROW (basetype);
TYPE_POLYMORPHIC_P (t) |= TYPE_POLYMORPHIC_P (basetype);
}
+
+ /* APPLE LOCAL begin apple-kext Radar 3008388 */
+ if (flag_indirect_virtual_calls)
+ {
+ const char *flag = flag_apple_kext ? "-fapple-kext"
+ : "-findirect-virtual-calls";
+ if (n_baseclasses > 1)
+ cp_error_at ("`%#T' has multiple bases, conflicts with %s", t, flag);
+ if (has_virtual_base)
+ cp_error_at ("`%#T' has virtual base, conflicts with %s", t, flag);
+ }
+ /* APPLE LOCAL end apple-kext Radar 3008388 */
}
/* Binfo FROM is within a virtual hierarchy which is being reseated to
1.2 +10 -0 gcc3/gcc/testsuite/g++.dg/kext1.C