diff options
author | Iain Sandoe <iains@gcc.gnu.org> | 2011-02-18 00:07:38 +0000 |
---|---|---|
committer | Nicola Pero <nicola@gcc.gnu.org> | 2011-02-18 00:07:38 +0000 |
commit | d764a8e6bdae09aecb7a8378def9d900f84ce53e (patch) | |
tree | c0b6f091c931f0a65e3fb59fbd9fff3f5ba9bde9 /gcc/testsuite | |
parent | 0a8134cacea8b18b0e241cc492546cbb69ae598a (diff) | |
download | gcc-d764a8e6bdae09aecb7a8378def9d900f84ce53e.zip gcc-d764a8e6bdae09aecb7a8378def9d900f84ce53e.tar.gz gcc-d764a8e6bdae09aecb7a8378def9d900f84ce53e.tar.bz2 |
Added support for the 64-bit Apple Objective-C runtime
From-SVN: r170260
Diffstat (limited to 'gcc/testsuite')
48 files changed, 291 insertions, 107 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4d6fae0..274da7e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,55 @@ +2011-02-17 Iain Sandoe <iains@gcc.gnu.org> + + * objc.dg/special/unclaimed-category-1.h: Updated for + new ABI support. + * objc.dg/special/unclaimed-category-1.m: Same. + * objc.dg/zero-link-1.m: Same. + * objc.dg/lookup-1.m: Same. + * objc.dg/torture/strings/const-str-9.m + * objc.dg/torture/strings/const-str-10.m: Same. + * objc.dg/torture/strings/const-str-11.m: Same. + * objc.dg/torture/forward-1.m: Same. + * objc.dg/zero-link-2.m: Same. + * objc.dg/encode-7-next-64bit.m: Same. + * objc.dg/method-4.m: Same. + * objc.dg/next-runtime-1.m: Same. + * objc.dg/image-info.m: Same. + * objc.dg/pr23214.m: Same. + * objc.dg/symtab-1.m: Same. + * obj-c++.dg/basic.m: Same.m + * obj-c++.dg/proto-lossage-3.m: Same.m + * obj-c++.dg/torture/strings/const-str-10.m: Same.m + * obj-c++.dg/torture/strings/const-str-11.m: Same.m + * obj-c++.dg/torture/strings/const-str-9.m: Same.m + * obj-c++.dg/method-11.m: Same.m + * objc/execute/enumeration-1.m: Same. + * objc/execute/object_is_class.m: Same. + * objc/execute/formal_protocol-2.m: Same. + * objc/execute/formal_protocol-4.m: Same. + * objc/execute/formal_protocol-6.m: Same. + * objc/execute/bycopy-3.m: Same. + * objc/execute/exceptions/catchall-1.m: Same. + * objc/execute/exceptions/finally-1.m: Same. + * objc/execute/exceptions/local-variables-1.m: Same. + * objc/execute/exceptions/foward-1.m: Same. + * objc/execute/bf-common.h + * objc/execute/enumeration-2.m: Same. + * objc/execute/formal_protocol-1.m: Same. + * objc/execute/formal_protocol-3.m: Same. + * objc/execute/formal_protocol-5.m: Same. + * objc/execute/accessing_ivars.m: Same. + * objc/execute/bycopy-2.m: Same. + * objc/execute/formal_protocol-7.m: Same. + * objc/execute/compatibility_alias.m: Same. + * objc/execute/no_clash.m: Same. + * objc/execute/object_is_meta_class.m: Same. + * objc/execute/exceptions/exceptions.exp: Load target-supports.exp + * objc/execute/class-tests-1.h: Include stdio.h. + * objc/execute/class-tests-2.h: Same. + * obj-c++.dg/try-catch-9.mm: xfail-run the test with both + runtimes. + * obj-c++.dg/try-catch-2.mm: Same. + 2011-02-17 Jakub Jelinek <jakub@redhat.com> PR c++/47783 diff --git a/gcc/testsuite/obj-c++.dg/basic.mm b/gcc/testsuite/obj-c++.dg/basic.mm index 8fb0204..bd593c1 100644 --- a/gcc/testsuite/obj-c++.dg/basic.mm +++ b/gcc/testsuite/obj-c++.dg/basic.mm @@ -1,22 +1,41 @@ // A basic sanity check for Objective-C++. // { dg-do run } /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -#include "../objc-obj-c++-shared/Object1.h" + +//#include "../objc-obj-c++-shared/Object1.h" #include <iostream> +#include <objc/Object.h> + +#ifdef __OBJC2__ +@interface Object (ADDITIONS) ++ initialize; +- init; ++ alloc; ++ new; +@end +@implementation Object (ADDITIONS) ++ initialize { return self; } +- init { return self; } ++ alloc { return class_createInstance (self, 0); } ++ new { return [[self alloc] init]; } +@end +#endif + @interface Greeter : Object - (void) greet: (const char *)msg; @end @implementation Greeter -- (void) greet: (const char *)msg { std::cout << msg; } +- (void) greet: (const char *)msg +{ std::cout << msg << __VERSION__ << std::endl;} @end int main () { - std::cout << "Hello from C++\n"; + std::cout << "Hello from C++" << __VERSION__ << std::endl; Greeter *obj = [Greeter new]; - [obj greet: "Hello from Objective-C\n"]; + [obj greet: "Hello from Objective-C++"]; } -#include "../objc-obj-c++-shared/Object1-implementation.h" +//#include "../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/obj-c++.dg/method-11.mm b/gcc/testsuite/obj-c++.dg/method-11.mm index 6c6b1a0..74192e8 100644 --- a/gcc/testsuite/obj-c++.dg/method-11.mm +++ b/gcc/testsuite/obj-c++.dg/method-11.mm @@ -22,5 +22,8 @@ void foo(void) { obj = [ObjectAlias2 new]; } -/* { dg-final { scan-assembler "_OBJC_CLASS_REFERENCES_0" } } */ -/* { dg-final { scan-assembler-not "_OBJC_CLASS_REFERENCES_1" } } */ +/* { dg-final { scan-assembler "_OBJC_ClassRefs_0" { target { *-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler "_OBJC_ClassRef_Object" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler-not "_OBJC_ClassRefs_1" { target { *-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler-not "_OBJC_ClassRef_ObjectTypedef" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler-not "_OBJC_ClassRef_ObjectAlias" { target { *-*-darwin* && { lp64 } } } } } */ diff --git a/gcc/testsuite/obj-c++.dg/proto-lossage-3.mm b/gcc/testsuite/obj-c++.dg/proto-lossage-3.mm index 8a6623e..ac66ace 100644 --- a/gcc/testsuite/obj-c++.dg/proto-lossage-3.mm +++ b/gcc/testsuite/obj-c++.dg/proto-lossage-3.mm @@ -19,9 +19,16 @@ int main() { +#ifdef __OBJC2__ +protocol_getMethodDescription(@protocol(NoInstanceMethods), @selector(name), NO, YES); +protocol_getMethodDescription(@protocol(NoInstanceMethods), @selector(name), NO, NO); +protocol_getMethodDescription(@protocol(NoClassMethods), @selector(name), NO, YES); +protocol_getMethodDescription(@protocol(NoClassMethods), @selector(name), NO, NO); +#else [@protocol(NoInstanceMethods) descriptionForInstanceMethod: @selector(name)]; [@protocol(NoInstanceMethods) descriptionForClassMethod: @selector(name)]; [@protocol(NoClassMethods) descriptionForInstanceMethod: @selector(name)]; [@protocol(NoClassMethods) descriptionForClassMethod: @selector(name)]; +#endif return 0; } diff --git a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm index f61a474..3cb3acf 100644 --- a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm +++ b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm @@ -29,6 +29,7 @@ extern struct objc_class _NSConstantStringClassReference; const NSConstantString *appKey = @"MyApp"; -/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ /* { 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 4\n\t.data" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._NSConstantString\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ diff --git a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm index 4abab36..8674646 100644 --- a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm +++ b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm @@ -29,6 +29,7 @@ extern struct objc_class _XStrClassReference; 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" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t__XStrClassReference\n\t.quad\t.*\n\t.long\t5\n\t.space 4\n\t.data" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ +/* { 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_OBJC_CLASS_._XStr\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ diff --git a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm index 7c99f6b..e05c62b 100644 --- a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm +++ b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm @@ -21,6 +21,7 @@ extern struct objc_class _NSConstantStringClassReference; 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" { target { *-*-darwin* && { ! lp64 } } }} } */ -/* { dg-final { scan-assembler ".quad\t__NSConstantStringClassReference\n\t.quad\t.*\n\t.long\t5\n\t.space 4\n\t.data" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ +/* { 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_OBJC_CLASS_._NSConstantString\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ diff --git a/gcc/testsuite/obj-c++.dg/try-catch-2.mm b/gcc/testsuite/obj-c++.dg/try-catch-2.mm index cf5189a..05aba36 100644 --- a/gcc/testsuite/obj-c++.dg/try-catch-2.mm +++ b/gcc/testsuite/obj-c++.dg/try-catch-2.mm @@ -3,7 +3,7 @@ /* Developed by Ziemowit Laski <zlaski@apple.com>. */ /* { dg-do run } */ -/* { dg-xfail-if "PR23616" { *-*-* } { "-fgnu-runtime" } { "-fnext-runtime" } } */ +/* { dg-xfail-run-if "PR23616" { *-*-* } { "-fgnu-runtime" } { "-fnext-runtime" } } */ /* { dg-xfail-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" "-fgnu-runtime" } { "" } } /* { dg-options "-fobjc-exceptions" } */ diff --git a/gcc/testsuite/obj-c++.dg/try-catch-9.mm b/gcc/testsuite/obj-c++.dg/try-catch-9.mm index c4033c7..a4331fc 100644 --- a/gcc/testsuite/obj-c++.dg/try-catch-9.mm +++ b/gcc/testsuite/obj-c++.dg/try-catch-9.mm @@ -3,7 +3,7 @@ /* Developed by Ziemowit Laski <zlaski@apple.com>. */ /* { dg-do run } */ -/* { dg-xfail-if "PR23616" { *-*-* } { "-fgnu-runtime" } { "-fnext-runtime" } } */ +/* { dg-xfail-run-if "PR23616" { *-*-* } { "-fgnu-runtime" } { "-fnext-runtime" } } */ /* { dg-xfail-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" "-fgnu-runtime" } { "" } } /* { dg-prune-output ".*internal compiler error.*" } */ /* { dg-options "-fobjc-exceptions -O2" } */ diff --git a/gcc/testsuite/objc.dg/encode-7-next-64bit.m b/gcc/testsuite/objc.dg/encode-7-next-64bit.m index 3a5e61d..60129f9 100644 --- a/gcc/testsuite/objc.dg/encode-7-next-64bit.m +++ b/gcc/testsuite/objc.dg/encode-7-next-64bit.m @@ -2,16 +2,15 @@ /* { dg-do run { target *-*-darwin* } } */ /* { dg-require-effective-target lp64 } */ -/* { dg-options "-Wno-deprecated-declarations" } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -/* { dg-additional-sources "../objc-obj-c++-shared/Object1.m" } */ -#include "../objc-obj-c++-shared/Object1.h" -#include "../objc-obj-c++-shared/next-mapping.h" #include <stdbool.h> #include <string.h> #include <stdlib.h> +#include <objc/Object.h> +#include "../objc-obj-c++-shared/next-mapping.h" + #define CHECK_IF(E) if (!(E)) abort () @class NSDictionary, NSFont, NSError, _NSATSTypesetterGuts, NSString, NSMenu, NSArray; @@ -195,69 +194,70 @@ NSRange globalRange; int main(void) { Class fooClass = objc_getClass ("Foo"); Method meth; - struct objc_ivar_list *ivars; - struct objc_ivar *ivar; + Ivar *ivars; + unsigned int ivar_count; + Ivar ivar; meth = class_getInstanceMethod (fooClass, @selector(_errorWithOSStatus:ref1:ref2:reading:)); - CHECK_IF (!strcmp (meth->method_types, "@44@0:8q16r^{FSRef=[80C]}24r^{FSRef=[80C]}32c40")); + CHECK_IF (!strcmp (method_getTypeEncoding(meth), "@44@0:8q16r^{FSRef=[80C]}24r^{FSRef=[80C]}32c40")); meth = class_getInstanceMethod (fooClass, @selector(_attributeRunForCharacterAtIndex:)); - CHECK_IF (!strcmp (meth->method_types, "r^{?=@@QQ^Qffff{_NSRect={_NSPoint=ff}{_NSSize=ff}}q^qQ^Q@@@:::****{?=b1b1b1b1b1b27}}24@0:8Q16")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "r^{?=@@QQ^Qffff{_NSRect={_NSPoint=ff}{_NSSize=ff}}q^qQ^Q@@@:::****{?=b1b1b1b1b1b27}}24@0:8Q16")); meth = class_getInstanceMethod (fooClass, @selector(_getATSTypesetterGuts:)); - CHECK_IF (!strcmp (meth->method_types, "r@24@0:8r:16")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "r@24@0:8r:16")); meth = class_getInstanceMethod (fooClass, @selector(resumeWithSuspensionID:and:)); - CHECK_IF (!strcmp (meth->method_types, "v32@0:8^{__NSAppleEventManagerSuspension=}16r^Q24")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "v32@0:8^{__NSAppleEventManagerSuspension=}16r^Q24")); meth = class_getInstanceMethod (fooClass, @selector(anotherMeth:and:and:)); - CHECK_IF (!strcmp (meth->method_types, "r@40@0:8r:16r@24r@32")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "r@40@0:8r:16r@24r@32")); meth = class_getInstanceMethod (fooClass, @selector(str1:str2:str3:str4:)); - CHECK_IF (!strcmp (meth->method_types, "@48@0:8r*16*24*32r*40")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "@48@0:8r*16*24*32r*40")); meth = class_getInstanceMethod (fooClass, @selector(foo1:foo2:foo3:foo4:)); - CHECK_IF (!strcmp (meth->method_types, "Vv48@0:8@16r@24@32r@40")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "Vv48@0:8@16r@24@32r@40")); meth = class_getInstanceMethod (fooClass, @selector(sel1:id1:)); - CHECK_IF (!strcmp (meth->method_types, "rn*32@0:8r:16r@24")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "rn*32@0:8r:16r@24")); meth = class_getInstanceMethod (fooClass, @selector(obj1:obj2:obj3:)); - CHECK_IF (!strcmp (meth->method_types, "N@40@0:8r@16@24^{Object=#}32")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "N@40@0:8r@16@24^{Object=#}32")); meth = class_getClassMethod (fooClass, @selector(_defaultScriptingComponent)); - CHECK_IF (!strcmp (meth->method_types, "^{ComponentInstanceRecord=[1q]}16@0:8")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "^{ComponentInstanceRecord=[1q]}16@0:8")); meth = class_getInstanceMethod (fooClass, @selector(_formatCocoaErrorString:parameters:applicableFormatters:count:)); - CHECK_IF (!strcmp (meth->method_types, "@44@0:8@16r*24^^{?}32i40")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "@44@0:8@16r*24^^{?}32i40")); meth = class_getInstanceMethod (fooClass, @selector(formatter_func:run:)); - CHECK_IF (!strcmp (meth->method_types, "^{?=^?@I}32@0:8@16r^^{?}24")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "^{?=^?@I}32@0:8@16r^^{?}24")); meth = class_getInstanceMethod (fooClass, @selector(_forgetWord:inDictionary:)); - CHECK_IF (!strcmp (meth->method_types, "c32@0:8nO@16nO@24")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "c32@0:8nO@16nO@24")); meth = class_getInstanceMethod (fooClass, @selector(_registerServicesMenu:withSendTypes:andReturnTypes:addToList:)); - CHECK_IF (!strcmp (meth->method_types, "v44@0:8@16r^*24r^*32c40")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "v44@0:8@16r^*24r^*32c40")); meth = class_getClassMethod (fooClass, @selector(_proxySharePointer)); - CHECK_IF (!strcmp (meth->method_types, "^^{__CFSet}16@0:8")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "^^{__CFSet}16@0:8")); meth = class_getInstanceMethod (fooClass, @selector(_checkGrammarInString:language:details:)); - CHECK_IF (!strcmp (meth->method_types, "{_NSRange=II}40@0:8n@16nO@24oO^@32")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "{_NSRange=II}40@0:8n@16nO@24oO^@32")); meth = class_getInstanceMethod (fooClass, @selector(_resolvePositionalStakeGlyphsForLineFragment:lineFragmentRect:minPosition:maxPosition:maxLineFragmentWidth:breakHint:)); - CHECK_IF (!strcmp (meth->method_types, "B60@0:8^{__CTLine=}16{_NSRect={_NSPoint=ff}{_NSSize=ff}}24f40f44f48^Q52")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "B60@0:8^{__CTLine=}16{_NSRect={_NSPoint=ff}{_NSSize=ff}}24f40f44f48^Q52")); meth = class_getClassMethod (fooClass, @selector(findVoiceByIdentifier:returningCreator:returningID:)); - CHECK_IF (!strcmp (meth->method_types, "c40@0:8@16^I24^I32")); + CHECK_IF (!strcmp (method_getTypeEncoding (meth), "c40@0:8@16^I24^I32")); - ivars = fooClass->ivars; - CHECK_IF (ivars->ivar_count == 1); + ivars = class_copyIvarList (fooClass, &ivar_count); + CHECK_IF (ivar_count == 1); - ivar = ivars->ivar_list; - CHECK_IF (!strcmp (ivar->ivar_name, "r")); - CHECK_IF (!strcmp (ivar->ivar_type, + ivar = ivars[0]; + CHECK_IF (!strcmp (ivar_getName(ivar), "r")); + CHECK_IF (!strcmp (ivar_getTypeEncoding(ivar), "{?=\"_attributes\"@\"NSDictionary\"\"_font\"@\"NSFont\"\"_characterLength\"" "Q\"_nominalGlyphLocation\"Q\"p\"^Q\"_defaultLineHeight\"f\"_defaultBaselineOffset\"" "f\"_horizExpansion\"f\"_baselineDelta\"f\"_attachmentBBox\"{_NSRect=\"origin\"" diff --git a/gcc/testsuite/objc.dg/image-info.m b/gcc/testsuite/objc.dg/image-info.m index e9e9de6..194d366 100644 --- a/gcc/testsuite/objc.dg/image-info.m +++ b/gcc/testsuite/objc.dg/image-info.m @@ -7,13 +7,19 @@ /* { dg-skip-if "NeXT-only" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-freplace-objc-classes" } */ -#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(); +@interface Object (TEST_SUITE_C1) +- init; +@end +@implementation Object (TEST_SUITE_C1) +- init {return self;} +@end + @interface Base: Object { @public int a; @@ -33,4 +39,5 @@ extern void abort(void); } @end -/* { dg-final { scan-assembler "\t.section __OBJC, __image_info.*\n\t.align.*\nL_OBJC_IMAGE_INFO.*:\n\t.long\t0\n\t.long\t1" } } */ +/* { dg-final { scan-assembler "\t.section __OBJC, __image_info.*\n\t.align.*\nL_OBJC_ImageInfo.*:\n\t.long\t0\n\t.long\t1" { target { *-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler "\t.section __DATA, __objc_imageinfo.*\n\t.align.*\nL_OBJC_ImageInfo.*:\n\t.long\t0\n\t.long\t17" { target { *-*-darwin* && { lp64 } } } } } */ diff --git a/gcc/testsuite/objc.dg/lookup-1.m b/gcc/testsuite/objc.dg/lookup-1.m index ff59b7e..737d58a 100644 --- a/gcc/testsuite/objc.dg/lookup-1.m +++ b/gcc/testsuite/objc.dg/lookup-1.m @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ +/* { dg-additional-sources "../objc-obj-c++-shared/Object1.m" } */ #include <stdlib.h> #include "../objc-obj-c++-shared/Object1.h" @@ -53,5 +54,3 @@ int main(void) { 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 c5fa1a0..df25bba 100644 --- a/gcc/testsuite/objc.dg/method-4.m +++ b/gcc/testsuite/objc.dg/method-4.m @@ -22,5 +22,5 @@ void foo(void) { obj = [ObjectAlias2 new]; } -/* { dg-final { scan-assembler "_OBJC_CLASS_REFERENCES_0" } } */ -/* { dg-final { scan-assembler-not "_OBJC_CLASS_REFERENCES_1" } } */ +/* { dg-final { scan-assembler "_OBJC_ClassRefs_0" } } */ +/* { dg-final { scan-assembler-not "_OBJC_ClassRefs_1" } } */ diff --git a/gcc/testsuite/objc.dg/next-runtime-1.m b/gcc/testsuite/objc.dg/next-runtime-1.m index 9a0951c..c76b616 100644 --- a/gcc/testsuite/objc.dg/next-runtime-1.m +++ b/gcc/testsuite/objc.dg/next-runtime-1.m @@ -1,13 +1,14 @@ /* Test that the correct version number (6) is set in the module descriptor - when compiling for the NeXT runtime. */ -/* Author: Ziemowit Laski <zlaski@apple.com> */ + when compiling for the NeXT runtime ABI=0 - and that the MODULE descriptor + is not emitted at all for ABI 2. */ +/* modified from a testcase added by: Ziemowit Laski <zlaski@apple.com> */ /* { dg-do compile { target *-*-darwin* } } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ +/* { dg-skip-if "" { *-*-* } { "-fobjc-abi-version=1" } { "" } } */ +/* { dg-options "-fobjc-abi-version=0" { target { *-*-darwin* && { ! lp64 } } } } */ -#include "../objc-obj-c++-shared/Object1.h" - -@interface FooBar: Object +@interface FooBar - (void)boo; @end @@ -15,5 +16,5 @@ - (void)boo { } @end -/* { dg-final { scan-assembler "L_OBJC_MODULES:\n\[ \t\]*\.long\t6\n" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler "L_OBJC_MODULES:\n\[ \t\]*\.quad\t6\n" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler "L_OBJC_Module:\n\[ \t\]*\.long\t6\n" { target { *-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler-not "L_OBJC_Module" { target { *-*-darwin* && { lp64 } } } } } */ diff --git a/gcc/testsuite/objc.dg/pr23214.m b/gcc/testsuite/objc.dg/pr23214.m index 8443c94..d8092a8 100644 --- a/gcc/testsuite/objc.dg/pr23214.m +++ b/gcc/testsuite/objc.dg/pr23214.m @@ -3,10 +3,19 @@ /* { dg-do run } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ -/* { dg-additional-sources "../objc-obj-c++-shared/Object1.m" } */ -#import "../objc-obj-c++-shared/Object1.h" -#import "../objc-obj-c++-shared/Protocol1.h" +#include <objc/Protocol.h> + +#ifdef __OBJC2__ +/* The ObjC V2 "Object" does not provide -class. */ +@interface Object (TS_CAT) +- class; +@end + +@implementation Object (TS_CAT) +- class { return isa; } +@end +#endif @protocol A @end diff --git a/gcc/testsuite/objc.dg/special/unclaimed-category-1.h b/gcc/testsuite/objc.dg/special/unclaimed-category-1.h index 0453033..bf507a7 100644 --- a/gcc/testsuite/objc.dg/special/unclaimed-category-1.h +++ b/gcc/testsuite/objc.dg/special/unclaimed-category-1.h @@ -5,7 +5,11 @@ @interface TestClass { +#ifdef __OBJC2__ + Class isa; +#else id isa; +#endif } - (int)D; @end diff --git a/gcc/testsuite/objc.dg/special/unclaimed-category-1.m b/gcc/testsuite/objc.dg/special/unclaimed-category-1.m index 472ad8b..88e3d8e 100644 --- a/gcc/testsuite/objc.dg/special/unclaimed-category-1.m +++ b/gcc/testsuite/objc.dg/special/unclaimed-category-1.m @@ -2,11 +2,11 @@ /* { 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> #endif +#include "../../objc-obj-c++-shared/next-mapping.h" extern void abort (void); @@ -73,5 +73,3 @@ int main (void) return 0; } - -#import "../../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc.dg/symtab-1.m b/gcc/testsuite/objc.dg/symtab-1.m index 100b245..936f8d4 100644 --- a/gcc/testsuite/objc.dg/symtab-1.m +++ b/gcc/testsuite/objc.dg/symtab-1.m @@ -4,7 +4,7 @@ /* { dg-do compile { target { *-*-darwin* } } } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ -#include "../objc-obj-c++-shared/Object1.h" +#include <objc/Object.h> @interface Base: Object - (void)setValues; @@ -22,7 +22,6 @@ -(void)checkValues { } @end -/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:\n\t.long\t0\n\t.long\t0\n\t.word\t2\n\t.word\t0\n\t.long\tL_OBJC_CLASS_Derived.*\n\t.long\tL_OBJC_CLASS_Base.*\n" { target { *86*-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:\n\t.long\t0\n\t.long\t0\n\t.short\t2\n\t.short\t0\n\t.long\tL_OBJC_CLASS_Derived.*\n\t.long\tL_OBJC_CLASS_Base.*\n" { target { powerpc*-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:\n\t.quad\t0\n\t.quad\t0\n\t.word\t2\n\t.word\t0\n\t.space 4\n\t.quad\tL_OBJC_CLASS_Derived.*\n\t.quad\tL_OBJC_CLASS_Base.*\n" { target { *86*-*-darwin* && { lp64 } } } } } */ -/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:\n\t.quad\t0\n\t.quad\t0\n\t.short\t2\n\t.short\t0\n\t.space 4\n\t.quad\tL_OBJC_CLASS_Derived.*\n\t.quad\tL_OBJC_CLASS_Base.*\n" { target { powerpc*-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler "L_OBJC_Symbols.*:\n\t.long\t0\n\t.long\t0\n\t.word\t2\n\t.word\t0\n\t.long\tL_OBJC_Class_Derived.*\n\t.long\tL_OBJC_Class_Base.*\n" { target { *86*-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler "L_OBJC_Symbols.*:\n\t.long\t0\n\t.long\t0\n\t.short\t2\n\t.short\t0\n\t.long\tL_OBJC_Class_Derived.*\n\t.long\tL_OBJC_Class_Base.*\n" { target { powerpc*-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler-not "L_OBJC_Symbols" { target { *-*-darwin* && { lp64 } } } } } */ diff --git a/gcc/testsuite/objc.dg/torture/forward-1.m b/gcc/testsuite/objc.dg/torture/forward-1.m index 518bf27..bccf4a1 100644 --- a/gcc/testsuite/objc.dg/torture/forward-1.m +++ b/gcc/testsuite/objc.dg/torture/forward-1.m @@ -1,14 +1,18 @@ /* { dg-do run } */ /* See if -forward::/-performv:: is able to work. */ /* { dg-xfail-run-if "PR36610" { ! { { i?86-*-* x86_64-*-* } && ilp32 } } { "-fgnu-runtime" } { "" } } */ -/* { dg-skip-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ +/* { dg-skip-if "Needs OBJC2 Implementation" { *-*-darwin* && { lp64 } } { "-fnext-runtime" } { "" } } */ +/* There is no implementation of forward: in the NeXT m64 libobjc/Object + neither have we implemented this in our extensions - so we have to skip it + for now. */ #include <stdio.h> #include <stdlib.h> -#import "../../objc-obj-c++-shared/Object1.h" -#import "../../objc-obj-c++-shared/next-mapping.h" -#include <objc/objc-api.h> +#ifndef __NEXT_RUNTIME__ +# include <objc/objc-api.h> +#endif +#include <objc/Object.h> #define VALUETOUSE 1234567890 diff --git a/gcc/testsuite/objc.dg/torture/strings/const-str-10.m b/gcc/testsuite/objc.dg/torture/strings/const-str-10.m index c170f38..f0f2823 100644 --- a/gcc/testsuite/objc.dg/torture/strings/const-str-10.m +++ b/gcc/testsuite/objc.dg/torture/strings/const-str-10.m @@ -29,6 +29,7 @@ extern Class _NSConstantStringClassReference; const NSConstantString *appKey = @"MyApp"; -/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ /* { 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 } } } } } */ +/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._NSConstantString\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ diff --git a/gcc/testsuite/objc.dg/torture/strings/const-str-11.m b/gcc/testsuite/objc.dg/torture/strings/const-str-11.m index 9f3705e..fa9dbd9 100644 --- a/gcc/testsuite/objc.dg/torture/strings/const-str-11.m +++ b/gcc/testsuite/objc.dg/torture/strings/const-str-11.m @@ -29,6 +29,7 @@ extern Class _XStrClassReference; const XStr *appKey = @"MyApp"; -/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ /* { 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 } } } } } */ +/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._XStr\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ diff --git a/gcc/testsuite/objc.dg/torture/strings/const-str-9.m b/gcc/testsuite/objc.dg/torture/strings/const-str-9.m index ddbe93d..39bd102 100644 --- a/gcc/testsuite/objc.dg/torture/strings/const-str-9.m +++ b/gcc/testsuite/objc.dg/torture/strings/const-str-9.m @@ -21,6 +21,7 @@ Class _NSConstantStringClassReference; const NSConstantString *appKey = @"MyApp"; -/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ /* { 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 } } } } } */ +/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._NSConstantString\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ diff --git a/gcc/testsuite/objc.dg/zero-link-1.m b/gcc/testsuite/objc.dg/zero-link-1.m index 35cabfa..c040031 100644 --- a/gcc/testsuite/objc.dg/zero-link-1.m +++ b/gcc/testsuite/objc.dg/zero-link-1.m @@ -25,6 +25,7 @@ int main(void) { return 0; } -/* { dg-final { scan-assembler-not "_OBJC_CLASS_REFERENCES_0" } } */ +/* { dg-final { scan-assembler-not "_OBJC_ClassRefs_0" { target { *-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler-not "_OBJC_ClassRef_Base" { target { *-*-darwin* && { lp64 } } } } } */ /* { dg-final { scan-assembler "objc_getClass" } } */ diff --git a/gcc/testsuite/objc.dg/zero-link-2.m b/gcc/testsuite/objc.dg/zero-link-2.m index 443090a..ff82e5e 100644 --- a/gcc/testsuite/objc.dg/zero-link-2.m +++ b/gcc/testsuite/objc.dg/zero-link-2.m @@ -5,8 +5,7 @@ /* { 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(); @@ -25,5 +24,6 @@ int main(void) { return 0; } -/* { dg-final { scan-assembler "_OBJC_CLASS_REFERENCES_0" } } */ +/* { dg-final { scan-assembler "_OBJC_ClassRefs_0" { target { *-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler "_OBJC_ClassRef_Base" { target { *-*-darwin* && { lp64 } } } } } */ /* { dg-final { scan-assembler-not "objc_getClass" } } */ diff --git a/gcc/testsuite/objc/execute/accessing_ivars.m b/gcc/testsuite/objc/execute/accessing_ivars.m index dbde8cd..e4c9cf4 100644 --- a/gcc/testsuite/objc/execute/accessing_ivars.m +++ b/gcc/testsuite/objc/execute/accessing_ivars.m @@ -1,7 +1,9 @@ /* Contributed by Nicola Pero - Thu Mar 8 16:27:46 CET 2001 */ #include <stdlib.h> -#import "../../objc-obj-c++-shared/Object1.h" +#ifndef __NEXT_RUNTIME__ #include <objc/objc-api.h> +#endif +#include "../../objc-obj-c++-shared/Object1.h" /* Test that by using -> we can access ivars of other objects of the same class */ @@ -53,3 +55,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 c79c3ef..ca70c21 100644 --- a/gcc/testsuite/objc/execute/bf-common.h +++ b/gcc/testsuite/objc/execute/bf-common.h @@ -11,6 +11,7 @@ #define objc_get_class(C) objc_getClass(C) #endif +#ifndef __OBJC2__ void print_ivars (Class class) { struct objc_ivar_list* ivars = class->ivars; @@ -61,9 +62,11 @@ void compare_structures (Class class, const char* type) printf ("%d ivars checked\n", i); } +#endif int main () { +#ifndef __OBJC2__ struct class_vars { @defs (MyObject); @@ -80,8 +83,10 @@ int main () printf ("sizes don't match (computed %d, exact %d)\n", size1, size2); abort (); } +#endif exit (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-2.m b/gcc/testsuite/objc/execute/bycopy-2.m index 8e7f169..840881f 100644 --- a/gcc/testsuite/objc/execute/bycopy-2.m +++ b/gcc/testsuite/objc/execute/bycopy-2.m @@ -27,5 +27,4 @@ int main (void) exit (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 4c2bd27..15c49a5 100644 --- a/gcc/testsuite/objc/execute/bycopy-3.m +++ b/gcc/testsuite/objc/execute/bycopy-3.m @@ -24,6 +24,12 @@ extern int printf (const char *, ...); /* 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 @end @implementation MyObject @@ -31,6 +37,12 @@ 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, diff --git a/gcc/testsuite/objc/execute/class-tests-1.h b/gcc/testsuite/objc/execute/class-tests-1.h index ebc49b6..54a77d2 100644 --- a/gcc/testsuite/objc/execute/class-tests-1.h +++ b/gcc/testsuite/objc/execute/class-tests-1.h @@ -1,5 +1,6 @@ /* Contributed by Nicola Pero on Tue Mar 6 23:05:53 CET 2001 */ +#include <stdio.h> #include <stdlib.h> #include "../../objc-obj-c++-shared/Object1.h" #include <objc/objc.h> diff --git a/gcc/testsuite/objc/execute/class-tests-2.h b/gcc/testsuite/objc/execute/class-tests-2.h index cc14abb..1aa7394 100644 --- a/gcc/testsuite/objc/execute/class-tests-2.h +++ b/gcc/testsuite/objc/execute/class-tests-2.h @@ -1,6 +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> /* diff --git a/gcc/testsuite/objc/execute/compatibility_alias.m b/gcc/testsuite/objc/execute/compatibility_alias.m index b134f0c..61d7625 100644 --- a/gcc/testsuite/objc/execute/compatibility_alias.m +++ b/gcc/testsuite/objc/execute/compatibility_alias.m @@ -10,3 +10,4 @@ int main (void) return 0; } +#include "../../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc/execute/enumeration-1.m b/gcc/testsuite/objc/execute/enumeration-1.m index 1adcfd0..57d1a4b 100644 --- a/gcc/testsuite/objc/execute/enumeration-1.m +++ b/gcc/testsuite/objc/execute/enumeration-1.m @@ -48,3 +48,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 c47bb8a..3094963 100644 --- a/gcc/testsuite/objc/execute/enumeration-2.m +++ b/gcc/testsuite/objc/execute/enumeration-2.m @@ -50,3 +50,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 01eff92..2db40a8 100644 --- a/gcc/testsuite/objc/execute/exceptions/catchall-1.m +++ b/gcc/testsuite/objc/execute/exceptions/catchall-1.m @@ -74,3 +74,4 @@ int main (void) { test((Object *)-1); return 0; } +#import "../../../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc/execute/exceptions/exceptions.exp b/gcc/testsuite/objc/execute/exceptions/exceptions.exp index 173f656..0443ca1 100644 --- a/gcc/testsuite/objc/execute/exceptions/exceptions.exp +++ b/gcc/testsuite/objc/execute/exceptions/exceptions.exp @@ -28,6 +28,7 @@ lappend additional_flags "-fobjc-exceptions" # load support procs load_lib objc-torture.exp load_lib torture-options.exp +load_lib target-supports.exp torture-init objc-set-runtime-options "execute" "additional_flags=-fobjc-exceptions" diff --git a/gcc/testsuite/objc/execute/exceptions/finally-1.m b/gcc/testsuite/objc/execute/exceptions/finally-1.m index 5206c77..370b19b 100644 --- a/gcc/testsuite/objc/execute/exceptions/finally-1.m +++ b/gcc/testsuite/objc/execute/exceptions/finally-1.m @@ -1,6 +1,22 @@ #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 static int made_try = 0; @@ -57,3 +73,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 ae5d927..6b31d7c 100644 --- a/gcc/testsuite/objc/execute/exceptions/foward-1.m +++ b/gcc/testsuite/objc/execute/exceptions/foward-1.m @@ -2,12 +2,33 @@ /* Developed by Marcin Koziej <creep@desk.pl>. */ #include <stdlib.h> -#import "../../../objc-obj-c++-shared/Object1.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 static int i; -@interface Thrower : Object +__attribute__((objc_exception)) +@interface Thrower : Object - forward: (SEL) s : (void*) a; @end @@ -16,8 +37,10 @@ static int i; { i++; @throw [Object new]; + return nil; } @end + int main() { diff --git a/gcc/testsuite/objc/execute/exceptions/local-variables-1.m b/gcc/testsuite/objc/execute/exceptions/local-variables-1.m index fa419f9..0488d79 100644 --- a/gcc/testsuite/objc/execute/exceptions/local-variables-1.m +++ b/gcc/testsuite/objc/execute/exceptions/local-variables-1.m @@ -60,3 +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/formal_protocol-1.m b/gcc/testsuite/objc/execute/formal_protocol-1.m index a62def3..6514449 100644 --- a/gcc/testsuite/objc/execute/formal_protocol-1.m +++ b/gcc/testsuite/objc/execute/formal_protocol-1.m @@ -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 a0f7eec..b830cd9 100644 --- a/gcc/testsuite/objc/execute/formal_protocol-2.m +++ b/gcc/testsuite/objc/execute/formal_protocol-2.m @@ -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 c55773a..f28c95f 100644 --- a/gcc/testsuite/objc/execute/formal_protocol-3.m +++ b/gcc/testsuite/objc/execute/formal_protocol-3.m @@ -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 92f0521..10aba89 100644 --- a/gcc/testsuite/objc/execute/formal_protocol-4.m +++ b/gcc/testsuite/objc/execute/formal_protocol-4.m @@ -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 8bb63ec..c3bd53d 100644 --- a/gcc/testsuite/objc/execute/formal_protocol-5.m +++ b/gcc/testsuite/objc/execute/formal_protocol-5.m @@ -1,7 +1,8 @@ /* Contributed by Nicola Pero - Fri Mar 9 21:35:47 CET 2001 */ #include <stdlib.h> -#include "../../objc-obj-c++-shared/Protocol1.h" +#include <objc/Protocol.h> +#include "../../objc-obj-c++-shared/next-mapping.h" /* Test defining a protocol, and accessing it using @protocol */ @@ -35,4 +36,3 @@ int main (void) return 0; } - diff --git a/gcc/testsuite/objc/execute/formal_protocol-6.m b/gcc/testsuite/objc/execute/formal_protocol-6.m index dd42b37..b02fc1e 100644 --- a/gcc/testsuite/objc/execute/formal_protocol-6.m +++ b/gcc/testsuite/objc/execute/formal_protocol-6.m @@ -1,7 +1,8 @@ /* Contributed by Nicola Pero - Fri Mar 9 21:35:47 CET 2001 */ #include <stdlib.h> -#include "../../objc-obj-c++-shared/Protocol1.h" +#include <objc/Protocol.h> +#include "../../objc-obj-c++-shared/next-mapping.h" /* Test defining a protocol, and accessing it using @protocol */ diff --git a/gcc/testsuite/objc/execute/formal_protocol-7.m b/gcc/testsuite/objc/execute/formal_protocol-7.m index c4e1850..d15013a 100644 --- a/gcc/testsuite/objc/execute/formal_protocol-7.m +++ b/gcc/testsuite/objc/execute/formal_protocol-7.m @@ -41,4 +41,4 @@ int main (void) return 0; } - +#include "../../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc/execute/no_clash.m b/gcc/testsuite/objc/execute/no_clash.m index 9cb004d..d4ab4cb 100644 --- a/gcc/testsuite/objc/execute/no_clash.m +++ b/gcc/testsuite/objc/execute/no_clash.m @@ -39,3 +39,4 @@ int main (void) return 0; } +#include "../../objc-obj-c++-shared/Object1-implementation.h" diff --git a/gcc/testsuite/objc/execute/object_is_class.m b/gcc/testsuite/objc/execute/object_is_class.m index 199517e..14a7f52 100644 --- a/gcc/testsuite/objc/execute/object_is_class.m +++ b/gcc/testsuite/objc/execute/object_is_class.m @@ -1,8 +1,10 @@ /* Contributed by Nicola Pero - Tue Jul 3 10:55:21 BST 2001 */ -#import "../../objc-obj-c++-shared/next-mapping.h" -#import "../../objc-obj-c++-shared/Object1.h" -#include <objc/objc.h> -#include <objc/objc-api.h> +#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" /* This test demonstrate a failure in object_is_class which was fixed */ @@ -41,3 +43,4 @@ 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 d5aedca..91a628e 100644 --- a/gcc/testsuite/objc/execute/object_is_meta_class.m +++ b/gcc/testsuite/objc/execute/object_is_meta_class.m @@ -1,7 +1,10 @@ /* Contributed by Nicola Pero - Tue Jul 3 10:55:21 BST 2001 */ -#import "../../objc-obj-c++-shared/Object1.h" -#import "../../objc-obj-c++-shared/next-mapping.h" -#include <objc/objc-api.h> +#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" /* This test demonstrate a failure in object_is_meta_class which was fixed */ @@ -38,4 +41,4 @@ int main (void) return 0; } - +#include "../../objc-obj-c++-shared/Object1-implementation.h" |