summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc/execute
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/objc/execute')
-rw-r--r--gcc/testsuite/objc/execute/IMP.m14
-rw-r--r--gcc/testsuite/objc/execute/_cmd.m7
-rw-r--r--gcc/testsuite/objc/execute/accessing_ivars.m17
-rw-r--r--gcc/testsuite/objc/execute/bf-common.h68
-rw-r--r--gcc/testsuite/objc/execute/bycopy-1.m5
-rw-r--r--gcc/testsuite/objc/execute/bycopy-2.m10
-rw-r--r--gcc/testsuite/objc/execute/bycopy-3.m43
-rw-r--r--gcc/testsuite/objc/execute/cascading-1.m4
-rw-r--r--gcc/testsuite/objc/execute/class-1.m2
-rw-r--r--gcc/testsuite/objc/execute/class-10.m8
-rw-r--r--gcc/testsuite/objc/execute/class-11.m8
-rw-r--r--gcc/testsuite/objc/execute/class-12.m6
-rw-r--r--gcc/testsuite/objc/execute/class-13.m8
-rw-r--r--gcc/testsuite/objc/execute/class-14.m8
-rw-r--r--gcc/testsuite/objc/execute/class-2.m2
-rw-r--r--gcc/testsuite/objc/execute/class-3.m2
-rw-r--r--gcc/testsuite/objc/execute/class-4.m6
-rw-r--r--gcc/testsuite/objc/execute/class-5.m8
-rw-r--r--gcc/testsuite/objc/execute/class-6.m8
-rw-r--r--gcc/testsuite/objc/execute/class-7.m6
-rw-r--r--gcc/testsuite/objc/execute/class-8.m8
-rw-r--r--gcc/testsuite/objc/execute/class-9.m8
-rw-r--r--gcc/testsuite/objc/execute/class-tests-1.h49
-rw-r--r--gcc/testsuite/objc/execute/class-tests-2.h11
-rw-r--r--gcc/testsuite/objc/execute/class_self-1.m2
-rw-r--r--gcc/testsuite/objc/execute/class_self-2.m4
-rw-r--r--gcc/testsuite/objc/execute/compatibility_alias.m7
-rw-r--r--gcc/testsuite/objc/execute/encode-1.m5
-rw-r--r--gcc/testsuite/objc/execute/enumeration-1.m7
-rw-r--r--gcc/testsuite/objc/execute/enumeration-2.m7
-rw-r--r--gcc/testsuite/objc/execute/exceptions/catchall-1.m14
-rw-r--r--gcc/testsuite/objc/execute/exceptions/finally-1.m22
-rw-r--r--gcc/testsuite/objc/execute/exceptions/foward-1.m28
-rw-r--r--gcc/testsuite/objc/execute/exceptions/handler-1.m8
-rw-r--r--gcc/testsuite/objc/execute/exceptions/local-variables-1.m10
-rw-r--r--gcc/testsuite/objc/execute/exceptions/matcher-1.m8
-rw-r--r--gcc/testsuite/objc/execute/exceptions/throw-nil.m4
-rw-r--r--gcc/testsuite/objc/execute/exceptions/trivial.m8
-rw-r--r--gcc/testsuite/objc/execute/formal_protocol-1.m6
-rw-r--r--gcc/testsuite/objc/execute/formal_protocol-2.m6
-rw-r--r--gcc/testsuite/objc/execute/formal_protocol-3.m6
-rw-r--r--gcc/testsuite/objc/execute/formal_protocol-4.m6
-rw-r--r--gcc/testsuite/objc/execute/formal_protocol-5.m6
-rw-r--r--gcc/testsuite/objc/execute/formal_protocol-6.m6
-rw-r--r--gcc/testsuite/objc/execute/formal_protocol-7.m7
-rw-r--r--gcc/testsuite/objc/execute/function-message-1.m4
-rw-r--r--gcc/testsuite/objc/execute/informal_protocol.m4
-rw-r--r--gcc/testsuite/objc/execute/load-3.m4
-rw-r--r--gcc/testsuite/objc/execute/many_args_method.m2
-rw-r--r--gcc/testsuite/objc/execute/nested-3.m2
-rw-r--r--gcc/testsuite/objc/execute/nested-func-1.m4
-rw-r--r--gcc/testsuite/objc/execute/next_mapping.h906
-rw-r--r--gcc/testsuite/objc/execute/nil_method-1.m4
-rw-r--r--gcc/testsuite/objc/execute/no_clash.m6
-rw-r--r--gcc/testsuite/objc/execute/np-1.m3
-rw-r--r--gcc/testsuite/objc/execute/np-2.m6
-rw-r--r--gcc/testsuite/objc/execute/object_is_class.m14
-rw-r--r--gcc/testsuite/objc/execute/object_is_meta_class.m16
-rw-r--r--gcc/testsuite/objc/execute/private.m4
-rw-r--r--gcc/testsuite/objc/execute/protocol-isEqual-1.m9
-rw-r--r--gcc/testsuite/objc/execute/protocol-isEqual-2.m8
-rw-r--r--gcc/testsuite/objc/execute/protocol-isEqual-3.m8
-rw-r--r--gcc/testsuite/objc/execute/protocol-isEqual-4.m10
-rw-r--r--gcc/testsuite/objc/execute/redefining_self.m2
-rw-r--r--gcc/testsuite/objc/execute/root_methods.m6
-rw-r--r--gcc/testsuite/objc/execute/selector-1.m8
-rw-r--r--gcc/testsuite/objc/execute/static-1.m2
-rw-r--r--gcc/testsuite/objc/execute/static-2.m2
-rw-r--r--gcc/testsuite/objc/execute/trivial.m5
-rw-r--r--gcc/testsuite/objc/execute/va_method.m3
70 files changed, 238 insertions, 1297 deletions
diff --git a/gcc/testsuite/objc/execute/IMP.m b/gcc/testsuite/objc/execute/IMP.m
index f0790975780..a2372cba765 100644
--- a/gcc/testsuite/objc/execute/IMP.m
+++ b/gcc/testsuite/objc/execute/IMP.m
@@ -1,9 +1,7 @@
/* Contributed by Nicola Pero - Fri Mar 9 19:39:15 CET 2001 */
#include <stdlib.h>
-#include "../../objc-obj-c++-shared/next-mapping.h"
-#include <objc/objc.h>
-#include <objc/objc-api.h>
+#include "../../objc-obj-c++-shared/runtime.h"
/* Test getting and calling the IMP of a method */
@@ -11,11 +9,11 @@
{
Class isa;
}
-- (int) next: (int)a;
++ (int) next: (int)a;
@end
@implementation TestClass
-- (int) next: (int)a
++ (int) next: (int)a
{
return a + 1;
}
@@ -27,10 +25,10 @@ int main (void)
SEL selector;
int (* imp) (id, SEL, int);
- class = objc_get_class ("TestClass");
+ class = objc_getClass ("TestClass");
selector = @selector (next:);
- imp = (int (*)(id, SEL, int))method_get_imp
- (class_get_class_method (class, selector));
+ imp = (int (*)(id, SEL, int))method_getImplementation
+ (class_getClassMethod (class, selector));
if (imp (class, selector, 5) != 6)
{
diff --git a/gcc/testsuite/objc/execute/_cmd.m b/gcc/testsuite/objc/execute/_cmd.m
index 6c579d771b8..7e176e9916c 100644
--- a/gcc/testsuite/objc/execute/_cmd.m
+++ b/gcc/testsuite/objc/execute/_cmd.m
@@ -1,8 +1,7 @@
/* Contributed by Nicola Pero - Fri Mar 9 19:39:15 CET 2001 */
#include <stdlib.h>
-#include "../../objc-obj-c++-shared/next-mapping.h"
-#include <objc/objc-api.h>
+#include "../../objc-obj-c++-shared/runtime.h"
/* Test the hidden argument _cmd to method calls */
@@ -16,11 +15,9 @@
@implementation TestClass
+ (const char*) method
{
- return sel_get_name (_cmd);
+ return sel_getName (_cmd);
}
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
diff --git a/gcc/testsuite/objc/execute/accessing_ivars.m b/gcc/testsuite/objc/execute/accessing_ivars.m
index e4c9cf4cd42..964c378b4ab 100644
--- a/gcc/testsuite/objc/execute/accessing_ivars.m
+++ b/gcc/testsuite/objc/execute/accessing_ivars.m
@@ -1,23 +1,20 @@
/* Contributed by Nicola Pero - Thu Mar 8 16:27:46 CET 2001 */
#include <stdlib.h>
-#ifndef __NEXT_RUNTIME__
-#include <objc/objc-api.h>
-#endif
-#include "../../objc-obj-c++-shared/Object1.h"
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
/* Test that by using -> we can access ivars of other objects of the same
class */
-@interface TestClass : Object
+@interface TestClass : TestsuiteObject
{
int value;
}
- (int) value;
-- (int) setValue: (int)number;
+- (void) setValue: (int)number;
- (void) takeValueFrom: (TestClass *)object;
@end
-@implementation TestClass : Object
+@implementation TestClass : TestsuiteObject
{
int value;
}
@@ -25,9 +22,9 @@
{
return value;
}
-- (int) setValue: (int)number
+- (void) setValue: (int)number
{
- value = number;
+ value = number;
}
- (void) takeValueFrom: (TestClass *)object
{
@@ -55,4 +52,4 @@ int main (void)
return 0;
}
-#include "../../objc-obj-c++-shared/Object1-implementation.h"
+
diff --git a/gcc/testsuite/objc/execute/bf-common.h b/gcc/testsuite/objc/execute/bf-common.h
index ca70c21a411..43b0d32b7d6 100644
--- a/gcc/testsuite/objc/execute/bf-common.h
+++ b/gcc/testsuite/objc/execute/bf-common.h
@@ -1,17 +1,14 @@
#include <stdio.h>
#include <stdlib.h>
-#ifndef __NEXT_RUNTIME__
-#include <objc/encoding.h>
-#else
+#include "../../objc-obj-c++-shared/runtime.h"
+
/* The following header, together with the implementation included below,
emulate functionality provided by the GNU runtime but not available from
the NeXT runtime. */
#include "../../objc-obj-c++-shared/objc-test-suite-next-encode-assist.h"
-#define objc_get_class(C) objc_getClass(C)
-#endif
-#ifndef __OBJC2__
+#if defined(__NEXT_RUNTIME__) && !defined(NEXT_OBJC_USE_NEW_INTERFACE)
void print_ivars (Class class)
{
struct objc_ivar_list* ivars = class->ivars;
@@ -62,17 +59,67 @@ void compare_structures (Class class, const char* type)
printf ("%d ivars checked\n", i);
}
+#else
+void print_ivars (Class class)
+{
+ unsigned int count, i;
+ Ivar *list = class_copyIvarList (class, &count);
+
+ for (i = 0; i < count; i++) {
+ printf ("ivar '%s', type '%s', offset %ud\n",
+ ivar_getName (list[i]),
+ ivar_getTypeEncoding (list[i]),
+ (unsigned int)ivar_getOffset (list[i]));
+ }
+}
+
+void compare_structures (Class class, const char* type)
+{
+ struct objc_struct_layout layout;
+ unsigned int count;
+ Ivar *list = class_copyIvarList (class, &count);
+ int i = 0;
+ int position;
+
+ objc_layout_structure (type, &layout);
+
+ while (objc_layout_structure_next_member (&layout))
+ {
+ const char *ivar_type;
+
+ if (i > count)
+ {
+ printf ("too many ivars in type %s, layout = %s\n",
+ type, layout.type);
+ exit (1);
+ }
+
+ objc_layout_structure_get_info (&layout, &position, NULL, &ivar_type);
+ printf ("real ivar '%s' offset %ud\n",
+ ivar_getName (list[i]), (unsigned int)ivar_getOffset (list[i]));
+ printf ("computed type '%s' offset %d\n", ivar_type, position);
+ if ((unsigned int)position != (unsigned int)ivar_getOffset (list[i]))
+ {
+ printf ("offset %ud and computed position %d don't match on ivar '%s'"
+ " (i = %d)\n",
+ (unsigned int)ivar_getOffset (list[i]), position, ivar_getName (list[i]), i);
+ exit (1);
+ }
+ i++;
+ }
+
+ printf ("%d ivars checked\n", i);
+}
#endif
int main ()
{
-#ifndef __OBJC2__
struct class_vars
{
@defs (MyObject);
};
int size1, size2;
- Class class = objc_get_class ("MyObject");
+ Class class = objc_getClass ("MyObject");
printf ("type = %s\n", @encode (struct class_vars));
print_ivars (class);
@@ -83,10 +130,7 @@ int main ()
printf ("sizes don't match (computed %d, exact %d)\n", size1, size2);
abort ();
}
-#endif
- exit (0);
+ return 0;
}
-#ifndef __OBJC2__
#include "../../objc-obj-c++-shared/objc-test-suite-next-encode-assist-impl.h"
-#endif
diff --git a/gcc/testsuite/objc/execute/bycopy-1.m b/gcc/testsuite/objc/execute/bycopy-1.m
index c719d27d18b..358b6f92b32 100644
--- a/gcc/testsuite/objc/execute/bycopy-1.m
+++ b/gcc/testsuite/objc/execute/bycopy-1.m
@@ -2,8 +2,7 @@
* Contributed by Nicola Pero <nicola@brainstorm.co.uk>
* Fri Feb 2 11:48:01 GMT 2001
*/
-
-#include "../../objc-obj-c++-shared/Protocol1.h"
+#include <objc/objc.h>
@protocol MyProtocol
- (bycopy id) bycopyMethod;
@@ -13,7 +12,7 @@ int main (void)
{
[nil bycopyMethod];
- exit (0);
+ return 0;
}
diff --git a/gcc/testsuite/objc/execute/bycopy-2.m b/gcc/testsuite/objc/execute/bycopy-2.m
index 840881f4a97..b42659106b1 100644
--- a/gcc/testsuite/objc/execute/bycopy-2.m
+++ b/gcc/testsuite/objc/execute/bycopy-2.m
@@ -2,14 +2,14 @@
* Contributed by Nicola Pero <nicola@brainstorm.co.uk>
* Fri Feb 2 11:48:01 GMT 2001
*/
-
-#include "../../objc-obj-c++-shared/Protocol1.h"
+#include <objc/objc.h>
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
@protocol MyProtocol
+ (bycopy id<MyProtocol>) bycopyMethod;
@end
-@interface MyObject : Object <MyProtocol>
+@interface MyObject : TestsuiteObject <MyProtocol>
@end
@implementation MyObject
@@ -25,6 +25,6 @@ int main (void)
object = [MyObject bycopyMethod];
- exit (0);
+ return 0;
}
-#include "../../objc-obj-c++-shared/Object1-implementation.h"
+
diff --git a/gcc/testsuite/objc/execute/bycopy-3.m b/gcc/testsuite/objc/execute/bycopy-3.m
index 15c49a5dd34..e96d3959483 100644
--- a/gcc/testsuite/objc/execute/bycopy-3.m
+++ b/gcc/testsuite/objc/execute/bycopy-3.m
@@ -9,27 +9,18 @@
* interfere with what we are testing, which is that the `bycopy'
* keyword generates the _F_BYCOPY qualifier for the return type. */
-extern void exit (int) __attribute__ ((noreturn));
extern int printf (const char *, ...);
-#include <objc/Protocol.h>
-
-#ifndef __NEXT_RUNTIME__
-#include <objc/encoding.h>
-#endif
+#include <objc/objc.h>
+#include "../../objc-obj-c++-shared/runtime.h"
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
@protocol MyProtocol
+ (bycopy id<MyProtocol>) bycopyMethod;
@end
/* This no-op class to keep it compile under broken gcc 3.x */
-@interface MyObject : Object <MyProtocol>
-#ifdef __OBJC2__
-+ (id) initialize;
-+ (id) alloc;
-+ new;
-- init;
-#endif
+@interface MyObject : TestsuiteObject <MyProtocol>
@end
@implementation MyObject
@@ -37,12 +28,6 @@ extern int printf (const char *, ...);
{
return [MyObject alloc];
}
-#ifdef __OBJC2__
-+ initialize {return self;}
-+ alloc { return class_createInstance (self, 0);}
-+ new { return [[self alloc] init]; }
-- init {return self;}
-#endif
@end
/* The following header, together with the implementation included below,
@@ -52,7 +37,7 @@ extern int printf (const char *, ...);
int main (void)
{
- struct objc_method_description *method;
+ struct objc_method_description method;
const char *method_types;
unsigned qualifiers;
Protocol *protocol;
@@ -64,16 +49,18 @@ int main (void)
protocol = @protocol (MyProtocol);
/* Ask to the protocol for the description of the method bycopyMethod */
- method = [protocol descriptionForClassMethod: @selector (bycopyMethod)];
- if (method == NULL)
- {
- printf ("Could not find method bycopyMethod in protocol!\n");
- exit (1);
- }
+ method = protocol_getMethodDescription (protocol, @selector (bycopyMethod),
+ YES, NO);
/* Get the method types for the method - which encode return type,
arguments etc. */
- method_types = method->types;
+ method_types = method.types;
+
+ if (method_types == NULL)
+ {
+ printf ("Could not find method bycopyMethod in protocol!\n");
+ return 1;
+ }
/* Get the qualifiers for the return type */
qualifiers = objc_get_type_qualifiers (method_types);
@@ -82,7 +69,7 @@ int main (void)
if (! (qualifiers & _F_BYCOPY))
{
printf ("Failed - selector does not contain _F_BYCOPY qualifier!\n");
- exit (1);
+ return 1;
}
/* Else, happy end */
diff --git a/gcc/testsuite/objc/execute/cascading-1.m b/gcc/testsuite/objc/execute/cascading-1.m
index b823ea816f0..0e4ea31b7d1 100644
--- a/gcc/testsuite/objc/execute/cascading-1.m
+++ b/gcc/testsuite/objc/execute/cascading-1.m
@@ -1,7 +1,7 @@
#include <stdlib.h>
-#import "../../objc-obj-c++-shared/Object1.h"
+#import "../../objc-obj-c++-shared/TestsuiteObject.m"
-@interface Foo : Object
+@interface Foo : TestsuiteObject
+ foo;
+ bar;
@end
diff --git a/gcc/testsuite/objc/execute/class-1.m b/gcc/testsuite/objc/execute/class-1.m
index 2ac2c0646c0..6ce26209563 100644
--- a/gcc/testsuite/objc/execute/class-1.m
+++ b/gcc/testsuite/objc/execute/class-1.m
@@ -1,8 +1,6 @@
/* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
-#include "../../objc-obj-c++-shared/next-mapping.h"
#include <objc/objc.h>
-#include <objc/objc-api.h>
/* Tests creating a RootClass */
diff --git a/gcc/testsuite/objc/execute/class-10.m b/gcc/testsuite/objc/execute/class-10.m
index 0908609f0f3..fba1a38a0b0 100644
--- a/gcc/testsuite/objc/execute/class-10.m
+++ b/gcc/testsuite/objc/execute/class-10.m
@@ -1,8 +1,6 @@
/* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
-#include "../../objc-obj-c++-shared/next-mapping.h"
#include <objc/objc.h>
-#include <objc/objc-api.h>
/* Tests creating a root class and a subclass with an ivar and
accessor methods and a subclass overriding the superclass'
@@ -15,9 +13,7 @@
@end
@implementation RootClass
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
@interface SubClass : RootClass
@@ -72,10 +68,10 @@ int main (void)
test_that_class_has_instance_method ("SubSubClass", @selector (state));
test_that_class_has_instance_method ("SubSubClass", @selector (shift));
- object = class_create_instance (objc_lookup_class ("SubClass"));
+ object = class_createInstance (objc_getClass ("SubClass"), 0);
test_accessor_method (object, 0, -1, -1, 1, 1);
- sub_object = class_create_instance (objc_lookup_class ("SubSubClass"));
+ sub_object = class_createInstance (objc_getClass ("SubSubClass"), 0);
test_accessor_method (sub_object, 1, -1, 0, 1, 2);
return 0;
diff --git a/gcc/testsuite/objc/execute/class-11.m b/gcc/testsuite/objc/execute/class-11.m
index 33cd0492da3..2cd6017d460 100644
--- a/gcc/testsuite/objc/execute/class-11.m
+++ b/gcc/testsuite/objc/execute/class-11.m
@@ -1,8 +1,6 @@
/* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
-#include "../../objc-obj-c++-shared/next-mapping.h"
#include <objc/objc.h>
-#include <objc/objc-api.h>
/* Tests creating a root class and a subclass with an ivar and
accessor methods and a subclass overriding the superclass'
@@ -16,9 +14,7 @@
@end
@implementation RootClass
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
@interface SubClass : RootClass
@@ -76,10 +72,10 @@ int main (void)
test_that_class_has_instance_method ("SubSubClass", @selector (state));
test_that_class_has_instance_method ("SubSubClass", @selector (shift));
- object = class_create_instance (objc_lookup_class ("SubClass"));
+ object = class_createInstance (objc_getClass ("SubClass"), 0);
test_accessor_method (object, 0, -1, -1, 1, 1);
- sub_object = class_create_instance (objc_lookup_class ("SubSubClass"));
+ sub_object = class_createInstance (objc_getClass ("SubSubClass"), 0);
test_accessor_method (sub_object, 1, -1, 0, 1, 2);
return 0;
diff --git a/gcc/testsuite/objc/execute/class-12.m b/gcc/testsuite/objc/execute/class-12.m
index 3f4c4fbd5f4..d3116e8cc40 100644
--- a/gcc/testsuite/objc/execute/class-12.m
+++ b/gcc/testsuite/objc/execute/class-12.m
@@ -1,8 +1,6 @@
/* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
-#include "../../objc-obj-c++-shared/next-mapping.h"
#include <objc/objc.h>
-#include <objc/objc-api.h>
/* Tests creating a root class and a subclass with a class methods */
@@ -13,9 +11,7 @@
@end
@implementation RootClass
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
static int class_variable = 0;
@@ -48,7 +44,7 @@ int main (void)
test_that_class_has_class_method ("SubClass", @selector (setState:));
test_that_class_has_class_method ("SubClass", @selector (state));
- class = objc_lookup_class ("SubClass");
+ class = objc_getClass ("SubClass");
test_accessor_method (class, 0, -1, -1, 1, 1);
return 0;
diff --git a/gcc/testsuite/objc/execute/class-13.m b/gcc/testsuite/objc/execute/class-13.m
index 790654d107a..1d685e3a797 100644
--- a/gcc/testsuite/objc/execute/class-13.m
+++ b/gcc/testsuite/objc/execute/class-13.m
@@ -1,8 +1,6 @@
/* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
-#include "../../objc-obj-c++-shared/next-mapping.h"
#include <objc/objc.h>
-#include <objc/objc-api.h>
/* Tests creating a root class and a subclass with a class accessor
methods and a subclass overriding the superclass' implementation
@@ -15,9 +13,7 @@
@end
@implementation RootClass
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
static int class_variable = 0;
@@ -65,10 +61,10 @@ int main (void)
test_that_class_has_class_method ("SubSubClass", @selector (setState:));
test_that_class_has_class_method ("SubSubClass", @selector (state));
- class = objc_lookup_class ("SubClass");
+ class = objc_getClass ("SubClass");
test_accessor_method (class, 0, -1, -1, 1, 1);
- sub_class = objc_lookup_class ("SubSubClass");
+ sub_class = objc_getClass ("SubSubClass");
class_variable = 0;
test_accessor_method (sub_class, 1, -1, 0, 1, 2);
diff --git a/gcc/testsuite/objc/execute/class-14.m b/gcc/testsuite/objc/execute/class-14.m
index e04452e527b..3ab0982c6f3 100644
--- a/gcc/testsuite/objc/execute/class-14.m
+++ b/gcc/testsuite/objc/execute/class-14.m
@@ -1,8 +1,6 @@
/* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
-#include "../../objc-obj-c++-shared/next-mapping.h"
#include <objc/objc.h>
-#include <objc/objc-api.h>
/* Tests creating a root class and a subclass with a class accessor
methods and a subclass overriding the superclass' implementation,
@@ -15,9 +13,7 @@
@end
@implementation RootClass
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
static int class_variable = 0;
@@ -70,10 +66,10 @@ int main (void)
test_that_class_has_class_method ("SubSubClass", @selector (state));
test_that_class_has_class_method ("SubSubClass", @selector (shift));
- class = objc_lookup_class ("SubClass");
+ class = objc_getClass ("SubClass");
test_accessor_method (class, 0, -1, -1, 1, 1);
- sub_class = objc_lookup_class ("SubSubClass");
+ sub_class = objc_getClass ("SubSubClass");
class_variable = 0;
test_accessor_method (sub_class, 1, -1, 0, 1, 2);
diff --git a/gcc/testsuite/objc/execute/class-2.m b/gcc/testsuite/objc/execute/class-2.m
index c20f95fd6a6..88378e1d4a8 100644
--- a/gcc/testsuite/objc/execute/class-2.m
+++ b/gcc/testsuite/objc/execute/class-2.m
@@ -1,8 +1,6 @@
/* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
-#include "../../objc-obj-c++-shared/next-mapping.h"
#include <objc/objc.h>
-#include <objc/objc-api.h>
/* Tests creating a root class and a subclass */
diff --git a/gcc/testsuite/objc/execute/class-3.m b/gcc/testsuite/objc/execute/class-3.m
index dbdc0b9f2e3..071708a6e68 100644
--- a/gcc/testsuite/objc/execute/class-3.m
+++ b/gcc/testsuite/objc/execute/class-3.m
@@ -1,8 +1,6 @@
/* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
-#include "../../objc-obj-c++-shared/next-mapping.h"
#include <objc/objc.h>
-#include <objc/objc-api.h>
/* Tests creating a root class and a minimal subclass tree */
diff --git a/gcc/testsuite/objc/execute/class-4.m b/gcc/testsuite/objc/execute/class-4.m
index 61ce30a6a80..a862191636c 100644
--- a/gcc/testsuite/objc/execute/class-4.m
+++ b/gcc/testsuite/objc/execute/class-4.m
@@ -1,8 +1,6 @@
/* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
-#include "../../objc-obj-c++-shared/next-mapping.h"
#include <objc/objc.h>
-#include <objc/objc-api.h>
/* Tests creating a root class and a subclass with an ivar and
accessor methods */
@@ -14,9 +12,7 @@
@end
@implementation RootClass
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
@interface SubClass : RootClass
@@ -50,7 +46,7 @@ int main (void)
test_that_class_has_instance_method ("SubClass", @selector (setState:));
test_that_class_has_instance_method ("SubClass", @selector (state));
- object = class_create_instance (objc_lookup_class ("SubClass"));
+ object = class_createInstance (objc_getClass ("SubClass"), 0);
test_accessor_method (object, 0, 1, 1, -3, -3);
return 0;
diff --git a/gcc/testsuite/objc/execute/class-5.m b/gcc/testsuite/objc/execute/class-5.m
index c10df1be0b3..d0dc97a5bf3 100644
--- a/gcc/testsuite/objc/execute/class-5.m
+++ b/gcc/testsuite/objc/execute/class-5.m
@@ -1,8 +1,6 @@
/* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
-#include "../../objc-obj-c++-shared/next-mapping.h"
#include <objc/objc.h>
-#include <objc/objc-api.h>
/* Tests creating a root class and a subclass with an ivar and
accessor methods and a subclass overriding the superclass'
@@ -15,9 +13,7 @@
@end
@implementation RootClass
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
@interface SubClass : RootClass
@@ -66,10 +62,10 @@ int main (void)
test_that_class_has_instance_method ("SubSubClass", @selector (setState:));
test_that_class_has_instance_method ("SubSubClass", @selector (state));
- object = class_create_instance (objc_lookup_class ("SubClass"));
+ object = class_createInstance (objc_getClass ("SubClass"), 0);
test_accessor_method (object, 0, -1, -1, 1, 1);
- sub_object = class_create_instance (objc_lookup_class ("SubSubClass"));
+ sub_object = class_createInstance (objc_getClass ("SubSubClass"), 0);
test_accessor_method (sub_object, 1, -1, 0, 1, 2);
return 0;
diff --git a/gcc/testsuite/objc/execute/class-6.m b/gcc/testsuite/objc/execute/class-6.m
index 064462280e0..e178f619394 100644
--- a/gcc/testsuite/objc/execute/class-6.m
+++ b/gcc/testsuite/objc/execute/class-6.m
@@ -1,8 +1,6 @@
/* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
-#include "../../objc-obj-c++-shared/next-mapping.h"
#include <objc/objc.h>
-#include <objc/objc-api.h>
/* Tests creating a root class and a subclass with an ivar and
accessor methods and a subclass overriding the superclass'
@@ -15,9 +13,7 @@
@end
@implementation RootClass
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
@interface SubClass : RootClass
@@ -66,10 +62,10 @@ int main (void)
test_that_class_has_instance_method ("SubSubClass", @selector (setState:));
test_that_class_has_instance_method ("SubSubClass", @selector (state));
- object = class_create_instance (objc_lookup_class ("SubClass"));
+ object = class_createInstance (objc_getClass ("SubClass"), 0);
test_accessor_method (object, 0, -1, -1, 1, 1);
- sub_object = class_create_instance (objc_lookup_class ("SubSubClass"));
+ sub_object = class_createInstance (objc_getClass ("SubSubClass"), 0);
test_accessor_method (sub_object, 1, -1, 0, 1, 2);
return 0;
diff --git a/gcc/testsuite/objc/execute/class-7.m b/gcc/testsuite/objc/execute/class-7.m
index 06de61fef32..31e240945bb 100644
--- a/gcc/testsuite/objc/execute/class-7.m
+++ b/gcc/testsuite/objc/execute/class-7.m
@@ -1,8 +1,6 @@
/* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
-#include "../../objc-obj-c++-shared/next-mapping.h"
#include <objc/objc.h>
-#include <objc/objc-api.h>
/* Tests creating a root class and a subclass with an ivar and
accessor methods; accessor methods implemented in a separate
@@ -15,9 +13,7 @@
@end
@implementation RootClass
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
@interface SubClass : RootClass
@@ -64,7 +60,7 @@ int main (void)
test_that_class_has_instance_method ("SubClass", @selector (setState:));
test_that_class_has_instance_method ("SubClass", @selector (state));
- object = class_create_instance (objc_lookup_class ("SubClass"));
+ object = class_createInstance (objc_getClass ("SubClass"), 0);
test_accessor_method (object, 0, 1, 1, -3, -3);
return 0;
diff --git a/gcc/testsuite/objc/execute/class-8.m b/gcc/testsuite/objc/execute/class-8.m
index 0471994d359..ef4c2a3c8f3 100644
--- a/gcc/testsuite/objc/execute/class-8.m
+++ b/gcc/testsuite/objc/execute/class-8.m
@@ -1,8 +1,6 @@
/* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
-#include "../../objc-obj-c++-shared/next-mapping.h"
#include <objc/objc.h>
-#include <objc/objc-api.h>
/* Tests creating a root class and a subclass with an ivar and
accessor methods and a subclass overriding the superclass'
@@ -15,9 +13,7 @@
@end
@implementation RootClass
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
@interface SubClass : RootClass
@@ -69,10 +65,10 @@ int main (void)
test_that_class_has_instance_method ("SubSubClass", @selector (setState:));
test_that_class_has_instance_method ("SubSubClass", @selector (state));
- object = class_create_instance (objc_lookup_class ("SubClass"));
+ object = class_createInstance (objc_getClass ("SubClass"), 0);
test_accessor_method (object, 0, -1, -1, 1, 1);
- sub_object = class_create_instance (objc_lookup_class ("SubSubClass"));
+ sub_object = class_createInstance (objc_getClass ("SubSubClass"), 0);
test_accessor_method (sub_object, 1, -1, 0, 1, 2);
return 0;
diff --git a/gcc/testsuite/objc/execute/class-9.m b/gcc/testsuite/objc/execute/class-9.m
index 367a4c912cc..d27d3453881 100644
--- a/gcc/testsuite/objc/execute/class-9.m
+++ b/gcc/testsuite/objc/execute/class-9.m
@@ -1,8 +1,6 @@
/* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
-#include "../../objc-obj-c++-shared/next-mapping.h"
#include <objc/objc.h>
-#include <objc/objc-api.h>
/* Tests creating a root class and a subclass with an ivar and
accessor methods and a subclass overriding the superclass'
@@ -15,9 +13,7 @@
@end
@implementation RootClass
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
@interface SubClass : RootClass
@@ -69,10 +65,10 @@ int main (void)
test_that_class_has_instance_method ("SubSubClass", @selector (setState:));
test_that_class_has_instance_method ("SubSubClass", @selector (state));
- object = class_create_instance (objc_lookup_class ("SubClass"));
+ object = class_createInstance (objc_getClass ("SubClass"), 0);
test_accessor_method (object, 0, -1, -1, 1, 1);
- sub_object = class_create_instance (objc_lookup_class ("SubSubClass"));
+ sub_object = class_createInstance (objc_getClass ("SubSubClass"), 0);
test_accessor_method (sub_object, 1, -1, 0, 1, 2);
return 0;
diff --git a/gcc/testsuite/objc/execute/class-tests-1.h b/gcc/testsuite/objc/execute/class-tests-1.h
index 54a77d247f7..cfdd72b4748 100644
--- a/gcc/testsuite/objc/execute/class-tests-1.h
+++ b/gcc/testsuite/objc/execute/class-tests-1.h
@@ -2,9 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include "../../objc-obj-c++-shared/Object1.h"
-#include <objc/objc.h>
-#include <objc/objc-api.h>
+#include "../../objc-obj-c++-shared/runtime.h"
/*
* Standard Tests For Classes and Objects - abort upon failing; return
@@ -14,13 +12,7 @@
/* Test that `class' is a Class */
static void test_is_class (Class class)
{
- if (object_is_class (class) == NO)
- {
- printf ("test_is_class failed\n");
- abort ();
- }
-
- if (class_is_class (class) == NO)
+ if (class_isMetaClass (object_getClass (class)) == NO)
{
printf ("test_is_class failed\n");
abort ();
@@ -30,7 +22,7 @@ static void test_is_class (Class class)
/* Test that the superclass of `class' is `superclass' */
static void test_superclass (Class class, Class superclass)
{
- if (class_get_super_class (class) != superclass)
+ if (class_getSuperclass (class) != superclass)
{
printf ("test_superclass failed\n");
abort ();
@@ -40,7 +32,7 @@ static void test_superclass (Class class, Class superclass)
/* Test that the classname of `class' is `classname' */
static void test_class_name (Class class, const char *classname)
{
- if (strcmp (class_get_class_name (class), classname))
+ if (strcmp (class_getName (class), classname))
{
printf ("test_class_name failed\n");
abort ();
@@ -51,7 +43,7 @@ static void test_class_name (Class class, const char *classname)
static void test_allocate (Class class)
{
/* The object we create is leaked but who cares, this is only a test */
- id object = class_create_instance (class);
+ id object = class_createInstance (class, 0);
if (object == nil)
{
@@ -63,9 +55,9 @@ static void test_allocate (Class class)
/* Test that instances of `class' are instances and not classes */
static void test_instances (Class class)
{
- id object = class_create_instance (class);
+ id object = class_createInstance (class, 0);
- if (object_is_class (object) == YES)
+ if (class_isMetaClass (object_getClass (object)) == YES)
{
printf ("test_instances failed\n");
abort ();
@@ -75,7 +67,7 @@ static void test_instances (Class class)
/* Test that we can deallocate instances of `class' */
static void test_deallocate (Class class)
{
- id object = class_create_instance (class);
+ id object = class_createInstance (class, 0);
object_dispose (object);
}
@@ -83,27 +75,15 @@ static void test_deallocate (Class class)
/* Test that the object and the class agree on what the class is */
static void test_object_class (Class class)
{
- id object = class_create_instance (class);
+ id object = class_createInstance (class, 0);
- if (object_get_class (object) != class)
+ if (object_getClass (object) != class)
{
printf ("test_object_class failed\n");
abort ();
}
}
-/* Test that the object and the class agree on what the superclass is */
-static void test_object_super_class (Class class)
-{
- id object = class_create_instance (class);
-
- if (object_get_super_class (object) != class_get_super_class (class))
- {
- printf ("test_object_super_class failed\n");
- abort ();
- }
-}
-
/*
* Runs all the tests in this file for the specified class
*/
@@ -113,16 +93,12 @@ void test_class_with_superclass (const char *class_name,
Class class;
Class superclass;
- /* We need at least a method call before playing with the internals,
- so that the runtime will call __objc_resolve_class_links () */
- [Object class];
-
/* class_name must be an existing class */
- class = objc_lookup_class (class_name);
+ class = objc_getClass (class_name);
test_is_class (class);
/* But superclass_name can be "", which means `Nil' */
- superclass = objc_lookup_class (superclass_name);
+ superclass = objc_getClass (superclass_name);
if (superclass != Nil)
{
test_is_class (superclass);
@@ -135,5 +111,4 @@ void test_class_with_superclass (const char *class_name,
test_instances (class);
test_deallocate (class);
test_object_class (class);
- test_object_super_class (class);
}
diff --git a/gcc/testsuite/objc/execute/class-tests-2.h b/gcc/testsuite/objc/execute/class-tests-2.h
index 1aa73947d63..7f6f54000f7 100644
--- a/gcc/testsuite/objc/execute/class-tests-2.h
+++ b/gcc/testsuite/objc/execute/class-tests-2.h
@@ -1,8 +1,7 @@
/* Contributed by Nicola Pero on Tue Mar 6 23:05:53 CET 2001 */
-#include <objc/objc.h>
-#include <objc/objc-api.h>
#include <stdio.h>
#include <stdlib.h>
+#include "../../objc-obj-c++-shared/runtime.h"
/*
* Standard Tests For Methods of Classes and Objects - abort upon
@@ -13,9 +12,9 @@
void test_that_class_has_instance_method (const char *class_name,
SEL selector)
{
- Class class = objc_lookup_class (class_name);
+ Class class = objc_getClass (class_name);
- if (class_get_instance_method (class, selector) == NULL)
+ if (class_getInstanceMethod (class, selector) == NULL)
{
printf ("test_class_has_instance_method failed\n");
abort ();
@@ -26,9 +25,9 @@ void test_that_class_has_instance_method (const char *class_name,
void test_that_class_has_class_method (const char *class_name,
SEL selector)
{
- Class meta_class = objc_get_meta_class (class_name);
+ Class class = objc_getClass (class_name);
- if (class_get_class_method (meta_class, selector) == NULL)
+ if (class_getClassMethod (class, selector) == NULL)
{
printf ("test_class_has_class_method failed\n");
abort ();
diff --git a/gcc/testsuite/objc/execute/class_self-1.m b/gcc/testsuite/objc/execute/class_self-1.m
index 1690f8f6bbc..9045305e59c 100644
--- a/gcc/testsuite/objc/execute/class_self-1.m
+++ b/gcc/testsuite/objc/execute/class_self-1.m
@@ -51,9 +51,7 @@ struct d
{
return 4;
}
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
diff --git a/gcc/testsuite/objc/execute/class_self-2.m b/gcc/testsuite/objc/execute/class_self-2.m
index ad2b76b50e8..070c4c1a5ed 100644
--- a/gcc/testsuite/objc/execute/class_self-2.m
+++ b/gcc/testsuite/objc/execute/class_self-2.m
@@ -33,9 +33,7 @@ struct d
return u;
}
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
/* The second class */
@@ -58,9 +56,7 @@ struct d
}
}
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
diff --git a/gcc/testsuite/objc/execute/compatibility_alias.m b/gcc/testsuite/objc/execute/compatibility_alias.m
index 61d7625122d..8009a03d8dd 100644
--- a/gcc/testsuite/objc/execute/compatibility_alias.m
+++ b/gcc/testsuite/objc/execute/compatibility_alias.m
@@ -1,8 +1,7 @@
/* Contributed by Nicola Pero - Thu Mar 8 17:23:59 CET 2001 */
-#import "../../objc-obj-c++-shared/Object1.h"
-#include <objc/objc.h>
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
-@compatibility_alias MyObject Object;
+@compatibility_alias MyObject TestsuiteObject;
int main (void)
{
@@ -10,4 +9,4 @@ int main (void)
return 0;
}
-#include "../../objc-obj-c++-shared/Object1-implementation.h"
+
diff --git a/gcc/testsuite/objc/execute/encode-1.m b/gcc/testsuite/objc/execute/encode-1.m
index 3e2412e4647..4c4f2babfdb 100644
--- a/gcc/testsuite/objc/execute/encode-1.m
+++ b/gcc/testsuite/objc/execute/encode-1.m
@@ -1,8 +1,7 @@
/* Contributed by Nicola Pero - Thu Mar 8 16:27:46 CET 2001 */
#include <stdlib.h>
-#import "../../objc-obj-c++-shared/Object1.h"
+#import "../../objc-obj-c++-shared/TestsuiteObject.h"
#include <objc/objc.h>
-#include <objc/objc-api.h>
/* Test very simple @encode */
@@ -18,7 +17,7 @@ int main (void)
abort ();
}
- if (strcmp ("@", @encode (Object *)))
+ if (strcmp ("@", @encode (TestsuiteObject *)))
{
abort ();
}
diff --git a/gcc/testsuite/objc/execute/enumeration-1.m b/gcc/testsuite/objc/execute/enumeration-1.m
index 57d1a4bf69a..c380291b5a1 100644
--- a/gcc/testsuite/objc/execute/enumeration-1.m
+++ b/gcc/testsuite/objc/execute/enumeration-1.m
@@ -1,7 +1,6 @@
/* Contributed by Nicola Pero - Wed Dec 5 17:12:40 GMT 2001 */
#include <stdlib.h>
-#import "../../objc-obj-c++-shared/Object1.h"
-#include <objc/objc.h>
+#import "../../objc-obj-c++-shared/TestsuiteObject.m"
/* Test using a bitfield enumeration ivar. */
@@ -11,7 +10,7 @@ typedef enum
white
} color;
-@interface TestClass: Object
+@interface TestClass: TestsuiteObject
{
color c:2;
}
@@ -48,4 +47,4 @@ int main (void)
return 0;
}
-#include "../../objc-obj-c++-shared/Object1-implementation.h"
+
diff --git a/gcc/testsuite/objc/execute/enumeration-2.m b/gcc/testsuite/objc/execute/enumeration-2.m
index 3094963c682..3ce0504ffa0 100644
--- a/gcc/testsuite/objc/execute/enumeration-2.m
+++ b/gcc/testsuite/objc/execute/enumeration-2.m
@@ -1,7 +1,6 @@
/* Contributed by Nicola Pero - Wed Dec 5 17:12:40 GMT 2001 */
#include <stdlib.h>
-#import "../../objc-obj-c++-shared/Object1.h"
-#include <objc/objc.h>
+#import "../../objc-obj-c++-shared/TestsuiteObject.m"
typedef enum { black, white } color;
@@ -11,7 +10,7 @@ typedef struct
color b:2;
} color_couple;
-@interface TestClass: Object
+@interface TestClass: TestsuiteObject
{
color_couple *c;
}
@@ -50,4 +49,4 @@ int main (void)
return 0;
}
-#include "../../objc-obj-c++-shared/Object1-implementation.h"
+
diff --git a/gcc/testsuite/objc/execute/exceptions/catchall-1.m b/gcc/testsuite/objc/execute/exceptions/catchall-1.m
index 2db40a85486..ea8ef39936e 100644
--- a/gcc/testsuite/objc/execute/exceptions/catchall-1.m
+++ b/gcc/testsuite/objc/execute/exceptions/catchall-1.m
@@ -4,7 +4,7 @@
#include <stdio.h>
#include <stdlib.h>
-#import "../../../objc-obj-c++-shared/Object1.h"
+#include "../../../objc-obj-c++-shared/TestsuiteObject.m"
/* The following is not required in actual user code; we include it
here to check that the compiler generates an internal definition of
@@ -13,10 +13,10 @@
#define CHECK_IF(expr) if(!(expr)) abort()
-@interface Frob: Object
+@interface Frob: TestsuiteObject
@end
-@implementation Frob: Object
+@implementation Frob: TestsuiteObject
@end
static Frob* _connection = nil;
@@ -24,7 +24,7 @@ static Frob* _connection = nil;
//--------------------------------------------------------------------
-void test (Object* sendPort)
+void test (TestsuiteObject* sendPort)
{
int cleanupPorts = 1;
Frob* receivePort = nil;
@@ -51,7 +51,7 @@ void test (Object* sendPort)
printf ("cleanupPorts = %d\n", cleanupPorts);
printf ("---\n");
- @throw [Object new];
+ @throw [TestsuiteObject new];
}
@catch(Frob *obj) {
printf ("Exception caught by incorrect handler!\n");
@@ -71,7 +71,7 @@ void test (Object* sendPort)
int main (void) {
- test((Object *)-1);
+ test((TestsuiteObject *)-1);
return 0;
}
-#import "../../../objc-obj-c++-shared/Object1-implementation.h"
+
diff --git a/gcc/testsuite/objc/execute/exceptions/finally-1.m b/gcc/testsuite/objc/execute/exceptions/finally-1.m
index 370b19bb5ef..30ec7b2d12a 100644
--- a/gcc/testsuite/objc/execute/exceptions/finally-1.m
+++ b/gcc/testsuite/objc/execute/exceptions/finally-1.m
@@ -1,22 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
-//#import "../../../objc-obj-c++-shared/Object1.h"
-#ifdef __OBJC2__
-#include <objc/runtime.h>
-@interface Object
-+ initialize;
-+ new;
-- free;
-@end
-@implementation Object
-+ initialize { return self; }
-+ new { return class_createInstance (self, 0); }
-- free { return object_dispose(self);}
-@end
-
-#else
-#import "../../../objc-obj-c++-shared/Object1.h"
-#endif
+#include "../../../objc-obj-c++-shared/TestsuiteObject.m"
static int made_try = 0;
@@ -42,7 +26,7 @@ thrower()
@try
{
thrower_try_body();
- @throw [Object new];
+ @throw [TestsuiteObject new];
}
@finally
{
@@ -73,4 +57,4 @@ main(int ac, char *av[])
abort ();
return 0;
}
-//#import "../../../objc-obj-c++-shared/Object1-implementation.h"
+
diff --git a/gcc/testsuite/objc/execute/exceptions/foward-1.m b/gcc/testsuite/objc/execute/exceptions/foward-1.m
index 6b31d7cc86c..5738b225e23 100644
--- a/gcc/testsuite/objc/execute/exceptions/foward-1.m
+++ b/gcc/testsuite/objc/execute/exceptions/foward-1.m
@@ -1,34 +1,14 @@
/* Check that throwing an exception from a -forward:: works. */
/* Developed by Marcin Koziej <creep@desk.pl>. */
+#include <stdio.h>
#include <stdlib.h>
-#include <objc/Object.h>
-#ifndef __NEXT_RUNTIME__
-#import <objc/objc-api.h>
-#endif
-
-#ifdef __OBJC2__
-@interface Object (TEST_SUITE_ADDITIONS)
-+ initialize;
-+ alloc;
-+ new;
-- init;
-- free;
-@end
-
-@implementation Object (TEST_SUITE_ADDITIONS)
-+ initialize { return self; }
-+ alloc { return class_createInstance (self, 0); }
-+ new { return [[self alloc] init]; }
-- init { return self; }
-- free { return object_dispose(self); }
-@end
-#endif
+#include "../../../objc-obj-c++-shared/TestsuiteObject.m"
static int i;
__attribute__((objc_exception))
-@interface Thrower : Object
+@interface Thrower : TestsuiteObject
- forward: (SEL) s : (void*) a;
@end
@@ -36,7 +16,7 @@ __attribute__((objc_exception))
- forward: (SEL) s : (void*) a
{
i++;
- @throw [Object new];
+ @throw [TestsuiteObject new];
return nil;
}
@end
diff --git a/gcc/testsuite/objc/execute/exceptions/handler-1.m b/gcc/testsuite/objc/execute/exceptions/handler-1.m
index ab2fe8c533e..2127f44e288 100644
--- a/gcc/testsuite/objc/execute/exceptions/handler-1.m
+++ b/gcc/testsuite/objc/execute/exceptions/handler-1.m
@@ -13,9 +13,9 @@ int main(void)
#else
-#include <objc/objc-api.h>
+#include <objc/runtime.h>
#include <objc/objc-exception.h>
-#include <objc/Object.h>
+#include "../../../objc-obj-c++-shared/TestsuiteObject.m"
#include <stdlib.h>
static unsigned int handlerExpected = 0;
@@ -37,14 +37,14 @@ main(int argc, char *argv[])
@try
{
- @throw [Object new];
+ @throw [TestsuiteObject new];
}
@catch (id exc)
{
handlerExpected = 1;
}
- @throw [Object new];
+ @throw [TestsuiteObject new];
abort();
return 0;
}
diff --git a/gcc/testsuite/objc/execute/exceptions/local-variables-1.m b/gcc/testsuite/objc/execute/exceptions/local-variables-1.m
index 0488d792dcd..700df976084 100644
--- a/gcc/testsuite/objc/execute/exceptions/local-variables-1.m
+++ b/gcc/testsuite/objc/execute/exceptions/local-variables-1.m
@@ -4,7 +4,7 @@
#include <stdlib.h>
#include <stdio.h>
-#import "../../../objc-obj-c++-shared/Object1.h"
+#import "../../../objc-obj-c++-shared/TestsuiteObject.m"
int gi1 = 9, gi2 = 19;
float gf1 = 9.0, gf2 = 19.0;
@@ -29,13 +29,13 @@ void foo (int arg1, float *arg2)
local6 = 18.0;
pi = &gi2;
pf = &gf2;
- obj2 = obj1 = [Object new];
+ obj2 = obj1 = [TestsuiteObject new];
arg1 = 17;
arg2 = &gf2;
- @throw [Object new];
+ @throw [TestsuiteObject new];
}
- @catch (Object *obj) {
+ @catch (TestsuiteObject *obj) {
if (local1 != 123 || local2 != 345 || local3 != 5.0 || local4 != 6.0
|| local5 != 17 || local6 != 18.0) {
printf("Abort 1\n");
@@ -60,4 +60,4 @@ int main(void) {
foo(15, &gf1);
return 0;
}
-#import "../../../objc-obj-c++-shared/Object1-implementation.h"
+
diff --git a/gcc/testsuite/objc/execute/exceptions/matcher-1.m b/gcc/testsuite/objc/execute/exceptions/matcher-1.m
index ef0b627dab4..cbe4365da90 100644
--- a/gcc/testsuite/objc/execute/exceptions/matcher-1.m
+++ b/gcc/testsuite/objc/execute/exceptions/matcher-1.m
@@ -13,9 +13,9 @@ int main(void)
#else
-#include <objc/objc-api.h>
+#include <objc/runtime.h>
#include <objc/objc-exception.h>
-#include <objc/Object.h>
+#include "../../../objc-obj-c++-shared/TestsuiteObject.m"
#include <stdlib.h>
static unsigned int handlerExpected = 0;
@@ -27,13 +27,13 @@ my_exception_matcher(Class match_class, id exception)
return 1;
}
-@interface A : Object
+@interface A : TestsuiteObject
@end
@implementation A
@end
-@interface B : Object
+@interface B : TestsuiteObject
@end
@implementation B
diff --git a/gcc/testsuite/objc/execute/exceptions/throw-nil.m b/gcc/testsuite/objc/execute/exceptions/throw-nil.m
index cd9a797f5fd..b6e7b8bb306 100644
--- a/gcc/testsuite/objc/execute/exceptions/throw-nil.m
+++ b/gcc/testsuite/objc/execute/exceptions/throw-nil.m
@@ -1,5 +1,5 @@
#include <objc/objc.h>
-#include <objc/Object.h>
+#include "../../../objc-obj-c++-shared/TestsuiteObject.m"
#ifdef __NEXT_RUNTIME__
/* This test only runs for the GNU runtime. */
@@ -24,7 +24,7 @@ int main (void)
{
@throw nil;
}
- @catch (Object *exc)
+ @catch (TestsuiteObject *exc)
{
abort ();
}
diff --git a/gcc/testsuite/objc/execute/exceptions/trivial.m b/gcc/testsuite/objc/execute/exceptions/trivial.m
index 4e55e9d841b..d218183f341 100644
--- a/gcc/testsuite/objc/execute/exceptions/trivial.m
+++ b/gcc/testsuite/objc/execute/exceptions/trivial.m
@@ -1,5 +1,5 @@
#include <stdlib.h>
-#import "../../../objc-obj-c++-shared/Object1.h"
+#include "../../../objc-obj-c++-shared/TestsuiteObject.m"
/* do nothing except prove we can compile and link code calling the
ecceptions mechanism */
@@ -8,12 +8,10 @@ int main(void)
{
@try {
int a = 1 ;
- @throw [Object new];
+ @throw [TestsuiteObject new];
}
- @catch (Object *obj) {
+ @catch (TestsuiteObject *obj) {
return 0;
}
abort();
}
-
-#import "../../../objc-obj-c++-shared/Object1-implementation.h"
diff --git a/gcc/testsuite/objc/execute/formal_protocol-1.m b/gcc/testsuite/objc/execute/formal_protocol-1.m
index 651444963f8..f0b5853876a 100644
--- a/gcc/testsuite/objc/execute/formal_protocol-1.m
+++ b/gcc/testsuite/objc/execute/formal_protocol-1.m
@@ -1,7 +1,7 @@
/* Contributed by Nicola Pero - Fri Mar 9 21:35:47 CET 2001 */
#include <stdlib.h>
-#import "../../objc-obj-c++-shared/Object1.h"
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
/* Tests defining a protocol and a class adopting it */
@@ -10,7 +10,7 @@
- (void) setEnabled: (BOOL)flag;
@end
-@interface Feature : Object <Enabling>
+@interface Feature : TestsuiteObject <Enabling>
{
const char *name;
BOOL isEnabled;
@@ -42,4 +42,4 @@ int main (void)
return 0;
}
-#include "../../objc-obj-c++-shared/Object1-implementation.h"
+
diff --git a/gcc/testsuite/objc/execute/formal_protocol-2.m b/gcc/testsuite/objc/execute/formal_protocol-2.m
index b830cd96ee5..e3c9db1fbef 100644
--- a/gcc/testsuite/objc/execute/formal_protocol-2.m
+++ b/gcc/testsuite/objc/execute/formal_protocol-2.m
@@ -1,7 +1,7 @@
/* Contributed by Nicola Pero - Fri Mar 9 21:35:47 CET 2001 */
#include <stdlib.h>
-#import "../../objc-obj-c++-shared/Object1.h"
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
/* Test defining a protocol, a class adopting it, and using an object
of type `id <protocol>'. */
@@ -11,7 +11,7 @@
- (void) setEnabled: (BOOL)flag;
@end
-@interface Feature : Object <Enabling>
+@interface Feature : TestsuiteObject <Enabling>
{
const char *name;
BOOL isEnabled;
@@ -43,4 +43,4 @@ int main (void)
return 0;
}
-#include "../../objc-obj-c++-shared/Object1-implementation.h"
+
diff --git a/gcc/testsuite/objc/execute/formal_protocol-3.m b/gcc/testsuite/objc/execute/formal_protocol-3.m
index f28c95fecbf..0339b954838 100644
--- a/gcc/testsuite/objc/execute/formal_protocol-3.m
+++ b/gcc/testsuite/objc/execute/formal_protocol-3.m
@@ -1,7 +1,7 @@
/* Contributed by Nicola Pero - Fri Mar 9 21:35:47 CET 2001 */
#include <stdlib.h>
-#import "../../objc-obj-c++-shared/Object1.h"
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
/* Test defining two protocol, a class adopting both of them,
and using an object of type `id <Protocol1, Protocol2>' */
@@ -15,7 +15,7 @@
- (int) importance;
@end
-@interface Feature : Object <Enabling, Evaluating>
+@interface Feature : TestsuiteObject <Enabling, Evaluating>
{
const char *name;
BOOL isEnabled;
@@ -56,4 +56,4 @@ int main (void)
return 0;
}
-#include "../../objc-obj-c++-shared/Object1-implementation.h"
+
diff --git a/gcc/testsuite/objc/execute/formal_protocol-4.m b/gcc/testsuite/objc/execute/formal_protocol-4.m
index 10aba89360a..a416c4a0c09 100644
--- a/gcc/testsuite/objc/execute/formal_protocol-4.m
+++ b/gcc/testsuite/objc/execute/formal_protocol-4.m
@@ -1,7 +1,7 @@
/* Contributed by Nicola Pero - Fri Mar 9 21:35:47 CET 2001 */
#include <stdlib.h>
-#import "../../objc-obj-c++-shared/Object1.h"
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
/* Test defining a protocol, a class adopting it in a category */
@@ -9,7 +9,7 @@
- (int) importance;
@end
-@interface Feature : Object
+@interface Feature : TestsuiteObject
@end
@implementation Feature
@@ -38,4 +38,4 @@ int main (void)
return 0;
}
-#include "../../objc-obj-c++-shared/Object1-implementation.h"
+
diff --git a/gcc/testsuite/objc/execute/formal_protocol-5.m b/gcc/testsuite/objc/execute/formal_protocol-5.m
index c3bd53d3ace..73ec02f7e0b 100644
--- a/gcc/testsuite/objc/execute/formal_protocol-5.m
+++ b/gcc/testsuite/objc/execute/formal_protocol-5.m
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <objc/Protocol.h>
-#include "../../objc-obj-c++-shared/next-mapping.h"
+#include "../../objc-obj-c++-shared/runtime.h"
/* Test defining a protocol, and accessing it using @protocol */
@@ -25,11 +25,7 @@ int main (void)
{
Protocol *protocol = @protocol (Evaluating);
-#ifdef NEXT_OBJC_USE_NEW_INTERFACE
if (strcmp (protocol_getName(protocol), "Evaluating"))
-#else
- if (strcmp ([protocol name], "Evaluating"))
-#endif
{
abort ();
}
diff --git a/gcc/testsuite/objc/execute/formal_protocol-6.m b/gcc/testsuite/objc/execute/formal_protocol-6.m
index b02fc1ea42c..6677963274d 100644
--- a/gcc/testsuite/objc/execute/formal_protocol-6.m
+++ b/gcc/testsuite/objc/execute/formal_protocol-6.m
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <objc/Protocol.h>
-#include "../../objc-obj-c++-shared/next-mapping.h"
+#include "../../objc-obj-c++-shared/runtime.h"
/* Test defining a protocol, and accessing it using @protocol */
@@ -17,11 +17,7 @@ int main (void)
{
Protocol *protocol = @protocol (Evaluating);
-#ifdef NEXT_OBJC_USE_NEW_INTERFACE
if (strcmp (protocol_getName(protocol), "Evaluating"))
-#else
- if (strcmp ([protocol name], "Evaluating"))
-#endif
{
abort ();
}
diff --git a/gcc/testsuite/objc/execute/formal_protocol-7.m b/gcc/testsuite/objc/execute/formal_protocol-7.m
index d15013a29ef..9e9e730ff70 100644
--- a/gcc/testsuite/objc/execute/formal_protocol-7.m
+++ b/gcc/testsuite/objc/execute/formal_protocol-7.m
@@ -1,7 +1,8 @@
/* Contributed by Nicola Pero - Fri Mar 9 21:35:47 CET 2001 */
#include <stdlib.h>
-#import "../../objc-obj-c++-shared/Protocol1.h"
+#include <objc/Protocol.h>
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
/* Test defining two protocols, one incorporating the other one. */
@@ -14,7 +15,7 @@
@end
/* A class adopting the protocol */
-@interface Test : Object <Processing>
+@interface Test : TestsuiteObject <Processing>
{
BOOL didConfigure;
BOOL didProcess;
@@ -41,4 +42,4 @@ int main (void)
return 0;
}
-#include "../../objc-obj-c++-shared/Object1-implementation.h"
+
diff --git a/gcc/testsuite/objc/execute/function-message-1.m b/gcc/testsuite/objc/execute/function-message-1.m
index 6f4d879201a..f676dd9a06a 100644
--- a/gcc/testsuite/objc/execute/function-message-1.m
+++ b/gcc/testsuite/objc/execute/function-message-1.m
@@ -1,6 +1,6 @@
-#import "../../objc-obj-c++-shared/Object1.h"
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
-@interface Foo : Object
+@interface Foo : TestsuiteObject
+ bar;
@end
diff --git a/gcc/testsuite/objc/execute/informal_protocol.m b/gcc/testsuite/objc/execute/informal_protocol.m
index 3978e6aa2de..e21a750ee58 100644
--- a/gcc/testsuite/objc/execute/informal_protocol.m
+++ b/gcc/testsuite/objc/execute/informal_protocol.m
@@ -1,8 +1,8 @@
/* Contributed by Nicola Pero - Fri Mar 9 21:35:47 CET 2001 */
-#import "../../objc-obj-c++-shared/Object1.h"
+#import "../../objc-obj-c++-shared/TestsuiteObject.h"
#include <objc/objc.h>
-@interface Object (StopProtocol)
+@interface TestsuiteObject (StopProtocol)
- (void) stop;
@end
diff --git a/gcc/testsuite/objc/execute/load-3.m b/gcc/testsuite/objc/execute/load-3.m
index 15dfc0b485d..d27b3c97c69 100644
--- a/gcc/testsuite/objc/execute/load-3.m
+++ b/gcc/testsuite/objc/execute/load-3.m
@@ -9,10 +9,10 @@
*/
#include <stdlib.h>
-#import "../../objc-obj-c++-shared/Object1.h"
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
#include <objc/objc.h>
-@interface A : Object
+@interface A : TestsuiteObject
@end
@interface B : A
diff --git a/gcc/testsuite/objc/execute/many_args_method.m b/gcc/testsuite/objc/execute/many_args_method.m
index 6cc2e2535ed..0c2166945a1 100644
--- a/gcc/testsuite/objc/execute/many_args_method.m
+++ b/gcc/testsuite/objc/execute/many_args_method.m
@@ -30,9 +30,7 @@
{
return [self sumInteger: a withInteger: b withInteger: c];
}
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
diff --git a/gcc/testsuite/objc/execute/nested-3.m b/gcc/testsuite/objc/execute/nested-3.m
index 5462fd5ef7a..1ca0c48362f 100644
--- a/gcc/testsuite/objc/execute/nested-3.m
+++ b/gcc/testsuite/objc/execute/nested-3.m
@@ -22,9 +22,7 @@
return test ();
}
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
int main (void)
diff --git a/gcc/testsuite/objc/execute/nested-func-1.m b/gcc/testsuite/objc/execute/nested-func-1.m
index a4c9a561968..fbe9e25241a 100644
--- a/gcc/testsuite/objc/execute/nested-func-1.m
+++ b/gcc/testsuite/objc/execute/nested-func-1.m
@@ -3,7 +3,7 @@
/* Contributed by Ziemowit Laski <zlaski@apple.com>. */
#include <stdio.h>
#include <stdlib.h>
-#import "../../objc-obj-c++-shared/Object1.h"
+#import "../../objc-obj-c++-shared/TestsuiteObject.m"
#include <objc/objc.h>
int bappy (int (*blargh) (int a, int b, int c))
@@ -11,7 +11,7 @@ int bappy (int (*blargh) (int a, int b, int c))
return blargh (4, 7, 2) + 3;
}
-@interface Foo: Object
+@interface Foo: TestsuiteObject
+ (int)foo;
@end
diff --git a/gcc/testsuite/objc/execute/next_mapping.h b/gcc/testsuite/objc/execute/next_mapping.h
deleted file mode 100644
index c28f173ce1a..00000000000
--- a/gcc/testsuite/objc/execute/next_mapping.h
+++ /dev/null
@@ -1,906 +0,0 @@
-/* This file "renames" various ObjC GNU runtime entry points
- (and fakes the existence of several others)
- if the NeXT runtime is being used. */
-/* Authors: Ziemowit Laski <zlaski@apple.com> */
-/* David Ayers <d.ayers@inode.at> */
-
-#ifdef __NEXT_RUNTIME__
-#include <objc/objc-class.h>
-#include <objc/Object.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define objc_get_class(C) objc_getClass(C)
-#define objc_get_meta_class(C) objc_getMetaClass(C)
-#define class_get_class_method(C, S) class_getClassMethod(C, S)
-#define class_get_instance_method(C, S) class_getInstanceMethod(C, S)
-#define method_get_imp(M) (((Method)M)->method_imp)
-#define sel_get_name(S) sel_getName(S)
-#define class_create_instance(C) class_createInstance(C, 0)
-#define class_get_class_name(C) object_getClassName(C)
-#define class_get_super_class(C) (((struct objc_class *)C)->super_class)
-#define object_get_super_class(O) class_get_super_class(*(struct objc_class **)O)
-#define objc_lookup_class(N) objc_lookUpClass(N)
-#define object_get_class(O) (*(struct objc_class **)O)
-#define class_is_class(C) (CLS_GETINFO((struct objc_class *)C, CLS_CLASS)? YES: NO)
-#define class_is_meta_class(C) (CLS_GETINFO((struct objc_class *)C, CLS_META)? YES: NO)
-#define object_is_class(O) class_is_meta_class(*(struct objc_class **)O)
-#define object_is_meta_class(O) (class_is_meta_class(O) && class_is_meta_class(*(struct objc_class **)O))
-
-/* You need either an empty +initialize method or an empty -forward:: method.
- The NeXT runtime unconditionally sends +initialize to classes when they are
- first used, and unconditionally tries to forward methods that the class
- doesn't understand (including +initialize). If you have neither +initialize
- nor -forward::, the runtime complains.
-
- The simplest workaround is to add
-
- + initialize { return self; }
-
- to every root class @implementation. */
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* The following is necessary to "cover" the bf*.m test cases on NeXT. */
-
-#undef MAX
-#undef MIN
-#undef ROUND
-
-#ifdef __cplusplus
-#define MAX(X, Y) ((X > Y) ? X : Y)
-#define MIN(X, Y) ((X < Y) ? X : Y)
-#define ROUND(V, A) (A * ((V + A - 1) / A))
-#else
-#define MAX(X, Y) \
- ({ typeof (X) __x = (X), __y = (Y); \
- (__x > __y ? __x : __y); })
-#define MIN(X, Y) \
- ({ typeof (X) __x = (X), __y = (Y); \
- (__x < __y ? __x : __y); })
-#define ROUND(V, A) \
- ({ typeof (V) __v = (V); typeof (A) __a = (A); \
- __a * ((__v+__a - 1)/__a); })
-#endif
-
-#define BITS_PER_UNIT __CHAR_BIT__
-typedef struct{ char a; } __small_struct;
-#define STRUCTURE_SIZE_BOUNDARY (BITS_PER_UNIT * sizeof (__small_struct))
-
-/* Not sure why the following are missing from NeXT objc headers... */
-
-#ifndef _C_LNG_LNG
-#define _C_LNG_LNG 'q'
-#endif
-#ifndef _C_ULNG_LNG
-#define _C_ULNG_LNG 'Q'
-#endif
-#ifndef _C_ATOM
-#define _C_ATOM '%'
-#endif
-#ifndef _C_BOOL
-#define _C_BOOL 'B'
-#endif
-
-#define _C_CONST 'r'
-#define _C_IN 'n'
-#define _C_INOUT 'N'
-#define _C_OUT 'o'
-#define _C_BYCOPY 'O'
-#define _C_BYREF 'R'
-#define _C_ONEWAY 'V'
-#define _C_GCINVISIBLE '!'
-
-#define _F_CONST 0x01
-#define _F_IN 0x01
-#define _F_OUT 0x02
-#define _F_INOUT 0x03
-#define _F_BYCOPY 0x04
-#define _F_BYREF 0x08
-#define _F_ONEWAY 0x10
-#define _F_GCINVISIBLE 0x20
-
-struct objc_struct_layout
-{
- const char *original_type;
- const char *type;
- const char *prev_type;
- unsigned int record_size;
- unsigned int record_align;
-};
-
-typedef union arglist {
- char *arg_ptr;
- char arg_regs[sizeof (char*)];
-} *arglist_t; /* argument frame */
-
-const char *objc_skip_typespec (const char *type);
-void objc_layout_structure_get_info (struct objc_struct_layout *layout,
- unsigned int *offset, unsigned int *align, const char **type);
-void objc_layout_structure (const char *type,
- struct objc_struct_layout *layout);
-BOOL objc_layout_structure_next_member (struct objc_struct_layout *layout);
-void objc_layout_finish_structure (struct objc_struct_layout *layout,
- unsigned int *size, unsigned int *align);
-int objc_aligned_size (const char *type);
-
-/*
- return the size of an object specified by type
-*/
-
-int
-objc_sizeof_type (const char *type)
-{
- /* Skip the variable name if any */
- if (*type == '"')
- {
- for (type++; *type++ != '"';)
- /* do nothing */;
- }
-
- switch (*type) {
- case _C_ID:
- return sizeof (id);
- break;
-
- case _C_CLASS:
- return sizeof (Class);
- break;
-
- case _C_SEL:
- return sizeof (SEL);
- break;
-
- case _C_CHR:
- return sizeof (char);
- break;
-
- case _C_UCHR:
- return sizeof (unsigned char);
- break;
-
- case _C_SHT:
- return sizeof (short);
- break;
-
- case _C_USHT:
- return sizeof (unsigned short);
- break;
-
- case _C_INT:
- return sizeof (int);
- break;
-
- case _C_UINT:
- return sizeof (unsigned int);
- break;
-
- case _C_LNG:
- return sizeof (long);
- break;
-
- case _C_ULNG:
- return sizeof (unsigned long);
- break;
-
- case _C_LNG_LNG:
- return sizeof (long long);
- break;
-
- case _C_ULNG_LNG:
- return sizeof (unsigned long long);
- break;
-
- case _C_FLT:
- return sizeof (float);
- break;
-
- case _C_DBL:
- return sizeof (double);
- break;
-
- case _C_PTR:
- case _C_ATOM:
- case _C_CHARPTR:
- return sizeof (char *);
- break;
-
- case _C_ARY_B:
- {
- int len = atoi (type + 1);
- while (isdigit ((unsigned char)*++type))
- ;
- return len * objc_aligned_size (type);
- }
- break;
-
- case _C_BFLD:
- {
- /* The NeXT encoding of bitfields is _still_: b 'size' */
- int size = atoi (type + 1);
- /* Return an upper bound on byte size */
- return (size + BITS_PER_UNIT - 1) / BITS_PER_UNIT;
- }
-
- case _C_STRUCT_B:
- {
- struct objc_struct_layout layout;
- unsigned int size;
-
- objc_layout_structure (type, &layout);
- while (objc_layout_structure_next_member (&layout))
- /* do nothing */ ;
- objc_layout_finish_structure (&layout, &size, NULL);
-
- return size;
- }
-
- case _C_UNION_B:
- {
- int max_size = 0;
- while (*type != _C_UNION_E && *type++ != '=')
- /* do nothing */;
- while (*type != _C_UNION_E)
- {
- /* Skip the variable name if any */
- if (*type == '"')
- {
- for (type++; *type++ != '"';)
- /* do nothing */;
- }
- max_size = MAX (max_size, objc_sizeof_type (type));
- type = objc_skip_typespec (type);
- }
- return max_size;
- }
- }
- return 0; /* error */
-}
-
-
-/*
- Return the alignment of an object specified by type
-*/
-
-int
-objc_alignof_type (const char *type)
-{
- /* Skip the variable name if any */
- if (*type == '"')
- {
- for (type++; *type++ != '"';)
- /* do nothing */;
- }
- switch (*type) {
- case _C_ID:
- return __alignof__ (id);
- break;
-
- case _C_CLASS:
- return __alignof__ (Class);
- break;
-
- case _C_SEL:
- return __alignof__ (SEL);
- break;
-
- case _C_CHR:
- return __alignof__ (char);
- break;
-
- case _C_UCHR:
- return __alignof__ (unsigned char);
- break;
-
- case _C_SHT:
- return __alignof__ (short);
- break;
-
- case _C_USHT:
- return __alignof__ (unsigned short);
- break;
-
- case _C_INT:
- case _C_BFLD: /* This is for the NeXT only */
- return __alignof__ (int);
- break;
-
- case _C_UINT:
- return __alignof__ (unsigned int);
- break;
-
- case _C_LNG:
- return __alignof__ (long);
- break;
-
- case _C_ULNG:
- return __alignof__ (unsigned long);
- break;
-
- case _C_LNG_LNG:
- return __alignof__ (long long);
- break;
-
- case _C_ULNG_LNG:
- return __alignof__ (unsigned long long);
- break;
-
- case _C_FLT:
- return __alignof__ (float);
- break;
-
- case _C_DBL:
- return __alignof__ (double);
- break;
-
- case _C_PTR:
- case _C_ATOM:
- case _C_CHARPTR:
- return __alignof__ (char *);
- break;
-
- case _C_ARY_B:
- while (isdigit ((unsigned char)*++type))
- /* do nothing */;
- return objc_alignof_type (type);
-
- case _C_STRUCT_B:
- {
- struct objc_struct_layout layout;
- unsigned int align;
-
- objc_layout_structure (type, &layout);
- while (objc_layout_structure_next_member (&layout))
- /* do nothing */;
- objc_layout_finish_structure (&layout, NULL, &align);
-
- return align;
- }
-
- case _C_UNION_B:
- {
- int maxalign = 0;
- while (*type != _C_UNION_E && *type++ != '=')
- /* do nothing */;
- while (*type != _C_UNION_E)
- {
- /* Skip the variable name if any */
- if (*type == '"')
- {
- for (type++; *type++ != '"';)
- /* do nothing */;
- }
- maxalign = MAX (maxalign, objc_alignof_type (type));
- type = objc_skip_typespec (type);
- }
- return maxalign;
- }
- }
- return 0; /* error */
-}
-
-/*
- The aligned size if the size rounded up to the nearest alignment.
-*/
-
-int
-objc_aligned_size (const char *type)
-{
- int size, align;
-
- /* Skip the variable name */
- if (*type == '"')
- {
- for (type++; *type++ != '"';)
- /* do nothing */;
- }
-
- size = objc_sizeof_type (type);
- align = objc_alignof_type (type);
-
- return ROUND (size, align);
-}
-
-/*
- The size rounded up to the nearest integral of the wordsize, taken
- to be the size of a void *.
-*/
-
-int
-objc_promoted_size (const char *type)
-{
- int size, wordsize;
-
- /* Skip the variable name */
- if (*type == '"')
- {
- for (type++; *type++ != '"';)
- /* do nothing */;
- }
-
- size = objc_sizeof_type (type);
- wordsize = sizeof (void *);
-
- return ROUND (size, wordsize);
-}
-
-/*
- Skip type qualifiers. These may eventually precede typespecs
- occurring in method prototype encodings.
-*/
-
-inline const char *
-objc_skip_type_qualifiers (const char *type)
-{
- while (*type == _C_CONST
- || *type == _C_IN
- || *type == _C_INOUT
- || *type == _C_OUT
- || *type == _C_BYCOPY
- || *type == _C_BYREF
- || *type == _C_ONEWAY
- || *type == _C_GCINVISIBLE)
- {
- type += 1;
- }
- return type;
-}
-
-
-/*
- Skip one typespec element. If the typespec is prepended by type
- qualifiers, these are skipped as well.
-*/
-
-const char *
-objc_skip_typespec (const char *type)
-{
- /* Skip the variable name if any */
- if (*type == '"')
- {
- for (type++; *type++ != '"';)
- /* do nothing */;
- }
-
- type = objc_skip_type_qualifiers (type);
-
- switch (*type) {
-
- case _C_ID:
- /* An id may be annotated by the actual type if it is known
- with the @"ClassName" syntax */
-
- if (*++type != '"')
- return type;
- else
- {
- while (*++type != '"')
- /* do nothing */;
- return type + 1;
- }
-
- /* The following are one character type codes */
- case _C_CLASS:
- case _C_SEL:
- case _C_CHR:
- case _C_UCHR:
- case _C_CHARPTR:
- case _C_ATOM:
- case _C_SHT:
- case _C_USHT:
- case _C_INT:
- case _C_UINT:
- case _C_LNG:
- case _C_ULNG:
- case _C_LNG_LNG:
- case _C_ULNG_LNG:
- case _C_FLT:
- case _C_DBL:
- case _C_VOID:
- case _C_UNDEF:
- return ++type;
- break;
-
- case _C_ARY_B:
- /* skip digits, typespec and closing ']' */
-
- while (isdigit ((unsigned char)*++type))
- ;
- type = objc_skip_typespec (type);
- if (*type == _C_ARY_E)
- return ++type;
- else
- break; /* error */
-
- case _C_BFLD:
- /* The NeXT encoding for bitfields is _still_: b 'size' */
- while (isdigit ((unsigned char)*++type))
- ; /* skip type and size */
- return type;
-
- case _C_STRUCT_B:
- /* skip name, and elements until closing '}' */
-
- while (*type != _C_STRUCT_E && *type++ != '=')
- ;
- while (*type != _C_STRUCT_E)
- {
- type = objc_skip_typespec (type);
- }
- return ++type;
-
- case _C_UNION_B:
- /* skip name, and elements until closing ')' */
-
- while (*type != _C_UNION_E && *type++ != '=')
- ;
- while (*type != _C_UNION_E)
- {
- type = objc_skip_typespec (type);
- }
- return ++type;
-
- case _C_PTR:
- /* Just skip the following typespec */
-
- return objc_skip_typespec (++type);
- }
- return 0; /* error */
-}
-
-/*
- Skip an offset as part of a method encoding. This is prepended by a
- '+' if the argument is passed in registers.
-*/
-inline const char *
-objc_skip_offset (const char *type)
-{
- if (*type == '+')
- type++;
- while (isdigit ((unsigned char) *++type))
- ;
- return type;
-}
-
-/*
- Skip an argument specification of a method encoding.
-*/
-const char *
-objc_skip_argspec (const char *type)
-{
- type = objc_skip_typespec (type);
- type = objc_skip_offset (type);
- return type;
-}
-
-/*
- Return the number of arguments that the method MTH expects.
- Note that all methods need two implicit arguments `self' and
- `_cmd'.
-*/
-int
-method_get_number_of_arguments (struct objc_method *mth)
-{
- int i = 0;
- const char *type = mth->method_types;
- while (*type)
- {
- type = objc_skip_argspec (type);
- i += 1;
- }
- return i - 1;
-}
-
-/*
- Return the size of the argument block needed on the stack to invoke
- the method MTH. This may be zero, if all arguments are passed in
- registers.
-*/
-
-int
-method_get_sizeof_arguments (struct objc_method *mth)
-{
- const char *type = objc_skip_typespec (mth->method_types);
- return atoi (type);
-}
-
-/*
- Return a pointer to the next argument of ARGFRAME. type points to
- the last argument. Typical use of this look like:
-
- {
- char *datum, *type;
- for (datum = method_get_first_argument (method, argframe, &type);
- datum; datum = method_get_next_argument (argframe, &type))
- {
- unsigned flags = objc_get_type_qualifiers (type);
- type = objc_skip_type_qualifiers (type);
- if (*type != _C_PTR)
- [portal encodeData: datum ofType: type];
- else
- {
- if ((flags & _F_IN) == _F_IN)
- [portal encodeData: *(char **) datum ofType: ++type];
- }
- }
- }
-*/
-
-char *
-method_get_next_argument (arglist_t argframe, const char **type)
-{
- const char *t = objc_skip_argspec (*type);
-
- if (*t == '\0')
- return 0;
-
- *type = t;
- t = objc_skip_typespec (t);
-
- if (*t == '+')
- return argframe->arg_regs + atoi (++t);
- else
- return argframe->arg_ptr + atoi (t);
-}
-
-/*
- Return a pointer to the value of the first argument of the method
- described in M with the given argumentframe ARGFRAME. The type
- is returned in TYPE. type must be passed to successive calls of
- method_get_next_argument.
-*/
-char *
-method_get_first_argument (struct objc_method *m,
- arglist_t argframe,
- const char **type)
-{
- *type = m->method_types;
- return method_get_next_argument (argframe, type);
-}
-
-/*
- Return a pointer to the ARGth argument of the method
- M from the frame ARGFRAME. The type of the argument
- is returned in the value-result argument TYPE
-*/
-
-char *
-method_get_nth_argument (struct objc_method *m,
- arglist_t argframe, int arg,
- const char **type)
-{
- const char *t = objc_skip_argspec (m->method_types);
-
- if (arg > method_get_number_of_arguments (m))
- return 0;
-
- while (arg--)
- t = objc_skip_argspec (t);
-
- *type = t;
- t = objc_skip_typespec (t);
-
- if (*t == '+')
- return argframe->arg_regs + atoi (++t);
- else
- return argframe->arg_ptr + atoi (t);
-}
-
-unsigned
-objc_get_type_qualifiers (const char *type)
-{
- unsigned res = 0;
- BOOL flag = YES;
-
- while (flag)
- switch (*type++)
- {
- case _C_CONST: res |= _F_CONST; break;
- case _C_IN: res |= _F_IN; break;
- case _C_INOUT: res |= _F_INOUT; break;
- case _C_OUT: res |= _F_OUT; break;
- case _C_BYCOPY: res |= _F_BYCOPY; break;
- case _C_BYREF: res |= _F_BYREF; break;
- case _C_ONEWAY: res |= _F_ONEWAY; break;
- case _C_GCINVISIBLE: res |= _F_GCINVISIBLE; break;
- default: flag = NO;
- }
-
- return res;
-}
-
-
-/* The following three functions can be used to determine how a
- structure is laid out by the compiler. For example:
-
- struct objc_struct_layout layout;
- int i;
-
- objc_layout_structure (type, &layout);
- while (objc_layout_structure_next_member (&layout))
- {
- int position, align;
- const char *type;
-
- objc_layout_structure_get_info (&layout, &position, &align, &type);
- printf ("element %d has offset %d, alignment %d\n",
- i++, position, align);
- }
-
- These functions are used by objc_sizeof_type and objc_alignof_type
- functions to compute the size and alignment of structures. The
- previous method of computing the size and alignment of a structure
- was not working on some architectures, particulary on AIX, and in
- the presence of bitfields inside the structure. */
-void
-objc_layout_structure (const char *type,
- struct objc_struct_layout *layout)
-{
- const char *ntype;
-
- layout->original_type = ++type;
-
- /* Skip "<name>=" if any. Avoid embedded structures and unions. */
- ntype = type;
- while (*ntype != _C_STRUCT_E && *ntype != _C_STRUCT_B && *ntype != _C_UNION_B
- && *ntype++ != '=')
- /* do nothing */;
-
- /* If there's a "<name>=", ntype - 1 points to '='; skip the name */
- if (*(ntype - 1) == '=')
- type = ntype;
-
- layout->type = type;
- layout->prev_type = NULL;
- layout->record_size = 0;
- layout->record_align = MAX (BITS_PER_UNIT, STRUCTURE_SIZE_BOUNDARY);
-}
-
-
-BOOL
-objc_layout_structure_next_member (struct objc_struct_layout *layout)
-{
- register int desired_align = 0;
-
- /* The current type without the type qualifiers */
- const char *type;
-
- /* Add the size of the previous field to the size of the record. */
- if (layout->prev_type)
- {
- type = objc_skip_type_qualifiers (layout->prev_type);
-
- if (*type != _C_BFLD)
- layout->record_size += objc_sizeof_type (type) * BITS_PER_UNIT;
- else
- layout->record_size += atoi (++type);
- }
-
- if (*layout->type == _C_STRUCT_E)
- return NO;
-
- /* Skip the variable name if any */
- if (*layout->type == '"')
- {
- for (layout->type++; *layout->type++ != '"';)
- /* do nothing */;
- }
-
- type = objc_skip_type_qualifiers (layout->type);
-
- desired_align = objc_alignof_type (type) * BITS_PER_UNIT;
-
- /* Record must have at least as much alignment as any field.
- Otherwise, the alignment of the field within the record
- is meaningless. */
- layout->record_align = MAX (layout->record_align, desired_align);
-
- if (*type == _C_BFLD)
- {
- int bfld_size = atoi (++type);
- int int_align = __alignof__ (int) * BITS_PER_UNIT;
- /* If this bitfield would traverse a word alignment boundary, push it out
- to that boundary instead. */
- if (layout->record_size % int_align
- && (layout->record_size / int_align
- < (layout->record_size + bfld_size - 1) / int_align))
- layout->record_size = ROUND (layout->record_size, int_align);
- }
- else if (layout->record_size % desired_align != 0)
- {
- /* We need to skip space before this field.
- Bump the cumulative size to multiple of field alignment. */
- layout->record_size = ROUND (layout->record_size, desired_align);
- }
-
- /* Jump to the next field in record. */
-
- layout->prev_type = layout->type;
- layout->type = objc_skip_typespec (layout->type); /* skip component */
-
- return YES;
-}
-
-
-void objc_layout_finish_structure (struct objc_struct_layout *layout,
- unsigned int *size,
- unsigned int *align)
-{
- if (layout->type && *layout->type == _C_STRUCT_E)
- {
- /* Round the size up to be a multiple of the required alignment */
- layout->record_size = ROUND (layout->record_size, layout->record_align);
- layout->type = NULL;
- }
- if (size)
- *size = layout->record_size / BITS_PER_UNIT;
- if (align)
- *align = layout->record_align / BITS_PER_UNIT;
-}
-
-
-void objc_layout_structure_get_info (struct objc_struct_layout *layout,
- unsigned int *offset,
- unsigned int *align,
- const char **type)
-{
- if (offset)
- *offset = layout->record_size / BITS_PER_UNIT;
- if (align)
- *align = layout->record_align / BITS_PER_UNIT;
- if (type)
- *type = layout->prev_type;
-}
-
-/* A small, portable NSConstantString implementation for use with the NeXT
- runtime.
-
- On full-fledged Mac OS X systems, NSConstantString is provided
- as part of the Foundation framework. However, on bare Darwin systems,
- Foundation is not included, and hence there is no NSConstantString
- implementation to link against.
-
- This code is derived from the GNU runtime's NXConstantString implementation.
-*/
-
-struct objc_class _NSConstantStringClassReference;
-
-@interface NSConstantString : Object
-{
- char *c_string;
- unsigned int len;
-}
-
--(const char *) cString;
--(unsigned int) length;
-
-@end
-
-@implementation NSConstantString
-
--(const char *) cString
-{
- return (c_string);
-}
-
--(unsigned int) length
-{
- return (len);
-}
-
-@end
-
-/* The NSConstantString metaclass will need to be initialized before we can
- send messages to strings. */
-
-void objc_constant_string_init (void) __attribute__((constructor));
-void objc_constant_string_init (void) {
- memcpy (&_NSConstantStringClassReference,
- objc_getClass ("NSConstantString"),
- sizeof (_NSConstantStringClassReference));
-}
-
-#endif /* #ifdef __NEXT_RUNTIME__ */
diff --git a/gcc/testsuite/objc/execute/nil_method-1.m b/gcc/testsuite/objc/execute/nil_method-1.m
index 137d2072e44..3835f2fece4 100644
--- a/gcc/testsuite/objc/execute/nil_method-1.m
+++ b/gcc/testsuite/objc/execute/nil_method-1.m
@@ -1,12 +1,12 @@
/* Contributed by Nicola Pero - Fri Aug 30 12:55:37 2002 */
#include <objc/objc.h>
-#include <objc/Object.h>
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
/* Test that calling a method of a nil object results in
nothing to happen (but not a crash), and nil to be
returned. */
-@interface TestClass : Object
+@interface TestClass : TestsuiteObject
- (void) testVoid;
- (id) testId;
diff --git a/gcc/testsuite/objc/execute/no_clash.m b/gcc/testsuite/objc/execute/no_clash.m
index d4ab4cb1c87..5db6a57b801 100644
--- a/gcc/testsuite/objc/execute/no_clash.m
+++ b/gcc/testsuite/objc/execute/no_clash.m
@@ -1,11 +1,11 @@
/* Contributed by Nicola Pero - Fri Mar 9 19:39:15 CET 2001 */
-#import "../../objc-obj-c++-shared/Object1.h"
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
#import <objc/objc.h>
/* Test that using the same name for different things makes no
problem */
-@interface TestClass : Object
+@interface TestClass : TestsuiteObject
{
int test;
}
@@ -39,4 +39,4 @@ int main (void)
return 0;
}
-#include "../../objc-obj-c++-shared/Object1-implementation.h"
+
diff --git a/gcc/testsuite/objc/execute/np-1.m b/gcc/testsuite/objc/execute/np-1.m
index 1cf83ff7fec..a14fcc3e638 100644
--- a/gcc/testsuite/objc/execute/np-1.m
+++ b/gcc/testsuite/objc/execute/np-1.m
@@ -3,7 +3,6 @@
* Tue Sep 19 4:29AM
*/
-#include "../../objc-obj-c++-shared/Protocol1.h"
#include <objc/objc.h>
@protocol MyProtocol
@@ -25,7 +24,7 @@ int main (void)
[object methodA];
- exit (0);
+ return 0;
}
diff --git a/gcc/testsuite/objc/execute/np-2.m b/gcc/testsuite/objc/execute/np-2.m
index da276be982b..af973cf9d94 100644
--- a/gcc/testsuite/objc/execute/np-2.m
+++ b/gcc/testsuite/objc/execute/np-2.m
@@ -2,7 +2,7 @@
* Contributed by Nicola Pero <n.pero@mi.flashnet.it>
* Tue Sep 19 4:34AM
*/
-#include "../../objc-obj-c++-shared/Protocol1.h"
+
#include <objc/objc.h>
@protocol MyProtocol
@@ -17,16 +17,14 @@
{
printf ("methodA\n");
}
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
int main (void)
{
[MyObject methodA];
- exit (0);
+ return 0;
}
diff --git a/gcc/testsuite/objc/execute/object_is_class.m b/gcc/testsuite/objc/execute/object_is_class.m
index 14a7f5232e7..483c38712d6 100644
--- a/gcc/testsuite/objc/execute/object_is_class.m
+++ b/gcc/testsuite/objc/execute/object_is_class.m
@@ -1,16 +1,13 @@
/* Contributed by Nicola Pero - Tue Jul 3 10:55:21 BST 2001 */
-#ifdef __NEXT_RUNTIME__
-# include "../../objc-obj-c++-shared/next-mapping.h"
-#else
-# include <objc/objc-api.h>
-#endif
-#include "../../objc-obj-c++-shared/Object1.h"
+
+#include "../../objc-obj-c++-shared/runtime.h"
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
/* This test demonstrate a failure in object_is_class which was fixed */
/* Create a class whose instance variables mirror the struct used for
Class structures in the runtime ... yes we're feeling evil today */
-@interface EvilClass : Object
+@interface EvilClass : TestsuiteObject
{
Class super_class;
const char* name;
@@ -35,7 +32,7 @@ int main (void)
EvilClass *evilObject = [EvilClass new];
/* Now check that the object is not a class object */
- if (object_is_class (evilObject))
+ if (class_isMetaClass (object_getClass (evilObject)))
{
printf ("object_is_class failed\n");
abort ();
@@ -43,4 +40,3 @@ int main (void)
return 0;
}
-#include "../../objc-obj-c++-shared/Object1-implementation.h"
diff --git a/gcc/testsuite/objc/execute/object_is_meta_class.m b/gcc/testsuite/objc/execute/object_is_meta_class.m
index 91a628ebac1..217873f53ed 100644
--- a/gcc/testsuite/objc/execute/object_is_meta_class.m
+++ b/gcc/testsuite/objc/execute/object_is_meta_class.m
@@ -1,14 +1,11 @@
/* Contributed by Nicola Pero - Tue Jul 3 10:55:21 BST 2001 */
-#ifdef __NEXT_RUNTIME__
-# include "../../objc-obj-c++-shared/next-mapping.h"
-#else
-# include <objc/objc-api.h>
-#endif
-#include "../../objc-obj-c++-shared/Object1.h"
+
+#include "../../objc-obj-c++-shared/runtime.h"
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
/* This test demonstrate a failure in object_is_meta_class which was fixed */
-@interface EvilClass : Object
+@interface EvilClass : TestsuiteObject
{
Class super_class;
const char* name;
@@ -33,7 +30,8 @@ int main (void)
EvilClass *evilObject = [EvilClass new];
/* Now check that the object is not a meta class object */
- if (object_is_meta_class (evilObject))
+ if (class_isMetaClass (object_getClass (evilObject))
+ && class_isMetaClass (evilObject))
{
printf ("object_is_meta_class failed\n");
abort ();
@@ -41,4 +39,4 @@ int main (void)
return 0;
}
-#include "../../objc-obj-c++-shared/Object1-implementation.h"
+
diff --git a/gcc/testsuite/objc/execute/private.m b/gcc/testsuite/objc/execute/private.m
index 5040ccec4a2..c1959efe7a6 100644
--- a/gcc/testsuite/objc/execute/private.m
+++ b/gcc/testsuite/objc/execute/private.m
@@ -1,11 +1,11 @@
/* Contributed by Nicola Pero - Fri Mar 9 19:39:15 CET 2001 */
-#import "../../objc-obj-c++-shared/Object1.h"
+#import "../../objc-obj-c++-shared/TestsuiteObject.m"
#include <objc/objc.h>
/* Test the @private, @protected, @public keyworks for ivars. We only
check syntax. */
-@interface TestClass : Object
+@interface TestClass : TestsuiteObject
{
int a;
diff --git a/gcc/testsuite/objc/execute/protocol-isEqual-1.m b/gcc/testsuite/objc/execute/protocol-isEqual-1.m
index 29b5c3ded78..b928337aa10 100644
--- a/gcc/testsuite/objc/execute/protocol-isEqual-1.m
+++ b/gcc/testsuite/objc/execute/protocol-isEqual-1.m
@@ -1,6 +1,7 @@
/* Contributed by Nicola Pero - Fri Jun 4 03:16:17 BST 2004 */
/* Test that a protocol is equal to itself. */
-#include "../../objc-obj-c++-shared/Protocol1.h"
+#include <objc/Protocol.h>
+#include "../../objc-obj-c++-shared/runtime.h"
@protocol Foo
- (void)foo;
@@ -10,11 +11,7 @@ int main (void)
{
Protocol *protocol = @protocol(Foo);
-#ifdef NEXT_OBJC_USE_NEW_INTERFACE
- if ( !protocol_isEqual (protocol, protocol))
-#else
- if (! [protocol isEqual: protocol])
-#endif
+ if (!protocol_isEqual (protocol, protocol))
{
abort ();
}
diff --git a/gcc/testsuite/objc/execute/protocol-isEqual-2.m b/gcc/testsuite/objc/execute/protocol-isEqual-2.m
index 70ab8ccdd1e..cc135766367 100644
--- a/gcc/testsuite/objc/execute/protocol-isEqual-2.m
+++ b/gcc/testsuite/objc/execute/protocol-isEqual-2.m
@@ -1,7 +1,7 @@
/* Contributed by Nicola Pero - Fri Jun 4 03:16:17 BST 2004 */
/* Test that protocols with different names are different. */
-
-#include "../../objc-obj-c++-shared/Protocol1.h"
+#include "../../objc-obj-c++-shared/runtime.h"
+#include <objc/Protocol.h>
@protocol Foo1
- (void)foo1;
@@ -13,11 +13,7 @@
int main (void)
{
-#ifdef NEXT_OBJC_USE_NEW_INTERFACE
if (protocol_isEqual (@protocol(Foo1), @protocol(Foo2)))
-#else
- if ([@protocol(Foo1) isEqual: @protocol(Foo2)])
-#endif
{
abort ();
}
diff --git a/gcc/testsuite/objc/execute/protocol-isEqual-3.m b/gcc/testsuite/objc/execute/protocol-isEqual-3.m
index 23863829440..70d450fd847 100644
--- a/gcc/testsuite/objc/execute/protocol-isEqual-3.m
+++ b/gcc/testsuite/objc/execute/protocol-isEqual-3.m
@@ -1,7 +1,7 @@
/* Contributed by Nicola Pero - Fri Jun 4 03:16:17 BST 2004 */
/* Test that a protocol is not equal to nil. */
-
-#include "../../objc-obj-c++-shared/Protocol1.h"
+#include "../../objc-obj-c++-shared/runtime.h"
+#include <objc/Protocol.h>
@protocol Foo
- (void)foo;
@@ -9,11 +9,7 @@
int main (void)
{
-#ifdef NEXT_OBJC_USE_NEW_INTERFACE
if (protocol_isEqual (@protocol(Foo), nil))
-#else
- if ([@protocol(Foo) isEqual: nil])
-#endif
{
abort ();
}
diff --git a/gcc/testsuite/objc/execute/protocol-isEqual-4.m b/gcc/testsuite/objc/execute/protocol-isEqual-4.m
index 4d5af640e46..3d14fb263b7 100644
--- a/gcc/testsuite/objc/execute/protocol-isEqual-4.m
+++ b/gcc/testsuite/objc/execute/protocol-isEqual-4.m
@@ -1,7 +1,7 @@
/* Contributed by David Ayers - Fri Jun 4 03:16:17 BST 2004 */
/* Test that a protocol is not equal to something which is not a protocol. */
-
-#include "../../objc-obj-c++-shared/Protocol1.h"
+#include "../../objc-obj-c++-shared/runtime.h"
+#include <objc/Protocol.h>
@protocol Foo
- (void)foo;
@@ -10,11 +10,7 @@
int main (void)
{
/* A Protocol object should not be equal to a Class object. */
-#ifdef NEXT_OBJC_USE_NEW_INTERFACE
- if (protocol_isEqual (@protocol(Foo), objc_getClass("Protocol")))
-#else
- if ([@protocol(Foo) isEqual: [Protocol class]])
-#endif
+ if (protocol_isEqual (@protocol(Foo), (id)objc_getClass("Protocol")))
{
abort ();
}
diff --git a/gcc/testsuite/objc/execute/redefining_self.m b/gcc/testsuite/objc/execute/redefining_self.m
index ddb2eb2e3d0..f22ca927fe8 100644
--- a/gcc/testsuite/objc/execute/redefining_self.m
+++ b/gcc/testsuite/objc/execute/redefining_self.m
@@ -17,9 +17,7 @@
return self;
}
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
diff --git a/gcc/testsuite/objc/execute/root_methods.m b/gcc/testsuite/objc/execute/root_methods.m
index d9085ae7b04..e75640ce7c5 100644
--- a/gcc/testsuite/objc/execute/root_methods.m
+++ b/gcc/testsuite/objc/execute/root_methods.m
@@ -1,6 +1,6 @@
/* Contributed by Nicola Pero - Thu Mar 8 16:27:46 CET 2001 */
-#import "../../objc-obj-c++-shared/next-mapping.h"
+#import "../../objc-obj-c++-shared/runtime.h"
#import <objc/objc.h>
/* Test that instance methods of root classes are available as class
@@ -18,9 +18,7 @@
{
return self;
}
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
@interface NormalClass : RootClass
@@ -31,7 +29,7 @@
int main (void)
{
- Class normal = objc_get_class ("NormalClass");
+ Class normal = objc_getClass ("NormalClass");
if (normal == Nil)
{
diff --git a/gcc/testsuite/objc/execute/selector-1.m b/gcc/testsuite/objc/execute/selector-1.m
index 531e02babcf..66eee67c024 100644
--- a/gcc/testsuite/objc/execute/selector-1.m
+++ b/gcc/testsuite/objc/execute/selector-1.m
@@ -1,7 +1,7 @@
/* Contributed by Nicola Pero - Thu Mar 8 16:27:46 CET 2001 */
#include <objc/objc.h>
-#include <objc/objc-api.h>
-#include <objc/Object.h>
+#include "../../objc-obj-c++-shared/runtime.h"
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
int main (void)
{
@@ -9,11 +9,7 @@ int main (void)
char *selname;
selector = @selector (alloc);
-#ifdef __NEXT_RUNTIME__
selname = sel_getName (selector);
-#else
- selname = sel_get_name (selector);
-#endif
if (strcmp (selname, "alloc"))
abort ();
diff --git a/gcc/testsuite/objc/execute/static-1.m b/gcc/testsuite/objc/execute/static-1.m
index a778b722c15..460f64cc186 100644
--- a/gcc/testsuite/objc/execute/static-1.m
+++ b/gcc/testsuite/objc/execute/static-1.m
@@ -19,9 +19,7 @@ static int test = 1;
return test;
}
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
int main (void)
diff --git a/gcc/testsuite/objc/execute/static-2.m b/gcc/testsuite/objc/execute/static-2.m
index 4d7e7449bff..6cdbf5b775b 100644
--- a/gcc/testsuite/objc/execute/static-2.m
+++ b/gcc/testsuite/objc/execute/static-2.m
@@ -22,9 +22,7 @@ static int test (void)
return test ();
}
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
int main (void)
diff --git a/gcc/testsuite/objc/execute/trivial.m b/gcc/testsuite/objc/execute/trivial.m
index 0fc61dbe564..b660a8ffb67 100644
--- a/gcc/testsuite/objc/execute/trivial.m
+++ b/gcc/testsuite/objc/execute/trivial.m
@@ -1,9 +1,8 @@
-#import "../../objc-obj-c++-shared/Object1.h"
+#import "../../objc-obj-c++-shared/TestsuiteObject.m"
int main(void)
{
- [Object class];
+ [TestsuiteObject class];
return 0;
}
-#import "../../objc-obj-c++-shared/Object1-implementation.h"
diff --git a/gcc/testsuite/objc/execute/va_method.m b/gcc/testsuite/objc/execute/va_method.m
index 51619b8d313..190548bac44 100644
--- a/gcc/testsuite/objc/execute/va_method.m
+++ b/gcc/testsuite/objc/execute/va_method.m
@@ -1,6 +1,5 @@
/* Contributed by Nicola Pero - Thu Mar 8 16:27:46 CET 2001 */
#include <objc/objc.h>
-#include <objc/objc-api.h>
#include <stdarg.h>
/* Test method with variable number of arguments */
@@ -32,9 +31,7 @@
return sum;
}
-#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
-#endif
@end
int main (void)