diff options
Diffstat (limited to 'gcc/testsuite/objc.dg')
92 files changed, 362 insertions, 222 deletions
diff --git a/gcc/testsuite/objc.dg/bitfield-1.m b/gcc/testsuite/objc.dg/bitfield-1.m index 8791eb33e14..664a0e8d48f 100644 --- a/gcc/testsuite/objc.dg/bitfield-1.m +++ b/gcc/testsuite/objc.dg/bitfield-1.m @@ -2,9 +2,10 @@ being "promoted" to ints). */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ +#include "../objc-obj-c++-shared/Object1.h" #include <objc/objc.h> -#include <objc/Object.h> extern void abort(void); @@ -78,3 +79,5 @@ int main(void) { return 0; } + +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/bitfield-2.m b/gcc/testsuite/objc.dg/bitfield-2.m index 6875c6c4d87..7e8147a7008 100644 --- a/gcc/testsuite/objc.dg/bitfield-2.m +++ b/gcc/testsuite/objc.dg/bitfield-2.m @@ -1,8 +1,9 @@ /* Check if bitfield ivars are correctly @encode'd when the NeXT runtime is used. */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ -/* { dg-options "-fnext-runtime -fsigned-char" } */ +/* { dg-options "-fsigned-char" } */ /* { dg-do run { target *-*-darwin* } } */ +/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ typedef struct objc_object { struct objc_class *class_pointer; } *id; diff --git a/gcc/testsuite/objc.dg/bitfield-3.m b/gcc/testsuite/objc.dg/bitfield-3.m index f427a3018ad..5bea0fca96f 100644 --- a/gcc/testsuite/objc.dg/bitfield-3.m +++ b/gcc/testsuite/objc.dg/bitfield-3.m @@ -1,11 +1,10 @@ /* Check if the @defs() construct preserves the correct layout of bitfields. */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ -/* { dg-options "-lobjc -Wpadded" } */ +/* { dg-options "-Wpadded" } */ /* { dg-do run } */ -#include <objc/objc.h> -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" extern void abort(void); extern int strcmp(const char *str1, const char *str2); diff --git a/gcc/testsuite/objc.dg/bitfield-5.m b/gcc/testsuite/objc.dg/bitfield-5.m index ddd3b03a309..1cc1cad9bf1 100644 --- a/gcc/testsuite/objc.dg/bitfield-5.m +++ b/gcc/testsuite/objc.dg/bitfield-5.m @@ -7,8 +7,8 @@ /* { dg-options "-Wpadded" } */ /* { dg-do run } */ +#include "../objc-obj-c++-shared/Object1.h" #include <objc/objc.h> -#include <objc/Object.h> #include <stdlib.h> #define CHECK_IF(expr) if(!(expr)) abort() diff --git a/gcc/testsuite/objc.dg/call-super-1.m b/gcc/testsuite/objc.dg/call-super-1.m index 19e0d4900dd..37b705ea193 100644 --- a/gcc/testsuite/objc.dg/call-super-1.m +++ b/gcc/testsuite/objc.dg/call-super-1.m @@ -1,11 +1,11 @@ /* Check if objc_super stack variables are created correctly (and not clobbered by other values). */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ -/* { dg-options "-std=c99 -lobjc" } */ +/* { dg-options "-std=c99" } */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -#include <objc/objc.h> -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" extern void abort(void); @@ -74,3 +74,5 @@ int main(void) { [v free]; return 0; } + +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/call-super-2.m b/gcc/testsuite/objc.dg/call-super-2.m index be8a89fdc7b..190c407f796 100644 --- a/gcc/testsuite/objc.dg/call-super-2.m +++ b/gcc/testsuite/objc.dg/call-super-2.m @@ -1,17 +1,10 @@ -/* Check if casting 'self' or 'super' affects message lookup in the - correct way. */ +/* Check if casting 'self' or 'super' affects message lookup in the correct way. */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ /* { dg-do compile } */ +#include "../objc-obj-c++-shared/Object1.h" +#include "../objc-obj-c++-shared/next-mapping.h" #include <stddef.h> -#include <objc/objc.h> -#include <objc/Object.h> - -#ifdef __NEXT_RUNTIME__ -#define OBJC_GETCLASS objc_getClass -#else -#define OBJC_GETCLASS objc_get_class -#endif @protocol Func + (int) class_func0; @@ -70,11 +63,11 @@ } + (int) class_func6 { - return (size_t)[OBJC_GETCLASS("Object") class_func1]; /* { dg-warning ".Object. may not respond to .\\+class_func1." } */ + return (size_t)[objc_get_class("Object") class_func1]; /* { dg-warning ".Object. may not respond to .\\+class_func1." } */ } + (int) class_func7 { - return [OBJC_GETCLASS("Derived") class_func1]; + return [objc_get_class("Derived") class_func1]; } - (int) instance_func1 { @@ -100,11 +93,11 @@ } - (int) instance_func6 { - return (size_t)[OBJC_GETCLASS("Object") class_func1]; /* { dg-warning ".Object. may not respond to .\\+class_func1." } */ + return (size_t)[objc_get_class("Object") class_func1]; /* { dg-warning ".Object. may not respond to .\\+class_func1." } */ } - (int) instance_func7 { - return [OBJC_GETCLASS("Derived") class_func1]; + return [objc_get_class("Derived") class_func1]; } @end @@ -129,7 +122,7 @@ int i = (size_t)[self instance_func0]; /* { dg-warning ".Derived. may not respond to .\\-instance_func0." } */ i += [(Derived <Func> *)self categ_instance_func2]; i += (size_t)[(Object <Func> *)self categ_instance_func2]; /* { dg-warning ".Object. may not respond to .\\-categ_instance_func2." } */ - /* { dg-warning ".\\-categ_instance_func2. not found in protocol" "" { target *-*-* } 131 } */ + /* { dg-warning ".\\-categ_instance_func2. not found in protocol" "" { target *-*-* } 124 } */ i += (size_t)[(id <Func>)self categ_instance_func2]; /* { dg-warning ".\\-categ_instance_func2. not found in protocol" } */ i += [(id)self categ_instance_func2]; return i + (size_t)[super instance_func0]; /* { dg-warning ".Object. may not respond to .\\-instance_func0." } */ diff --git a/gcc/testsuite/objc.dg/call-super-3.m b/gcc/testsuite/objc.dg/call-super-3.m index 05b6233ff5f..0b950294b8f 100644 --- a/gcc/testsuite/objc.dg/call-super-3.m +++ b/gcc/testsuite/objc.dg/call-super-3.m @@ -1,10 +1,11 @@ /* Check if sending messages to super does not interfere with sending messages to classes. */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-options "" } */ /* { dg-do run } */ -/* { dg-options "-lobjc" } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort() @@ -52,3 +53,5 @@ int main(void) { CHECK_IF([derived instance_func1] == 234 + 345); return 0; } + +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/category-1.m b/gcc/testsuite/objc.dg/category-1.m index 1d29e374aea..e195a46bf08 100644 --- a/gcc/testsuite/objc.dg/category-1.m +++ b/gcc/testsuite/objc.dg/category-1.m @@ -1,9 +1,12 @@ /* Test class methods inside categories. */ /* Author: Ziemowit Laski <zlaski@apple.com>. */ -/* { dg-options "-lobjc" } */ + /* { dg-do run } */ +/* { dg-xfail-run-if "need OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" +extern int strcmp(const char *s1, const char *s2); +extern void abort(void); #ifdef __NEXT_RUNTIME__ #define SUPERCLASS superclass @@ -11,8 +14,6 @@ #define SUPERCLASS superClass #endif -extern int strcmp(const char *s1, const char *s2); -extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort() @interface MyObject: Object @@ -36,8 +37,15 @@ int main (int argc, const char * argv[]) Class w1 = [MyObject whatever1]; Class w2 = [MyObject whatever2]; +#ifdef NEXT_OBJC_USE_NEW_INTERFACE + CHECK_IF(!strcmp( object_getClassName( w1 ), "Object")); + CHECK_IF(!strcmp( object_getClassName( w2 ), "Object")); +#else CHECK_IF(!strcmp(w1->name, "Object")); CHECK_IF(!strcmp(w2->name, "Object")); +#endif + return 0; } +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/comp-types-10.m b/gcc/testsuite/objc.dg/comp-types-10.m index c28a2a55a9e..3d85983991e 100644 --- a/gcc/testsuite/objc.dg/comp-types-10.m +++ b/gcc/testsuite/objc.dg/comp-types-10.m @@ -1,6 +1,6 @@ /* { dg-do compile } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @protocol Foo - (id)meth1; diff --git a/gcc/testsuite/objc.dg/comp-types-11.m b/gcc/testsuite/objc.dg/comp-types-11.m index b041759ca65..959cc049a32 100644 --- a/gcc/testsuite/objc.dg/comp-types-11.m +++ b/gcc/testsuite/objc.dg/comp-types-11.m @@ -1,5 +1,5 @@ /* { dg-do compile } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @interface Derived: Object @end diff --git a/gcc/testsuite/objc.dg/comp-types-8.m b/gcc/testsuite/objc.dg/comp-types-8.m index 7f9c64a6f2e..bb7b136fb69 100644 --- a/gcc/testsuite/objc.dg/comp-types-8.m +++ b/gcc/testsuite/objc.dg/comp-types-8.m @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* Another gimplifier ICE... */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @interface MyView: Object { int _frame; diff --git a/gcc/testsuite/objc.dg/const-str-1.m b/gcc/testsuite/objc.dg/const-str-1.m index e4cac2e57ec..156a92e1194 100644 --- a/gcc/testsuite/objc.dg/const-str-1.m +++ b/gcc/testsuite/objc.dg/const-str-1.m @@ -1,6 +1,5 @@ /* Test errors for constant strings. */ /* { dg-do compile } */ -/* { dg-options "-fgnu-runtime" } */ #ifdef __cplusplus extern void baz(...); diff --git a/gcc/testsuite/objc.dg/const-str-10.m b/gcc/testsuite/objc.dg/const-str-10.m index 4efe044c13e..7f59a63f93b 100644 --- a/gcc/testsuite/objc.dg/const-str-10.m +++ b/gcc/testsuite/objc.dg/const-str-10.m @@ -2,10 +2,10 @@ constant string classes get derived. */ /* Contributed by Ziemowit Laski <zlaski@apple.com> */ -/* { dg-options "-fnext-runtime" } */ -/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-do compile { target { *-*-darwin* } } } */ +/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @interface NSString: Object @end @@ -20,9 +20,14 @@ @interface NSConstantString : NSSimpleCString @end +#ifndef NEXT_OBJC_USE_NEW_INTERFACE extern struct objc_class _NSConstantStringClassReference; +#else +extern Class _NSConstantStringClassReference; +#endif const NSConstantString *appKey = @"MyApp"; /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ -/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" } } */ +/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" { target { *-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler ".quad\t__NSConstantStringClassReference\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ diff --git a/gcc/testsuite/objc.dg/const-str-11.m b/gcc/testsuite/objc.dg/const-str-11.m index 3b7ec7ad51f..ae3c3303f6f 100644 --- a/gcc/testsuite/objc.dg/const-str-11.m +++ b/gcc/testsuite/objc.dg/const-str-11.m @@ -2,10 +2,11 @@ constant string classes get derived. */ /* Contributed by Ziemowit Laski <zlaski@apple.com> */ -/* { dg-options "-fnext-runtime -fconstant-string-class=XStr" } */ /* { dg-do compile { target *-*-darwin* } } */ +/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ +/* { dg-options "-fconstant-string-class=XStr" } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @interface XString: Object { @protected @@ -19,9 +20,14 @@ } @end +#ifndef NEXT_OBJC_USE_NEW_INTERFACE extern struct objc_class _XStrClassReference; +#else +extern Class _XStrClassReference; +#endif const XStr *appKey = @"MyApp"; /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ -/* { dg-final { scan-assembler ".long\t__XStrClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" } } */ +/* { dg-final { scan-assembler ".long\t__XStrClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" { target { *-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler ".quad\t__XStrClassReference\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ diff --git a/gcc/testsuite/objc.dg/const-str-12.m b/gcc/testsuite/objc.dg/const-str-12.m index 95a6bef3241..93059018647 100644 --- a/gcc/testsuite/objc.dg/const-str-12.m +++ b/gcc/testsuite/objc.dg/const-str-12.m @@ -1,7 +1,8 @@ -/* { dg-options "-Wall -funit-at-a-time -fgnu-runtime" } */ +/* { dg-options "-Wall -funit-at-a-time" } */ /* { dg-do compile } */ /* PR objc/27438, make sure that the decl produced by the front-end does not cause a warning to be produced. */ +/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ @interface NXConstantString { diff --git a/gcc/testsuite/objc.dg/const-str-3.m b/gcc/testsuite/objc.dg/const-str-3.m index 7d4f80863d2..0d719e84407 100644 --- a/gcc/testsuite/objc.dg/const-str-3.m +++ b/gcc/testsuite/objc.dg/const-str-3.m @@ -1,15 +1,14 @@ -/* Test the -fconstant-string-class=Foo option under the NeXT - runtime. */ +/* Test the -fconstant-string-class=Foo option under the NeXT runtime. */ /* Developed by Markus Hitter <mah@jump-ing.de>. */ +/* { dg-do run } */ +/* { dg-options "-fconstant-string-class=Foo" } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -/* { dg-options "-fnext-runtime -fconstant-string-class=Foo -lobjc" } */ -/* { dg-do run { target *-*-darwin* } } */ - +#import "../objc-obj-c++-shared/Object1.h" +#import "../objc-obj-c++-shared/next-mapping.h" #include <stdio.h> #include <stdlib.h> #include <memory.h> -#include <objc/objc.h> -#include <objc/Object.h> @interface Foo: Object { char *cString; @@ -18,7 +17,11 @@ - (char *)customString; @end +#ifdef NEXT_OBJC_USE_NEW_INTERFACE +struct fudge_objc_class _FooClassReference; +#else struct objc_class _FooClassReference; +#endif @implementation Foo : Object - (char *)customString { @@ -38,7 +41,7 @@ int main () { constant string object. Can't be moved to +initialize since _that_ is already a message. */ - memcpy(&_FooClassReference, objc_getClass("Foo"), sizeof(_FooClassReference)); + memcpy(&_FooClassReference, objc_get_class("Foo"), sizeof(_FooClassReference)); if (strcmp ([string customString], "bla")) { abort (); } @@ -46,3 +49,5 @@ int main () { printf([@"This is a working constant string object\n" customString]); return 0; } + +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/const-str-4.m b/gcc/testsuite/objc.dg/const-str-4.m index c178bfc4a0c..9582a32554f 100644 --- a/gcc/testsuite/objc.dg/const-str-4.m +++ b/gcc/testsuite/objc.dg/const-str-4.m @@ -1,7 +1,7 @@ /* Ensure that the preprocessor handles ObjC string constants gracefully. */ /* Author: Ziemowit Laski <zlaski@apple.com> */ -/* { dg-options "-fnext-runtime -fconstant-string-class=MyString -lobjc" } */ -/* { dg-do run { target *-*-darwin* } } */ +/* { dg-options "-fconstant-string-class=MyString " } */ +/* { dg-do run } */ extern void abort(void); diff --git a/gcc/testsuite/objc.dg/const-str-7.m b/gcc/testsuite/objc.dg/const-str-7.m index 3691579381d..223789aed7d 100644 --- a/gcc/testsuite/objc.dg/const-str-7.m +++ b/gcc/testsuite/objc.dg/const-str-7.m @@ -1,18 +1,12 @@ -/* Test to make sure that the const objc strings are the same across - scopes. */ +/* Test to make sure that the const objc strings are the same across scopes. */ /* Developed by Andrew Pinski <pinskia@physics.uc.edu> */ +/* { dg-options "-fconstant-string-class=Foo " } */ +/* { dg-do run } */ - -/* { dg-options "-fnext-runtime -fconstant-string-class=Foo -lobjc" } */ -/* { dg-do run { target *-*-darwin* } } */ - - +#include "../objc-obj-c++-shared/Object1.h" #include <stdio.h> #include <stdlib.h> #include <memory.h> -#include <objc/objc.h> -#include <objc/Object.h> - @interface Foo: Object { char *cString; @@ -21,8 +15,11 @@ - (char *)customString; @end +#ifndef NEXT_OBJC_USE_NEW_INTERFACE struct objc_class _FooClassReference; - +#else +Class _FooClassReference; +#endif @implementation Foo : Object - (char *)customString { @@ -30,13 +27,11 @@ struct objc_class _FooClassReference; } @end - int main () { Foo *string = @"bla"; { Foo *string2 = @"bla"; - if(string != string2) abort(); printf("Strings are being uniqued properly\n"); @@ -44,3 +39,4 @@ int main () { return 0; } +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/const-str-8.m b/gcc/testsuite/objc.dg/const-str-8.m index 60abcbd52b1..a7da0e10276 100644 --- a/gcc/testsuite/objc.dg/const-str-8.m +++ b/gcc/testsuite/objc.dg/const-str-8.m @@ -1,12 +1,10 @@ /* Test for assigning compile-time constant-string objects to static variables. */ /* Contributed by Ziemowit Laski <zlaski@apple.com> */ +/* { dg-options "-fconstant-string-class=Foo" } */ +/* { dg-do run } */ -/* { dg-options "-fnext-runtime -fconstant-string-class=Foo -lobjc" } */ -/* { dg-do run { target *-*-darwin* } } */ - - +#include "../objc-obj-c++-shared/Object1.h" #include <stdlib.h> -#include <objc/Object.h> @interface Foo: Object { char *cString; @@ -14,7 +12,11 @@ } @end +#ifndef NEXT_OBJC_USE_NEW_INTERFACE struct objc_class _FooClassReference; +#else +Class _FooClassReference; +#endif @implementation Foo : Object - (char *)customString { @@ -37,3 +39,5 @@ int main () { PrefsSynchronize(); return 0; } + +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/const-str-9.m b/gcc/testsuite/objc.dg/const-str-9.m index 033337452d4..ddf3b02f03c 100644 --- a/gcc/testsuite/objc.dg/const-str-9.m +++ b/gcc/testsuite/objc.dg/const-str-9.m @@ -1,10 +1,10 @@ /* Test if ObjC constant strings get placed in the correct section. */ /* Contributed by Ziemowit Laski <zlaski@apple.com> */ -/* { dg-options "-fnext-runtime" } */ -/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @interface NSConstantString: Object { char *cString; @@ -12,9 +12,14 @@ } @end +#ifndef NEXT_OBJC_USE_NEW_INTERFACE extern struct objc_class _NSConstantStringClassReference; +#else +Class _NSConstantStringClassReference; +#endif static const NSConstantString *appKey = @"MyApp"; /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ -/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" } } */ +/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" { target { *-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler ".quad\t__NSConstantStringClassReference\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ diff --git a/gcc/testsuite/objc.dg/defs.m b/gcc/testsuite/objc.dg/defs.m index e8d8c2c4527..2ffde0035db 100644 --- a/gcc/testsuite/objc.dg/defs.m +++ b/gcc/testsuite/objc.dg/defs.m @@ -1,11 +1,12 @@ /* Check if the @defs() construct preserves the correct offsets of ivars. */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ -/* { dg-options "-lobjc" } */ +/* { dg-options "" } */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -#include <objc/objc.h> -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" +//#include <objc/objc.h> extern void abort(void); @@ -65,3 +66,5 @@ int main(void) { return 0; } + +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/desig-init-1.m b/gcc/testsuite/objc.dg/desig-init-1.m index 6ef710b51ff..a07e72be14a 100644 --- a/gcc/testsuite/objc.dg/desig-init-1.m +++ b/gcc/testsuite/objc.dg/desig-init-1.m @@ -1,13 +1,13 @@ -/* Test Objective-C capability for handling GNU/C99 designated - initializers, and distinguishing them from message sends. */ -/* Contributed by Ziemowit Laski <zlaski@apple.com>. */ +/* Test Objective-C capability for handling GNU/C99 designated initializers, and distinguishing them + from message sends. Contributed by Ziemowit Laski <zlaski@apple.com>. */ /* { dg-options "-std=gnu99" } */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +#include "../objc-obj-c++-shared/Object1.h" #include <stdio.h> #include <stdlib.h> -#include <objc/objc.h> -#include <objc/Object.h> @interface Cls : Object + (int) meth1; @@ -47,3 +47,5 @@ int main(void) { /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ + +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/dg.exp b/gcc/testsuite/objc.dg/dg.exp index b17b68b6a51..4c5730e66c0 100644 --- a/gcc/testsuite/objc.dg/dg.exp +++ b/gcc/testsuite/objc.dg/dg.exp @@ -29,7 +29,13 @@ dg-init # Main loop. dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[m\]]] \ - "" $DEFAULT_CFLAGS + "-fgnu-runtime" $DEFAULT_CFLAGS + +# darwin targets can also run code with the NeXT runtime. +if [istarget "*-*-darwin*" ] { +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[m\]]] \ + "-fnext-runtime" $DEFAULT_CFLAGS +} # All done. dg-finish diff --git a/gcc/testsuite/objc.dg/encode-1.m b/gcc/testsuite/objc.dg/encode-1.m index 868c3254753..50e9919f941 100644 --- a/gcc/testsuite/objc.dg/encode-1.m +++ b/gcc/testsuite/objc.dg/encode-1.m @@ -3,9 +3,8 @@ should be encoded as '*'). This is somewhat tricky wrt the NeXT runtime, where we have 'typedef char BOOL'. */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ -/* { dg-options "-fnext-runtime -lobjc" } */ /* { dg-do run } */ - +/* { dg-options "-fnext-runtime" } */ #include <string.h> #include <stdlib.h> #include <objc/objc.h> diff --git a/gcc/testsuite/objc.dg/encode-2.m b/gcc/testsuite/objc.dg/encode-2.m index b9003696c02..ea0ff6a7dae 100644 --- a/gcc/testsuite/objc.dg/encode-2.m +++ b/gcc/testsuite/objc.dg/encode-2.m @@ -15,19 +15,17 @@ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -#include <objc/objc.h> -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" +#include "../objc-obj-c++-shared/next-mapping.h" #ifdef __NEXT_RUNTIME__ #define METHOD Method -#define OBJC_GETCLASS objc_getClass -#define CLASS_GETINSTANCEMETHOD class_getInstanceMethod #else #include <objc/objc-api.h> #define METHOD Method_t -#define OBJC_GETCLASS objc_get_class -#define CLASS_GETINSTANCEMETHOD class_get_instance_method +#define method_get_types(M) (M)->method_types #endif extern int sscanf(const char *str, const char *format, ...); @@ -76,27 +74,31 @@ unsigned offs1, offs2, offs3, offs4, offs5, offs6, offs7; int main(void) { Foo *foo = [[Foo alloc] init]; - Class fooClass = OBJC_GETCLASS("Foo"); + Class fooClass = objc_get_class("Foo"); METHOD meth; const char *string; - meth = CLASS_GETINSTANCEMETHOD(fooClass, @selector(setRect:withInt:)); + meth = class_get_instance_method(fooClass, @selector(setRect:withInt:)); offs2 = 9999; - sscanf(meth->method_types, "@%u@%u:%u{_XXRect={?=ff}{?=ff}}%ui%u", &offs1, &offs2, &offs3, + + sscanf(method_get_types(meth), "@%u@%u:%u{_XXRect={?=ff}{?=ff}}%ui%u", &offs1, &offs2, &offs3, &offs4, &offs5); + CHECK_IF(!offs2); [foo setRect:my_rect withInt:123]; - meth = CLASS_GETINSTANCEMETHOD(fooClass, @selector(char:float:double:long:)); + meth = class_get_instance_method(fooClass, @selector(char:float:double:long:)); offs2 = 9999; if (sizeof (long) == 8) string = "v%u@%u:%uc%uf%ud%uq%u"; else string = "v%u@%u:%uc%uf%ud%ul%u"; - sscanf(meth->method_types, string, &offs1, &offs2, &offs3, + sscanf(method_get_types(meth), string, &offs1, &offs2, &offs3, &offs4, &offs5, &offs6, &offs7); CHECK_IF(!offs2); [foo char:'c' float:2.3 double:3.5 long:2345L]; return 0; } + +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/encode-3.m b/gcc/testsuite/objc.dg/encode-3.m index 20a85b43bdf..63a92e19cd0 100644 --- a/gcc/testsuite/objc.dg/encode-3.m +++ b/gcc/testsuite/objc.dg/encode-3.m @@ -2,7 +2,10 @@ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ /* { dg-do run } */ -#include <objc/Protocol.h> +#include <stdlib.h> +#include "../objc-obj-c++-shared/Protocol1.h" +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + #ifdef __cplusplus #define ProtoBool bool #else diff --git a/gcc/testsuite/objc.dg/encode-4.m b/gcc/testsuite/objc.dg/encode-4.m index a754c6955cb..d74c0ba1c7f 100644 --- a/gcc/testsuite/objc.dg/encode-4.m +++ b/gcc/testsuite/objc.dg/encode-4.m @@ -1,19 +1,20 @@ /* Encoding tests for ObjC class layouts. */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ -/* { dg-options "-lobjc" } */ +/* { dg-options "" } */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" +#include "../objc-obj-c++-shared/next-mapping.h" #ifdef __NEXT_RUNTIME__ #include <objc/objc-class.h> -#define OBJC_GETCLASS objc_getClass #else #include <objc/objc-api.h> -#define OBJC_GETCLASS objc_get_class #endif extern void abort(void); extern int strcmp(const char *s1, const char *s2); + #define CHECK_IF(expr) if(!(expr)) abort() @class Int1, Int2; @@ -49,25 +50,44 @@ struct Nested { @implementation Int2 @end +#ifdef NEXT_OBJC_USE_NEW_INTERFACE +Ivar *ivar; +#else struct objc_ivar *ivar; +#endif static void check_ivar(const char *name, const char *type) { +#ifdef NEXT_OBJC_USE_NEW_INTERFACE + CHECK_IF(!strcmp(ivar_getName(*ivar), name)); + CHECK_IF(!strcmp(ivar_getTypeEncoding(*ivar), type)); +#else CHECK_IF(!strcmp(ivar->ivar_name, name)); CHECK_IF(!strcmp(ivar->ivar_type, type)); +#endif ivar++; } int main(void) { - ivar = ((Class)OBJC_GETCLASS("Int1"))->ivars->ivar_list; +#ifdef NEXT_OBJC_USE_NEW_INTERFACE + ivar = class_copyIvarList ((Class)objc_get_class("Int1"), NULL); +#else + ivar = ((Class)objc_get_class("Int1"))->ivars->ivar_list; +#endif check_ivar("a", "c"); check_ivar("b", "c"); check_ivar("int2", "@\"Int2\""); check_ivar("nested", "{Nested=\"a\"f\"b\"f\"next\"@\"Int1\"\"innermost\"{Innermost=\"a\"C\"b\"C\"encl\"^{Nested}}}"); - ivar = ((Class)OBJC_GETCLASS("Int2"))->ivars->ivar_list; +#ifdef NEXT_OBJC_USE_NEW_INTERFACE + ivar = class_copyIvarList ((Class)objc_get_class("Int2"), NULL); +#else + ivar = ((Class)objc_get_class("Int2"))->ivars->ivar_list; +#endif check_ivar("innermost", "^{Innermost=CC^{Nested}}"); check_ivar("base", "@\"Int1\""); return 0; } + +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/encode-5.m b/gcc/testsuite/objc.dg/encode-5.m index 35b6148872e..523c7ce02e8 100644 --- a/gcc/testsuite/objc.dg/encode-5.m +++ b/gcc/testsuite/objc.dg/encode-5.m @@ -9,20 +9,18 @@ /* Contributed by Alexander Malmberg <alexander@malmberg.org> */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" +#include "../objc-obj-c++-shared/next-mapping.h" #include <stdlib.h> #include <stdio.h> #define CHECK_IF(expr) if(!(expr)) abort() #ifdef __NEXT_RUNTIME__ #define METHOD Method -#define OBJC_GETCLASS objc_getClass -#define CLASS_GETINSTANCEMETHOD class_getInstanceMethod #else #include <objc/objc-api.h> #define METHOD Method_t -#define OBJC_GETCLASS objc_get_class -#define CLASS_GETINSTANCEMETHOD class_get_instance_method +#define method_get_types(M) (M)->method_types #endif @interface Test : Object @@ -49,7 +47,7 @@ int offs1, offs2, offs3, offs4, offs5, offs6; int main(int argc, char **argv) { - Class testClass = OBJC_GETCLASS("Test"); + Class testClass = objc_get_class("Test"); METHOD meth; cc[0] = [Test new]; @@ -60,16 +58,16 @@ int main(int argc, char **argv) [*c test2: bb with: bb + 5]; CHECK_IF (bb[3] == 5); - meth = CLASS_GETINSTANCEMETHOD(testClass, @selector(test2:with:)); + meth = class_get_instance_method(testClass, @selector(test2:with:)); offs1 = offs2 = offs3 = offs4 = offs5 = offs6 = -1; - sscanf(meth->method_types, "v%d@%d:%d[%di]%d^i%d", &offs1, &offs2, &offs3, + sscanf(method_get_types(meth), "v%d@%d:%d[%di]%d^i%d", &offs1, &offs2, &offs3, &offs4, &offs5, &offs6); CHECK_IF (!offs2 && offs4 == 5 && offs3 > 0); CHECK_IF (offs5 == 2 * offs3 && offs6 == 3 * offs3 && offs1 == 4 * offs3); - meth = CLASS_GETINSTANCEMETHOD(testClass, @selector(test3:)); + meth = class_get_instance_method(testClass, @selector(test3:)); offs1 = offs2 = offs3 = offs4 = offs5 = offs6 = -1; - sscanf(meth->method_types, "v%d@%d:%d[%d[%d{Test=#f}]]%d", &offs1, &offs2, &offs3, + sscanf(method_get_types(meth), "v%d@%d:%d[%d[%d{Test=#f}]]%d", &offs1, &offs2, &offs3, &offs4, &offs5, &offs6); CHECK_IF (!offs2 && offs4 == 3 && offs5 == 4 && offs3 > 0); CHECK_IF (offs6 == 2 * offs3 && offs1 == 3 * offs3); diff --git a/gcc/testsuite/objc.dg/encode-7.m b/gcc/testsuite/objc.dg/encode-7.m index 0b49a415c29..1fe0b242425 100644 --- a/gcc/testsuite/objc.dg/encode-7.m +++ b/gcc/testsuite/objc.dg/encode-7.m @@ -1,5 +1,5 @@ -/* { dg-options "-fgnu-runtime" } */ /* { dg-do run } */ +/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ #include <objc/encoding.h> #include <stdlib.h> diff --git a/gcc/testsuite/objc.dg/encode-8.m b/gcc/testsuite/objc.dg/encode-8.m index 947a92974a2..a992e31505f 100644 --- a/gcc/testsuite/objc.dg/encode-8.m +++ b/gcc/testsuite/objc.dg/encode-8.m @@ -1,5 +1,5 @@ -/* { dg-options "-fgnu-runtime" } */ /* { dg-do run } */ +/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ #include <objc/encoding.h> #include <stdlib.h> diff --git a/gcc/testsuite/objc.dg/encode-9.m b/gcc/testsuite/objc.dg/encode-9.m index 3b005756f0f..1ff2a6b0e48 100644 --- a/gcc/testsuite/objc.dg/encode-9.m +++ b/gcc/testsuite/objc.dg/encode-9.m @@ -1,5 +1,4 @@ /* { dg-do compile } */ -/* { dg-options "-fgnu-runtime " } */ /* There was an ICE due to diving by zero in the objc front-end. */ diff --git a/gcc/testsuite/objc.dg/fix-and-continue-1.m b/gcc/testsuite/objc.dg/fix-and-continue-1.m index 49250c2d84f..1560beac463 100644 --- a/gcc/testsuite/objc.dg/fix-and-continue-1.m +++ b/gcc/testsuite/objc.dg/fix-and-continue-1.m @@ -4,8 +4,9 @@ /* { dg-do run { target *-*-darwin* } } */ /* { dg-options "-mfix-and-continue" } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" #include <stdlib.h> @class MyTarget, MySet; @@ -88,3 +89,5 @@ int main(void) { return 0; } + +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/fix-and-continue-2.m b/gcc/testsuite/objc.dg/fix-and-continue-2.m index 33cb8467dcd..fdfbcbd0c18 100644 --- a/gcc/testsuite/objc.dg/fix-and-continue-2.m +++ b/gcc/testsuite/objc.dg/fix-and-continue-2.m @@ -6,7 +6,7 @@ /* { dg-do assemble { target *-*-darwin* } } */ /* { dg-options "-mfix-and-continue" } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @interface Foo: Object + (Object *)indexableFileTypes; diff --git a/gcc/testsuite/objc.dg/func-ptr-1.m b/gcc/testsuite/objc.dg/func-ptr-1.m index 015d3ac292d..4bdb344a3b6 100644 --- a/gcc/testsuite/objc.dg/func-ptr-1.m +++ b/gcc/testsuite/objc.dg/func-ptr-1.m @@ -1,7 +1,8 @@ /* Test for handling of function pointer ivars */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" extern int strcmp(const char *, const char *); extern void abort(void); @@ -46,3 +47,5 @@ int main () return(0); } +#include "../objc-obj-c++-shared/Object1-implementation.h" + diff --git a/gcc/testsuite/objc.dg/func-ptr-2.m b/gcc/testsuite/objc.dg/func-ptr-2.m index 625ce9fca92..e68c71b70d4 100644 --- a/gcc/testsuite/objc.dg/func-ptr-2.m +++ b/gcc/testsuite/objc.dg/func-ptr-2.m @@ -2,9 +2,11 @@ into pointers. */ /* Contributed by Ziemowit Laski <zlaski@apple.com> */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -#include <objc/Object.h> #include <stdlib.h> +/* provide an Object class for NeXT runtimes 10.5 and above */ +#include "../objc-obj-c++-shared/Object1.h" @interface Func: Object + (int) processNumber:(int)a and:(int)b usingFunction:(int(int,int))func; @@ -35,3 +37,5 @@ int main(void) { return 0; } + +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/gnu-runtime-1.m b/gcc/testsuite/objc.dg/gnu-runtime-1.m index dab921554f1..c7e3bcc3a22 100644 --- a/gcc/testsuite/objc.dg/gnu-runtime-1.m +++ b/gcc/testsuite/objc.dg/gnu-runtime-1.m @@ -2,7 +2,7 @@ the system runtime used). */ /* Author: Ziemowit Laski <zlaski@apple.com> */ /* { dg-do compile } */ -/* { dg-options "-fgnu-runtime" } */ +/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ #include <objc/Object.h> diff --git a/gcc/testsuite/objc.dg/gnu-runtime-2.m b/gcc/testsuite/objc.dg/gnu-runtime-2.m index 2ead2883537..9903d29727c 100644 --- a/gcc/testsuite/objc.dg/gnu-runtime-2.m +++ b/gcc/testsuite/objc.dg/gnu-runtime-2.m @@ -2,7 +2,7 @@ regardless of runtime used on target system. */ /* { dg-do compile } */ -/* { dg-options "-fgnu-runtime" } */ +/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ #include <objc/Object.h> #include <string.h> diff --git a/gcc/testsuite/objc.dg/gnu-runtime-3.m b/gcc/testsuite/objc.dg/gnu-runtime-3.m index 6fc113dbd93..e0c8cc4164d 100644 --- a/gcc/testsuite/objc.dg/gnu-runtime-3.m +++ b/gcc/testsuite/objc.dg/gnu-runtime-3.m @@ -1,7 +1,7 @@ /* Sanity check for GNU-runtime regardless of runtime used on target system. */ /* { dg-do run } */ -/* { dg-options "-fgnu-runtime" } */ +/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ #include <objc/Object.h> #include <string.h> diff --git a/gcc/testsuite/objc.dg/image-info.m b/gcc/testsuite/objc.dg/image-info.m index 3ffe81438d4..0a740fa31f1 100644 --- a/gcc/testsuite/objc.dg/image-info.m +++ b/gcc/testsuite/objc.dg/image-info.m @@ -2,15 +2,12 @@ __OBJC,__image_info section to be emitted. This is only usable on MacOS X 10.3 and later. */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ -/* { dg-options "-freplace-objc-classes" } */ -/* { dg-do compile { target *-*-darwin* } } */ -#ifndef __NEXT_RUNTIME__ -#error Feature not currently supported by the GNU runtime -#endif +/* { dg-do compile { target { *-*-darwin* } } } */ +/* { dg-options "-freplace-objc-classes" } */ +#include "../objc-obj-c++-shared/Object1.h" #include <objc/objc.h> -#include <objc/Object.h> extern void abort(void); diff --git a/gcc/testsuite/objc.dg/isa-field-1.m b/gcc/testsuite/objc.dg/isa-field-1.m index 6398b608d82..377280f0d99 100644 --- a/gcc/testsuite/objc.dg/isa-field-1.m +++ b/gcc/testsuite/objc.dg/isa-field-1.m @@ -1,7 +1,7 @@ /* Ensure there are no bizarre difficulties with accessing the 'isa' field of objects. */ -/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-do compile } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @interface Object (Test) - (Class) test1: (id)object; @@ -14,11 +14,19 @@ @implementation Object (Test) Class test1(id object) { +#ifdef __NEXT_RUNTIME__ Class cls = object->isa; +#else + Class cls = object->class_pointer; +#endif return cls; } - (Class) test1: (id)object { +#ifdef __NEXT_RUNTIME__ Class cls = object->isa; +#else + Class cls = object->class_pointer; +#endif return cls; } @@ -27,17 +35,29 @@ Class test1(id object) { @implementation Derived Class test2(id object) { +#ifdef __NEXT_RUNTIME__ Class cls = object->isa; +#else + Class cls = object->class_pointer; +#endif return cls; } - (Class) test2: (id)object { +#ifdef __NEXT_RUNTIME__ Class cls = object->isa; +#else + Class cls = object->class_pointer; +#endif return cls; } @end Class test3(id object) { +#ifdef __NEXT_RUNTIME__ Class cls = object->isa; +#else + Class cls = object->class_pointer; +#endif return cls; } diff --git a/gcc/testsuite/objc.dg/layout-1.m b/gcc/testsuite/objc.dg/layout-1.m index 6fb114217ab..f702eb2badc 100644 --- a/gcc/testsuite/objc.dg/layout-1.m +++ b/gcc/testsuite/objc.dg/layout-1.m @@ -3,7 +3,7 @@ /* { dg-do compile } */ /* { dg-options "-Wpadded -Wpacked" } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @interface Derived1: Object { } diff --git a/gcc/testsuite/objc.dg/local-decl-2.m b/gcc/testsuite/objc.dg/local-decl-2.m index 41c4206b41d..b1af6d27bc2 100644 --- a/gcc/testsuite/objc.dg/local-decl-2.m +++ b/gcc/testsuite/objc.dg/local-decl-2.m @@ -3,7 +3,7 @@ /* Author: Ziemowit Laski <zlaski@apple.com>. */ /* { dg-do compile } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @interface Sprite: Object { int sprite, spree; diff --git a/gcc/testsuite/objc.dg/lookup-1.m b/gcc/testsuite/objc.dg/lookup-1.m index 71fc61ea04e..ff59b7efba9 100644 --- a/gcc/testsuite/objc.dg/lookup-1.m +++ b/gcc/testsuite/objc.dg/lookup-1.m @@ -1,7 +1,8 @@ -/* { dg-do run { target *-*-darwin* } } */ +/* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -#include <objc/Object.h> #include <stdlib.h> +#include "../objc-obj-c++-shared/Object1.h" typedef struct MyWidget { int a; @@ -35,7 +36,7 @@ MyWidget gWidget = { 17 }; @implementation Container + (MyWidget *)elementForView:(Foo *)view { - MyWidget *widget = nil; + MyWidget *widget = (MyWidget *) nil; if ([view conformsTo:@protocol(MyProto)]) { widget = [(Foo <MyProto> *)view widget]; } @@ -52,3 +53,5 @@ int main(void) { return 0; } + +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/method-10.m b/gcc/testsuite/objc.dg/method-10.m index 5a2a1db3462..442df690a0a 100644 --- a/gcc/testsuite/objc.dg/method-10.m +++ b/gcc/testsuite/objc.dg/method-10.m @@ -3,8 +3,10 @@ message sends (so that proper C/C++ argument conversions may take place). */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +#include "../objc-obj-c++-shared/Object1.h" -#include <objc/Object.h> extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort() @@ -30,3 +32,4 @@ int main(void) return 0; } +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/method-13.m b/gcc/testsuite/objc.dg/method-13.m index c824398ac5b..b3e44bd25d0 100644 --- a/gcc/testsuite/objc.dg/method-13.m +++ b/gcc/testsuite/objc.dg/method-13.m @@ -3,6 +3,7 @@ root classes must be considered. */ /* Author: Ziemowit Laski <zlaski@apple.com>. */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ #include <objc/objc.h> diff --git a/gcc/testsuite/objc.dg/method-15.m b/gcc/testsuite/objc.dg/method-15.m index 0ba3625a817..6a5aec6ac20 100644 --- a/gcc/testsuite/objc.dg/method-15.m +++ b/gcc/testsuite/objc.dg/method-15.m @@ -4,7 +4,7 @@ /* { dg-do compile } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @class NSString; diff --git a/gcc/testsuite/objc.dg/method-17.m b/gcc/testsuite/objc.dg/method-17.m index 501c2decf95..3f6d8d06aad 100644 --- a/gcc/testsuite/objc.dg/method-17.m +++ b/gcc/testsuite/objc.dg/method-17.m @@ -3,7 +3,7 @@ /* { dg-do compile } */ /* { dg-options "-Wreturn-type -Wextra" } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @interface Foo: Object - (id) meth1; diff --git a/gcc/testsuite/objc.dg/method-19.m b/gcc/testsuite/objc.dg/method-19.m index 47163711b3d..362d55858f9 100644 --- a/gcc/testsuite/objc.dg/method-19.m +++ b/gcc/testsuite/objc.dg/method-19.m @@ -3,7 +3,7 @@ /* { dg-do compile } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @class NotKnown; diff --git a/gcc/testsuite/objc.dg/method-3.m b/gcc/testsuite/objc.dg/method-3.m index 65031b0aa5b..abee4e0654b 100644 --- a/gcc/testsuite/objc.dg/method-3.m +++ b/gcc/testsuite/objc.dg/method-3.m @@ -1,9 +1,10 @@ /* Test for sending messages to aliased classes (and instances thereof). */ /* Author: Ziemowit Laski <zlaski@apple.com>. */ -/* { dg-options "-lobjc" } */ +/* { dg-options "" } */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort() @@ -43,3 +44,5 @@ int main(void) { CHECK_IF([(Int1Alias *)int2typedef instanceMeth] == 1697); return 0; } + +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/method-4.m b/gcc/testsuite/objc.dg/method-4.m index c8d092df74d..c5fa1a0861b 100644 --- a/gcc/testsuite/objc.dg/method-4.m +++ b/gcc/testsuite/objc.dg/method-4.m @@ -1,10 +1,11 @@ /* Check if class references (generated for the NeXT runtime) are appropriately - folded. This test is safe to run on all targets. */ + folded. */ /* Author: Ziemowit Laski <zlaski@apple.com>. */ -/* { dg-options "-fnext-runtime" } */ -/* { dg-do compile } */ +/* The ABI is different for m64 darwin so skip this test for now */ +/* { dg-do compile { target { *-*-darwin* && { ! lp64 } } } } */ +/* { dg-skip-if "" { *-*-darwin* } { "-fgnu-runtime" } { "" } } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" typedef Object ObjectTypedef1; typedef ObjectTypedef1 ObjectTypedef2; diff --git a/gcc/testsuite/objc.dg/method-6.m b/gcc/testsuite/objc.dg/method-6.m index 8d868d13cc9..c46d9c450e7 100644 --- a/gcc/testsuite/objc.dg/method-6.m +++ b/gcc/testsuite/objc.dg/method-6.m @@ -4,7 +4,7 @@ /* { dg-do compile } */ /* { dg-options "-Wstrict-selector-match" } */ -#include <objc/Protocol.h> +#include "../objc-obj-c++-shared/Protocol1.h" @interface Base - (unsigned)port; diff --git a/gcc/testsuite/objc.dg/method-7.m b/gcc/testsuite/objc.dg/method-7.m index 310976a2d71..d7a7b97b702 100644 --- a/gcc/testsuite/objc.dg/method-7.m +++ b/gcc/testsuite/objc.dg/method-7.m @@ -1,10 +1,10 @@ /* Check if finding multiple signatures for a method is handled gracefully. */ /* Author: Ziemowit Laski <zlaski@apple.com> */ - /* { dg-do compile } */ /* { dg-options "-Wstrict-selector-match" } */ -#include <objc/Object.h> + +#include "../objc-obj-c++-shared/Object1.h" @interface Class1 - (void)setWindow:(Object *)wdw; diff --git a/gcc/testsuite/objc.dg/method-9.m b/gcc/testsuite/objc.dg/method-9.m index d29b8881c0d..d755d6ad894 100644 --- a/gcc/testsuite/objc.dg/method-9.m +++ b/gcc/testsuite/objc.dg/method-9.m @@ -1,11 +1,11 @@ /* Check if finding multiple signatures for a method is handled gracefully when method lookup succeeds (see also method-7.m). */ /* Contributed by Ziemowit Laski <zlaski@apple.com> */ - /* { dg-do compile } */ /* { dg-options "-Wstrict-selector-match" } */ -#include <objc/Object.h> + +#include "../objc-obj-c++-shared/Object1.h" @protocol MyObject - (id)initWithData:(Object *)data; diff --git a/gcc/testsuite/objc.dg/next-runtime-1.m b/gcc/testsuite/objc.dg/next-runtime-1.m index db14897fe8d..7d4a7d949c6 100644 --- a/gcc/testsuite/objc.dg/next-runtime-1.m +++ b/gcc/testsuite/objc.dg/next-runtime-1.m @@ -3,9 +3,9 @@ /* Author: Ziemowit Laski <zlaski@apple.com> */ /* { dg-do compile { target *-*-darwin* } } */ -/* { dg-options "-fnext-runtime" } */ +/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @interface FooBar: Object - (void)boo; diff --git a/gcc/testsuite/objc.dg/no-extra-load.m b/gcc/testsuite/objc.dg/no-extra-load.m index 9b50e8358ba..75035357926 100644 --- a/gcc/testsuite/objc.dg/no-extra-load.m +++ b/gcc/testsuite/objc.dg/no-extra-load.m @@ -1,4 +1,5 @@ /* { dg-do compile { target *-*-darwin* } } */ +/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ #import <Foundation/Foundation.h> main() { [NSObject new]; } diff --git a/gcc/testsuite/objc.dg/objc-fast-4.m b/gcc/testsuite/objc.dg/objc-fast-4.m index 8dbcd138b8c..b86e395294f 100644 --- a/gcc/testsuite/objc.dg/objc-fast-4.m +++ b/gcc/testsuite/objc.dg/objc-fast-4.m @@ -1,10 +1,9 @@ /* The code should call objc_msgSend directly, not through a pointer. */ -/* { dg-do compile { target powerpc*-*-darwin* } } */ -/* { dg-options "-O0 -fnext-runtime" } */ -/* { dg-skip-if "" { powerpc*-*-darwin* } { "-m64" } { "" } } */ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-O0" } */ /* Radar 4015820 */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" void foo(void) { Object *o; diff --git a/gcc/testsuite/objc.dg/objc-gc-4.m b/gcc/testsuite/objc.dg/objc-gc-4.m index df0a44cd8dd..efbde1b4b2a 100644 --- a/gcc/testsuite/objc.dg/objc-gc-4.m +++ b/gcc/testsuite/objc.dg/objc-gc-4.m @@ -5,7 +5,7 @@ /* { dg-do compile { target *-*-darwin* } } */ /* { dg-options "-fobjc-gc" } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @class MyWindow; diff --git a/gcc/testsuite/objc.dg/pragma-1.m b/gcc/testsuite/objc.dg/pragma-1.m index 0c3010dcf30..e9527e39e4e 100644 --- a/gcc/testsuite/objc.dg/pragma-1.m +++ b/gcc/testsuite/objc.dg/pragma-1.m @@ -1,4 +1,4 @@ -/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-do compile } */ /* ??? Is there a better pragma that is handled for all targets, not handled by the preprocessor, that would be better for testing here? */ diff --git a/gcc/testsuite/objc.dg/proto-lossage-2.m b/gcc/testsuite/objc.dg/proto-lossage-2.m index b3ab9681f62..361bb9087e6 100644 --- a/gcc/testsuite/objc.dg/proto-lossage-2.m +++ b/gcc/testsuite/objc.dg/proto-lossage-2.m @@ -2,7 +2,7 @@ provide a suitable method. */ /* { dg-do compile } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @protocol Zot -(void) zot; diff --git a/gcc/testsuite/objc.dg/proto-lossage-3.m b/gcc/testsuite/objc.dg/proto-lossage-3.m index 512a59ee6dc..1cb7b1d91b9 100644 --- a/gcc/testsuite/objc.dg/proto-lossage-3.m +++ b/gcc/testsuite/objc.dg/proto-lossage-3.m @@ -2,9 +2,10 @@ a protocol with no instance/class methods respectively. Problem report and original fix by richard@brainstorm.co.uk. */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ +#include "../objc-obj-c++-shared/Protocol1.h" +#include "../objc-obj-c++-shared/Object1.h" #include <objc/objc.h> -#include <objc/Object.h> -#include <objc/Protocol.h> @protocol NoInstanceMethods + testMethod; diff --git a/gcc/testsuite/objc.dg/proto-qual-1.m b/gcc/testsuite/objc.dg/proto-qual-1.m index 126bae76e89..7c6c62d241b 100644 --- a/gcc/testsuite/objc.dg/proto-qual-1.m +++ b/gcc/testsuite/objc.dg/proto-qual-1.m @@ -1,9 +1,10 @@ /* Check that protocol qualifiers are compiled and encoded properly. */ /* Author: Ziemowit Laski <zlaski@apple.com> */ -/* { dg-options "-lobjc" } */ +/* { dg-options "" } */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -#include <objc/Protocol.h> +#include "../objc-obj-c++-shared/Protocol1.h" #ifndef __NEXT_RUNTIME__ #include <objc/objc-api.h> #endif diff --git a/gcc/testsuite/objc.dg/selector-1.m b/gcc/testsuite/objc.dg/selector-1.m index b9cc5e0807d..f0781b68c63 100644 --- a/gcc/testsuite/objc.dg/selector-1.m +++ b/gcc/testsuite/objc.dg/selector-1.m @@ -1,7 +1,8 @@ /* Test warning for non existing selectors. */ /* Contributed by Devang Patel <dpatel@apple.com>. */ -/* { dg-options "-Wselector -fnext-runtime" } */ +/* { dg-options "-Wselector" } */ /* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ typedef struct objc_object { struct objc_class *class_pointer; } *id; typedef struct objc_selector *SEL; diff --git a/gcc/testsuite/objc.dg/selector-2.m b/gcc/testsuite/objc.dg/selector-2.m index 3a463c3879a..ab8eb3e4540 100644 --- a/gcc/testsuite/objc.dg/selector-2.m +++ b/gcc/testsuite/objc.dg/selector-2.m @@ -2,7 +2,7 @@ /* { dg-options "-Wselector" } */ /* { dg-do compile } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @interface Foo @end diff --git a/gcc/testsuite/objc.dg/selector-3.m b/gcc/testsuite/objc.dg/selector-3.m index 49f7e417208..b3ffccaca3a 100644 --- a/gcc/testsuite/objc.dg/selector-3.m +++ b/gcc/testsuite/objc.dg/selector-3.m @@ -1,7 +1,8 @@ /* Test warning for non-existent selectors. */ /* This is the "-fgnu-runtime" variant of objc.dg/selector-1.m. */ -/* { dg-options "-Wselector -fgnu-runtime" } */ +/* { dg-options "-Wselector" } */ /* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ typedef struct objc_object { struct objc_class *class_pointer; } *id; typedef const struct objc_selector *SEL; diff --git a/gcc/testsuite/objc.dg/sizeof-1.m b/gcc/testsuite/objc.dg/sizeof-1.m index 5d8def16afe..ae505c1e898 100644 --- a/gcc/testsuite/objc.dg/sizeof-1.m +++ b/gcc/testsuite/objc.dg/sizeof-1.m @@ -1,10 +1,10 @@ /* Check that the sizeof() operator works with ObjC classes and their aliases. */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ -/* { dg-options "-lobjc" } */ +/* { dg-options "" } */ /* { dg-do run } */ +#include "../objc-obj-c++-shared/Object1.h" #include <objc/objc.h> -#include <objc/Object.h> extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort(); @@ -31,3 +31,4 @@ int main(void) { return 0; } +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/special/special.exp b/gcc/testsuite/objc.dg/special/special.exp index 55a34c4abe3..fdc90ecc6b5 100644 --- a/gcc/testsuite/objc.dg/special/special.exp +++ b/gcc/testsuite/objc.dg/special/special.exp @@ -33,14 +33,29 @@ dg-init # This test is special because we must compile two different modules, # unclaimed-category-1a.m and unclaimed-category-1.m, then link # together, then run the resulting executable. -set lines [objc_target_compile "$srcdir/$subdir/unclaimed-category-1a.m" "unclaimed-category-1a.o" object "additional_flags=-I${srcdir}/../../libobjc"] +# for all systems we point to the libobjc includes and use the -fgnu-runtime +set add_flags "additional_flags=-I${srcdir}/../../libobjc" +lappend add_flags "additional_flags=-fgnu-runtime" +set lines [objc_target_compile "$srcdir/$subdir/unclaimed-category-1a.m" "unclaimed-category-1a.o" object $add_flags ] if ![string match "" $lines] then { fail "unclaimed-category-1a.o" } else { - dg-runtest "$srcdir/$subdir/unclaimed-category-1.m" "unclaimed-category-1a.o" "-I${srcdir}/../../libobjc" + dg-runtest "$srcdir/$subdir/unclaimed-category-1.m" "unclaimed-category-1a.o" "-I${srcdir}/../../libobjc -fgnu-runtime" file delete unclaimed-category-1a.o } +if [istarget "*-*-darwin*" ] { +set add_flags "" +lappend add_flags "additional_flags=-fnext-runtime" +set lines [objc_target_compile "$srcdir/$subdir/unclaimed-category-1a.m" "unclaimed-category-1a.o" object $add_flags ] +if ![string match "" $lines] then { + fail "unclaimed-category-1a.o" +} else { + dg-runtest "$srcdir/$subdir/unclaimed-category-1.m" "unclaimed-category-1a.o" "-fnext-runtime" + file delete unclaimed-category-1a.o +} +} + # All done. dg-finish diff --git a/gcc/testsuite/objc.dg/special/unclaimed-category-1.h b/gcc/testsuite/objc.dg/special/unclaimed-category-1.h index 52586f01521..0453033f3d2 100644 --- a/gcc/testsuite/objc.dg/special/unclaimed-category-1.h +++ b/gcc/testsuite/objc.dg/special/unclaimed-category-1.h @@ -1,11 +1,4 @@ /* Contributed by Nicola Pero - Fri Dec 14 08:36:00 GMT 2001 */ -#include <objc/objc.h> -#include <objc/Object.h> - -#ifdef __NEXT_RUNTIME__ -#define objc_get_class(C) objc_getClass(C) -#define class_create_instance(C) class_createInstance(C, 0) -#endif /* Test loading unclaimed categories - categories of a class defined separately from the class itself. */ diff --git a/gcc/testsuite/objc.dg/special/unclaimed-category-1.m b/gcc/testsuite/objc.dg/special/unclaimed-category-1.m index b3a8c28b5e6..472ad8bbf83 100644 --- a/gcc/testsuite/objc.dg/special/unclaimed-category-1.m +++ b/gcc/testsuite/objc.dg/special/unclaimed-category-1.m @@ -1,8 +1,12 @@ /* Contributed by Nicola Pero - Fri Dec 14 08:36:00 GMT 2001 */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +#import "../../objc-obj-c++-shared/next-mapping.h" #include <objc/objc.h> +#ifndef __NEXT_RUNTIME__ #include <objc/objc-api.h> -#include <objc/Object.h> +#endif extern void abort (void); @@ -69,3 +73,5 @@ int main (void) return 0; } + +#import "../../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/special/unclaimed-category-1a.m b/gcc/testsuite/objc.dg/special/unclaimed-category-1a.m index 6bcd1b4c53c..4fb2d461906 100644 --- a/gcc/testsuite/objc.dg/special/unclaimed-category-1a.m +++ b/gcc/testsuite/objc.dg/special/unclaimed-category-1a.m @@ -1,6 +1,4 @@ /* Contributed by Nicola Pero - Fri Dec 14 08:36:00 GMT 2001 */ -#include <objc/objc.h> -#include <objc/Object.h> /* Test loading unclaimed categories - categories of a class defined separately from the class itself. */ diff --git a/gcc/testsuite/objc.dg/stret-1.m b/gcc/testsuite/objc.dg/stret-1.m index 7e13b32e338..cae7d6dd6bf 100644 --- a/gcc/testsuite/objc.dg/stret-1.m +++ b/gcc/testsuite/objc.dg/stret-1.m @@ -1,8 +1,9 @@ /* Test for handling of struct-returning methods. */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort() @@ -60,3 +61,5 @@ int main(void) return 0; } + +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/stret-2.m b/gcc/testsuite/objc.dg/stret-2.m index dd9a2e8e5b2..ded3ae41997 100644 --- a/gcc/testsuite/objc.dg/stret-2.m +++ b/gcc/testsuite/objc.dg/stret-2.m @@ -3,8 +3,9 @@ points). */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ /* { dg-do compile { target *-*-darwin* } } */ +/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" struct astruct { float a, b; diff --git a/gcc/testsuite/objc.dg/stubify-1.m b/gcc/testsuite/objc.dg/stubify-1.m index 2b1aa61cf59..72de75beffc 100644 --- a/gcc/testsuite/objc.dg/stubify-1.m +++ b/gcc/testsuite/objc.dg/stubify-1.m @@ -2,6 +2,7 @@ _objc_msgSend<end-of-line>" without the $stub suffix. */ /* { dg-do compile { target *-*-darwin* } } */ +/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-Os -mdynamic-no-pic" } */ typedef struct objc_object { } *id ; diff --git a/gcc/testsuite/objc.dg/stubify-2.m b/gcc/testsuite/objc.dg/stubify-2.m index a77ab9f2061..b474d4f8927 100644 --- a/gcc/testsuite/objc.dg/stubify-2.m +++ b/gcc/testsuite/objc.dg/stubify-2.m @@ -2,6 +2,7 @@ /* Testcase extracted from TextEdit:Document.m. */ /* { dg-do compile { target *-*-darwin* } } */ +/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mdynamic-no-pic -fdump-rtl-jump" } */ typedef struct objc_object { } *id ; diff --git a/gcc/testsuite/objc.dg/super-class-2.m b/gcc/testsuite/objc.dg/super-class-2.m index 15d018e7db8..144ea81b5e6 100644 --- a/gcc/testsuite/objc.dg/super-class-2.m +++ b/gcc/testsuite/objc.dg/super-class-2.m @@ -1,7 +1,6 @@ /* Test calling super from within a category class method. */ /* Author: Ziemowit Laski <zlaski@apple.com> */ /* { dg-do compile } */ -/* { dg-options "-fnext-runtime" } */ typedef struct objc_object { struct objc_class *isa; } *id; diff --git a/gcc/testsuite/objc.dg/super-class-3.m b/gcc/testsuite/objc.dg/super-class-3.m index 85396c23691..fc74871db8f 100644 --- a/gcc/testsuite/objc.dg/super-class-3.m +++ b/gcc/testsuite/objc.dg/super-class-3.m @@ -2,8 +2,10 @@ is an ObjC class name. */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +#include "../objc-obj-c++-shared/Object1.h" -#include <objc/Object.h> #include <stdlib.h> #define CHECK_IF(expr) if(!(expr)) abort() @@ -41,3 +43,4 @@ int main(void) { return 0; } +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/super-class-4.m b/gcc/testsuite/objc.dg/super-class-4.m index 5248123e79a..a5ff9088b1d 100644 --- a/gcc/testsuite/objc.dg/super-class-4.m +++ b/gcc/testsuite/objc.dg/super-class-4.m @@ -3,7 +3,7 @@ should be traversed to find the @interface. */ /* { dg-do compile } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @class MyWpModule; diff --git a/gcc/testsuite/objc.dg/symtab-1.m b/gcc/testsuite/objc.dg/symtab-1.m index d031cb46d06..dade2084478 100644 --- a/gcc/testsuite/objc.dg/symtab-1.m +++ b/gcc/testsuite/objc.dg/symtab-1.m @@ -1,9 +1,10 @@ /* Check if the objc_symtab descriptor is being laid out correctly. */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ -/* { dg-options "-fnext-runtime" } */ -/* { dg-do compile { target *-*-darwin* } } */ -#include <objc/Object.h> +/* { dg-do compile { target { *-*-darwin* } } } */ +/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ + +#include "../objc-obj-c++-shared/Object1.h" @interface Base: Object - (void)setValues; diff --git a/gcc/testsuite/objc.dg/sync-1.m b/gcc/testsuite/objc.dg/sync-1.m index d7035c715b5..fe1f65c78eb 100644 --- a/gcc/testsuite/objc.dg/sync-1.m +++ b/gcc/testsuite/objc.dg/sync-1.m @@ -1,8 +1,8 @@ /* Make sure that @synchronized parses. */ -/* { dg-options "-fnext-runtime -fobjc-exceptions" } */ +/* { dg-options "-fobjc-exceptions" } */ /* { dg-do compile } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" void foo(id sem) { diff --git a/gcc/testsuite/objc.dg/try-catch-1.m b/gcc/testsuite/objc.dg/try-catch-1.m index c47e41c9601..5b2a209ddb8 100644 --- a/gcc/testsuite/objc.dg/try-catch-1.m +++ b/gcc/testsuite/objc.dg/try-catch-1.m @@ -3,7 +3,7 @@ /* { dg-options "-fobjc-exceptions" } */ /* { dg-do compile } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" #include <stdio.h> #include <setjmp.h> diff --git a/gcc/testsuite/objc.dg/try-catch-10.m b/gcc/testsuite/objc.dg/try-catch-10.m index 1da1b47984a..49e2c0cef15 100644 --- a/gcc/testsuite/objc.dg/try-catch-10.m +++ b/gcc/testsuite/objc.dg/try-catch-10.m @@ -1,10 +1,10 @@ /* Ensure that @try/@catch blocks do not mess with types of local objects (other than their volatile bits). */ -/* { dg-options "-fobjc-exceptions -fnext-runtime" } */ +/* { dg-options "-fobjc-exceptions" } */ /* { dg-do compile } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @protocol Proto1 - (int)meth1; diff --git a/gcc/testsuite/objc.dg/try-catch-3.m b/gcc/testsuite/objc.dg/try-catch-3.m index af2829e2c2f..2094d29ce2d 100644 --- a/gcc/testsuite/objc.dg/try-catch-3.m +++ b/gcc/testsuite/objc.dg/try-catch-3.m @@ -5,7 +5,7 @@ /* { dg-do compile } */ /* { dg-options "-fobjc-exceptions" } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" const char *foo(void) { diff --git a/gcc/testsuite/objc.dg/try-catch-5.m b/gcc/testsuite/objc.dg/try-catch-5.m index f833bc2c749..f943e9c7e1e 100644 --- a/gcc/testsuite/objc.dg/try-catch-5.m +++ b/gcc/testsuite/objc.dg/try-catch-5.m @@ -4,7 +4,7 @@ generating the warning message. */ /* { dg-do compile } */ -/* { dg-options "-Wall -fnext-runtime -fobjc-exceptions" } */ +/* { dg-options "-Wall -fobjc-exceptions" } */ @interface Exception @end diff --git a/gcc/testsuite/objc.dg/try-catch-6.m b/gcc/testsuite/objc.dg/try-catch-6.m index 5276f0f68d1..548c320b494 100644 --- a/gcc/testsuite/objc.dg/try-catch-6.m +++ b/gcc/testsuite/objc.dg/try-catch-6.m @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-fobjc-exceptions" } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" int main (int argc, const char * argv[]) { Object * pool = [Object new]; diff --git a/gcc/testsuite/objc.dg/try-catch-7.m b/gcc/testsuite/objc.dg/try-catch-7.m index b1e1cd191c6..b6666237025 100644 --- a/gcc/testsuite/objc.dg/try-catch-7.m +++ b/gcc/testsuite/objc.dg/try-catch-7.m @@ -3,7 +3,7 @@ /* { dg-do compile } */ /* { dg-options "-fobjc-exceptions" } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" @interface Derived: Object - (id) meth; diff --git a/gcc/testsuite/objc.dg/try-catch-9.m b/gcc/testsuite/objc.dg/try-catch-9.m index 5f6daa42bf3..454e841b301 100644 --- a/gcc/testsuite/objc.dg/try-catch-9.m +++ b/gcc/testsuite/objc.dg/try-catch-9.m @@ -5,7 +5,6 @@ /* { dg-options "-fobjc-exceptions" } */ /* { dg-do compile } */ - void foo (int *arg1, int *arg2) { *arg1 = *arg2; diff --git a/gcc/testsuite/objc.dg/type-size-2.m b/gcc/testsuite/objc.dg/type-size-2.m index da6bdb8f9fb..2f8d517a3a3 100644 --- a/gcc/testsuite/objc.dg/type-size-2.m +++ b/gcc/testsuite/objc.dg/type-size-2.m @@ -3,16 +3,17 @@ encoded as pointers. */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ /* { dg-do run } */ - -#include <objc/objc.h> +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ +#include "../objc-obj-c++-shared/Object1.h" +#include "../objc-obj-c++-shared/next-mapping.h" +//#include <objc/objc.h> #ifdef __NEXT_RUNTIME__ #include <objc/objc-runtime.h> -#define OBJC_GETCLASS objc_getClass -#define CLASS_GETINSTANCEMETHOD class_getInstanceMethod +#define METHOD Method #else #include <objc/objc-api.h> -#define OBJC_GETCLASS objc_get_class -#define CLASS_GETINSTANCEMETHOD class_get_instance_method +#define METHOD Method_t +#define method_get_types(M) (M)->method_types #endif extern int sscanf(const char *str, const char *format, ...); @@ -32,27 +33,29 @@ enum Enum { one, two, three, four }; @end Class cls; -struct objc_method *meth; +METHOD meth ; + unsigned totsize, offs0, offs1, offs2, offs3, offs4, offs5, offs6, offs7; static void scan_initial(const char *pattern) { totsize = offs0 = offs1 = offs2 = offs3 = offs4 = offs5 = offs6 = offs7 = (unsigned)-1; - sscanf(meth->method_types, pattern, &totsize, &offs0, &offs1, &offs2, &offs3, + sscanf(method_get_types(meth), pattern, &totsize, &offs0, &offs1, &offs2, &offs3, &offs4, &offs5, &offs6, &offs7); CHECK_IF(!offs0 && offs1 == sizeof(id) && offs2 == offs1 + sizeof(SEL) && totsize >= offs2); } int main(void) { - cls = OBJC_GETCLASS("ArrayTest"); + cls = objc_get_class("ArrayTest"); - meth = CLASS_GETINSTANCEMETHOD(cls, @selector(str:with:and:)); + meth = class_get_instance_method(cls, @selector(str:with:and:)); scan_initial("r*%u@%u:%u*%u*%u[4i]%u"); CHECK_IF(offs3 == offs2 + sizeof(signed char *) && offs4 == offs3 + sizeof(unsigned char *)); CHECK_IF(totsize == offs4 + sizeof(enum Enum *)); - meth = CLASS_GETINSTANCEMETHOD(cls, @selector(meth1:with:with:)); + meth = class_get_instance_method(cls, @selector(meth1:with:with:)); scan_initial("i%u@%u:%u^i%u[0i]%u[2i]%u"); CHECK_IF(offs3 == offs2 + sizeof(int *) && offs4 == offs3 + sizeof(int *)); CHECK_IF(totsize == offs4 + sizeof(int *)); return 0; } +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/type-stream-1.m b/gcc/testsuite/objc.dg/type-stream-1.m index edc04e6467b..33a30914f8e 100644 --- a/gcc/testsuite/objc.dg/type-stream-1.m +++ b/gcc/testsuite/objc.dg/type-stream-1.m @@ -1,5 +1,5 @@ -/* { dg-options "-fgnu-runtime" } */ /* { dg-do run } */ +/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ #include <objc/typedstream.h> #include <stdio.h> #include <stdlib.h> diff --git a/gcc/testsuite/objc.dg/typedef-alias-1.m b/gcc/testsuite/objc.dg/typedef-alias-1.m index beed7270121..79db8765ead 100644 --- a/gcc/testsuite/objc.dg/typedef-alias-1.m +++ b/gcc/testsuite/objc.dg/typedef-alias-1.m @@ -1,7 +1,7 @@ /* Typedefs of ObjC types should work without any bogus warnings. */ /* { dg-do compile } */ -#include <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" typedef Object MyObject; diff --git a/gcc/testsuite/objc.dg/va-meth-1.m b/gcc/testsuite/objc.dg/va-meth-1.m index 751b6484545..15bbe97c9a5 100644 --- a/gcc/testsuite/objc.dg/va-meth-1.m +++ b/gcc/testsuite/objc.dg/va-meth-1.m @@ -1,7 +1,9 @@ /* Based on objc/execute/va_method.m, by Nicola Pero */ /* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +#include "../objc-obj-c++-shared/Object1.h" -#include <objc/Object.h> #include <stdarg.h> #include <stdlib.h> @@ -67,3 +69,5 @@ int main (void) return 0; } + +#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/zero-link-1.m b/gcc/testsuite/objc.dg/zero-link-1.m index 96fd0c290d3..35cabfaf5de 100644 --- a/gcc/testsuite/objc.dg/zero-link-1.m +++ b/gcc/testsuite/objc.dg/zero-link-1.m @@ -1,10 +1,12 @@ /* Check if the '-fzero-link' flag correctly emits an objc_getClass() call. */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ -/* { dg-options "-fnext-runtime -fzero-link" } */ -/* { dg-do compile } */ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ +/* { dg-options "-fzero-link" } */ + +#include "../objc-obj-c++-shared/Object1.h" #include <objc/objc.h> -#include <objc/Object.h> extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort(); diff --git a/gcc/testsuite/objc.dg/zero-link-2.m b/gcc/testsuite/objc.dg/zero-link-2.m index 8fba04230b6..443090aaee7 100644 --- a/gcc/testsuite/objc.dg/zero-link-2.m +++ b/gcc/testsuite/objc.dg/zero-link-2.m @@ -1,10 +1,12 @@ /* Check if the '-fno-zero-link' flag correctly _omits_ an objc_getClass() call. */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ -/* { dg-options "-fnext-runtime -fno-zero-link" } */ -/* { dg-do compile } */ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ +/* { dg-options "-fno-zero-link" } */ + +#include "../objc-obj-c++-shared/Object1.h" #include <objc/objc.h> -#include <objc/Object.h> extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort(); diff --git a/gcc/testsuite/objc.dg/zero-link-3.m b/gcc/testsuite/objc.dg/zero-link-3.m index af624abf096..2b95b952b1e 100644 --- a/gcc/testsuite/objc.dg/zero-link-3.m +++ b/gcc/testsuite/objc.dg/zero-link-3.m @@ -1,10 +1,12 @@ /* Check that the '-fzero-link' flag doesn't prevent messaging from working. */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ -/* { dg-options "-fnext-runtime -fzero-link -lobjc" } */ + /* { dg-do run { target *-*-darwin* } } */ +/* { dg-options "-fzero-link" } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -#import <objc/objc.h> -#import <objc/Object.h> +#include "../objc-obj-c++-shared/Object1.h" +//#import <objc/objc.h> extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort(); @@ -22,3 +24,5 @@ int main(void) { CHECK_IF(val == 1593); return 0; } + +#include "../objc-obj-c++-shared/Object1-implementation.h" |