summaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/isa-field-1.mm
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/obj-c++.dg/isa-field-1.mm')
-rw-r--r--gcc/testsuite/obj-c++.dg/isa-field-1.mm55
1 files changed, 36 insertions, 19 deletions
diff --git a/gcc/testsuite/obj-c++.dg/isa-field-1.mm b/gcc/testsuite/obj-c++.dg/isa-field-1.mm
index 4b93df8c485..4501d01a11e 100644
--- a/gcc/testsuite/obj-c++.dg/isa-field-1.mm
+++ b/gcc/testsuite/obj-c++.dg/isa-field-1.mm
@@ -1,28 +1,34 @@
-/* Ensure there are no bizarre difficulties with accessing the 'isa' field of
- objects. This field is named differently between GNU and NeXT runtimes so
- accessed via the CLASSPTRFIELD() macro defined in next-mapping.h */
+/* Ensure there are no bizarre difficulties with accessing the 'isa' field of objects. */
/* { dg-do compile } */
-#include "../objc-obj-c++-shared/Object1.h"
-#include "../objc-obj-c++-shared/next-mapping.h"
+#include "../objc-obj-c++-shared/TestsuiteObject.h"
+#include "../objc-obj-c++-shared/runtime.h"
-@interface Object (Test)
+@interface TestsuiteObject (Test)
- (Class) test1: (id)object;
@end
-@interface Derived: Object
+@interface Derived: TestsuiteObject
- (Class) test2: (id)object;
@end
-@implementation Object (Test)
+@implementation TestsuiteObject (Test)
Class test1(id object) {
- Class cls = CLASSPTRFIELD(object);
- return cls;
+#ifdef __NEXT_RUNTIME__
+ Class cls = object->isa;
+#else
+ Class cls = object->class_pointer;
+#endif
+ return cls;
}
- (Class) test1: (id)object {
- Class cls = CLASSPTRFIELD(object);
- return cls;
+#ifdef __NEXT_RUNTIME__
+ Class cls = object->isa;
+#else
+ Class cls = object->class_pointer;
+#endif
+ return cls;
}
@end
@@ -30,18 +36,29 @@ Class test1(id object) {
@implementation Derived
Class test2(id object) {
- Class cls = CLASSPTRFIELD(object);
- return cls;
+#ifdef __NEXT_RUNTIME__
+ Class cls = object->isa;
+#else
+ Class cls = object->class_pointer;
+#endif
+ return cls;
}
- (Class) test2: (id)object {
- Class cls = CLASSPTRFIELD(object);
- return cls;
+#ifdef __NEXT_RUNTIME__
+ Class cls = object->isa;
+#else
+ Class cls = object->class_pointer;
+#endif
+ return cls;
}
@end
Class test3(id object) {
- Class cls = CLASSPTRFIELD(object);
- return cls;
+#ifdef __NEXT_RUNTIME__
+ Class cls = object->isa;
+#else
+ Class cls = object->class_pointer;
+#endif
+ return cls;
}
-#include "../objc-obj-c++-shared/Object1-implementation.h"