diff --git a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm index e94e6ec..0098349 100644 --- a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm +++ b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm @@ -2,12 +2,15 @@ // { dg-do run { target *-*-darwin* } } // { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } -// { dg-options "-fobjc-call-cxx-cdtors -mmacosx-version-min=10.4" } +// { dg-additional-options "-fobjc-call-cxx-cdtors -mmacosx-version-min=10.4 -framework Foundation" } // This test has no equivalent or meaning for m64/ABI V2 // { dg-xfail-run-if "No Test Avail" { *-*-darwin* && lp64 } { "-fnext-runtime" } { "" } } #include #include +#include + +//extern "C" { int printf(const char *,...); } #define CHECK_IF(expr) if(!(expr)) abort() #ifndef CLS_HAS_CXX_STRUCTORS @@ -19,7 +22,7 @@ struct cxx_struct { cxx_struct (void) { a = b = 55; } }; -@interface Foo { +@interface Foo: NSObject { int c; cxx_struct s; } @@ -42,9 +45,11 @@ int main (void) Class cls; cls = objc_getClass("Foo"); - CHECK_IF(cls->info & CLS_HAS_CXX_STRUCTORS); +// printf((const char *)"Foo info %lx\n",cls->info); + CHECK_IF((cls->info & CLS_HAS_CXX_STRUCTORS) != 0); cls = objc_getClass("Bar"); - CHECK_IF(!(cls->info & CLS_HAS_CXX_STRUCTORS)); +// printf((const char *)"Bar info %lx\n",cls->info); + CHECK_IF((cls->info & CLS_HAS_CXX_STRUCTORS) == 0); #else /* No test needed or available. */ diff --git a/gcc/testsuite/obj-c++.dg/method-12.mm b/gcc/testsuite/obj-c++.dg/method-12.mm index c1f2a39..6cdb0f9 100644 --- a/gcc/testsuite/obj-c++.dg/method-12.mm +++ b/gcc/testsuite/obj-c++.dg/method-12.mm @@ -2,6 +2,7 @@ /* Author: Ziemowit Laski */ /* { dg-options "-Wstrict-selector-match" } */ /* { dg-do compile } */ +/* { dg-skip-if "Object interface removed" { *-*-darwin[1-2]* && { lp64 } } { "-fnext-runtime" } { "" } } */ #include @@ -19,13 +20,13 @@ void foo(void) { Class receiver; [receiver port]; /* { dg-warning "multiple methods named .\\+port. found" } */ - /* { dg-message "using .\\-\\(unsigned( int)?\\)port." "" { target *-*-* } 9 } */ - /* { dg-message "also found .\\+\\(Protocol \\*\\)port." "" { target *-*-* } 14 } */ + /* { dg-message "using .\\-\\(unsigned( int)?\\)port." "" { target *-*-* } 10 } */ + /* { dg-message "also found .\\+\\(Protocol \\*\\)port." "" { target *-*-* } 15 } */ [receiver starboard]; /* { dg-warning "no .\\+starboard. method found" } */ - /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 25 } */ - /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 25 } */ - /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 25 } */ + /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 26 } */ + /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 26 } */ + /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 26 } */ [Class port]; /* { dg-error ".Class. is not an Objective\\-C class name or alias" } */ } diff --git a/gcc/testsuite/obj-c++.dg/proto-lossage-7.mm b/gcc/testsuite/obj-c++.dg/proto-lossage-7.mm index b7746d7..b32cfd8 100644 --- a/gcc/testsuite/obj-c++.dg/proto-lossage-7.mm +++ b/gcc/testsuite/obj-c++.dg/proto-lossage-7.mm @@ -1,12 +1,19 @@ /* Check that typedefs of ObjC classes preserve any @protocol qualifiers. */ /* { dg-do compile } */ + +#ifdef __NEXT_RUNTIME__ +#include +#define OBJECT NSObject +#else #include +#define OBJECT Object +#endif @protocol CanDoStuff; -typedef Object CanDoStuffType; -typedef Object *CanDoStuffTypePtr; +typedef OBJECT CanDoStuffType; +typedef OBJECT *CanDoStuffTypePtr; @protocol CanDoStuff - (int) dostuff; diff --git a/gcc/testsuite/obj-c++.dg/strings/const-cfstring-5.mm b/gcc/testsuite/obj-c++.dg/strings/const-cfstring-5.mm index 13cb789..98bb7c5 100644 --- a/gcc/testsuite/obj-c++.dg/strings/const-cfstring-5.mm +++ b/gcc/testsuite/obj-c++.dg/strings/const-cfstring-5.mm @@ -6,16 +6,16 @@ /* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mconstant-cfstrings" } */ -#include +#include -@interface Foo: Object { +@interface Foo: NSObject { char *cString; unsigned int len; } + (Foo *)description; @end -@interface Bar: Object +@interface Bar: NSObject + (Foo *) getString: (int) which; @end diff --git a/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm b/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm index 430ab5d..d0dfb66 100644 --- a/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm +++ b/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm @@ -5,17 +5,23 @@ /* { dg-options "-fconstant-string-class=Foo" } */ /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=Foo" { target *-*-darwin* } } */ +#ifdef __NEXT_RUNTIME__ +#include +#define OBJECT NSObject +#else #include +#define OBJECT Object +#endif #include "../../objc-obj-c++-shared/objc-test-suite-types.h" -@interface Foo: Object { +@interface Foo: OBJECT { char *cString; unsigned int len; } + (id)description; @end -@interface Bar: Object +@interface Bar: OBJECT + (Foo *) getString: (int) which; @end diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-1.mm b/gcc/testsuite/obj-c++.dg/syntax-error-1.mm index 13f3c27..1fe9ca3 100644 --- a/gcc/testsuite/obj-c++.dg/syntax-error-1.mm +++ b/gcc/testsuite/obj-c++.dg/syntax-error-1.mm @@ -1,7 +1,13 @@ /* Graceful handling of a syntax error. */ /* { dg-do compile } */ +#ifdef __NEXT_RUNTIME__ +#include +#define OBJECT NSObject +#else #include +#define OBJECT Object +#endif class foo { public: @@ -12,7 +18,7 @@ class foo { extern void NXLog(const char *, ...); -@interface Test2 : Object { +@interface Test2 : OBJECT { } - (void) foo2; @end @@ -23,4 +29,4 @@ extern void NXLog(const char *, ...); } /* { dg-error "stray .\}. between Objective\\-C\\+\\+ methods" } */ @end -/* { dg-error "expected constructor, destructor, or type conversion before" "" { target *-*-* } 22 } */ +/* { dg-error "expected constructor, destructor, or type conversion before" "" { target *-*-* } 28 } */ 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 cba188b..f2e912b 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 @@ -6,10 +6,10 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */ -#include +#include #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ -@interface NSString: Object +@interface NSString: NSObject @end @interface NSSimpleCString : NSString { 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 c54f89b..7e5d9b6 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 @@ -7,10 +7,10 @@ /* { dg-options "-fconstant-string-class=XStr" } */ /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=XStr" { target *-*-darwin* } } */ -#include +#include #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ -@interface XString: Object { +@interface XString: NSObject { @protected char *bytes; } 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 b4f15fd..d78dc73 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 @@ -5,10 +5,10 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */ -#include +#include #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ -@interface NSConstantString: Object { +@interface NSConstantString: NSObject { char *cString; unsigned int len; } diff --git a/gcc/testsuite/objc.dg/encode-7-next-64bit.m b/gcc/testsuite/objc.dg/encode-7-next-64bit.m index 20cd400..4a418fc 100644 --- a/gcc/testsuite/objc.dg/encode-7-next-64bit.m +++ b/gcc/testsuite/objc.dg/encode-7-next-64bit.m @@ -4,24 +4,25 @@ /* { dg-require-effective-target lp64 } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ +/* { dg-additional-options "-framework Foundation" } */ #include #include #include -#include +#include #include "../objc-obj-c++-shared/runtime.h" -#define CHECK_IF(E) if (!(E)) abort () +extern int printf(char *,...); +void CHECK_IF(const char *s1, const char *s2) +{ + if (strcmp(s1,s2) != 0) { + printf ("'%s'\n'%s'\n",s1,s2); + abort (); + } +} @class NSDictionary, NSFont, NSError, _NSATSTypesetterGuts, NSString, NSMenu, NSArray; -typedef unsigned char UInt8; -typedef const signed long OSStatus; -typedef unsigned long CFIndex; -typedef unsigned int UInt32; -typedef UInt32 FourCharCode; -typedef FourCharCode OSType; - struct FSRef { UInt8 hidden[80]; }; @@ -99,10 +100,10 @@ typedef struct { unsigned int parameterMask; } NSErrorUserInfoFormatter; -typedef Object MyObj; -typedef Object *MyPtr; +typedef NSObject MyObj; +typedef NSObject *MyPtr; -@interface Foo: Object { +@interface Foo: NSObject { NSATSGlyphStorageRun r; } - (NSError *)_errorWithOSStatus:(OSStatus)inOSStatus ref1:(const FSRef *)inRef1 ref2:(const struct FSRef *)inRef2 @@ -114,7 +115,7 @@ typedef Object *MyPtr; - (id)str1:(const char *)str1 str2:(char *)str2 str3:(char *const)str3 str4:(const char *const)str4; - (oneway void)foo1:(Foo *)foo1 foo2:(const Foo *)foo2 foo3:(Foo *const)foo3 foo4:(const Foo *const)foo4; - (in const char *)sel1:(const SEL)sel1 id1:(const id)id1; -- (inout id)obj1:(const MyPtr)obj1 obj2:(Object *const)obj2 obj3:(MyObj *const)obj3; +- (inout id)obj1:(const MyPtr)obj1 obj2:(NSObject *const)obj2 obj3:(MyObj *const)obj3; + (ComponentInstance)_defaultScriptingComponent; - (NSString *)_formatCocoaErrorString:(NSString *)formatString parameters:(const char *)parameters applicableFormatters:(NSErrorUserInfoFormatter **)formatters count:(int)numFormatters; @@ -156,7 +157,7 @@ NSRange globalRange; - (in const char *)sel1:(const SEL)sel1 id1:(const id)id1 { return "Hello"; } -- (inout id)obj1:(const MyPtr)obj1 obj2:(Object *const)obj2 obj3:(MyObj *const)obj3 { +- (inout id)obj1:(const MyPtr)obj1 obj2:(NSObject *const)obj2 obj3:(MyObj *const)obj3 { return self; } + (ComponentInstance)_defaultScriptingComponent { @@ -191,6 +192,8 @@ NSRange globalRange; } @end +/* FIXME: we produce different output c.f. the system compiler on OSX10.6+ */ + int main(void) { Class fooClass = objc_getClass ("Foo"); Method meth; @@ -199,72 +202,76 @@ int main(void) { Ivar ivar; meth = class_getInstanceMethod (fooClass, @selector(_errorWithOSStatus:ref1:ref2:reading:)); - CHECK_IF (!strcmp (method_getTypeEncoding(meth), "@44@0:8q16r^{FSRef=[80C]}24r^{FSRef=[80C]}32c40")); + CHECK_IF (method_getTypeEncoding(meth), "@40@0:8i16r^{FSRef=[80C]}20r^{FSRef=[80C]}28c36"); meth = class_getInstanceMethod (fooClass, @selector(_attributeRunForCharacterAtIndex:)); - CHECK_IF (!strcmp (method_getTypeEncoding (meth), "r^{?=@@QQ^Qffff{_NSRect={_NSPoint=ff}{_NSSize=ff}}q^qQ^Q@@@:::****{?=b1b1b1b1b1b27}}24@0:8Q16")); + CHECK_IF (method_getTypeEncoding (meth), "r^{?=@@qq^qffff{_NSRect={_NSPoint=ff}{_NSSize=ff}}q^qQ^Q@@@:::****{?=b1b1b1b1b1b27}}24@0:8q16"); +/* clang produces: r^{?=@@qq^qffff{_NSRect={_NSPoint=ff}{_NSSize=ff}}q^qQ^Q@@@::^{objc_selector}****{?=b1b1b1b1b1b27}}24@0:8q16 */ meth = class_getInstanceMethod (fooClass, @selector(_getATSTypesetterGuts:)); - CHECK_IF (!strcmp (method_getTypeEncoding (meth), "r@24@0:8r:16")); + CHECK_IF (method_getTypeEncoding (meth), "r@24@0:8r:16"); +/* "@24@0:8r^{objc_selector=}16" */ meth = class_getInstanceMethod (fooClass, @selector(resumeWithSuspensionID:and:)); - CHECK_IF (!strcmp (method_getTypeEncoding (meth), "v32@0:8^{__NSAppleEventManagerSuspension=}16r^Q24")); + CHECK_IF (method_getTypeEncoding (meth), "v32@0:8^{__NSAppleEventManagerSuspension=}16r^q24"); meth = class_getInstanceMethod (fooClass, @selector(anotherMeth:and:and:)); - CHECK_IF (!strcmp (method_getTypeEncoding (meth), "r@40@0:8r:16r@24r@32")); + CHECK_IF (method_getTypeEncoding (meth), "r@40@0:8r:16r@24r@32"); meth = class_getInstanceMethod (fooClass, @selector(str1:str2:str3:str4:)); - CHECK_IF (!strcmp (method_getTypeEncoding (meth), "@48@0:8r*16*24*32r*40")); + CHECK_IF (method_getTypeEncoding (meth), "@48@0:8r*16*24*32r*40"); meth = class_getInstanceMethod (fooClass, @selector(foo1:foo2:foo3:foo4:)); - CHECK_IF (!strcmp (method_getTypeEncoding (meth), "Vv48@0:8@16r@24@32r@40")); + CHECK_IF (method_getTypeEncoding (meth), "Vv48@0:8@16r@24@32r@40"); meth = class_getInstanceMethod (fooClass, @selector(sel1:id1:)); - CHECK_IF (!strcmp (method_getTypeEncoding (meth), "rn*32@0:8r:16r@24")); + CHECK_IF (method_getTypeEncoding (meth), "rn*32@0:8r:16r@24"); meth = class_getInstanceMethod (fooClass, @selector(obj1:obj2:obj3:)); - CHECK_IF (!strcmp (method_getTypeEncoding (meth), "N@40@0:8r@16@24^{Object=#}32")); + CHECK_IF (method_getTypeEncoding (meth), "N@40@0:8r@16@24^{NSObject=#}32"); meth = class_getClassMethod (fooClass, @selector(_defaultScriptingComponent)); - CHECK_IF (!strcmp (method_getTypeEncoding (meth), "^{ComponentInstanceRecord=[1q]}16@0:8")); + CHECK_IF (method_getTypeEncoding (meth), "^{ComponentInstanceRecord=[1q]}16@0:8"); meth = class_getInstanceMethod (fooClass, @selector(_formatCocoaErrorString:parameters:applicableFormatters:count:)); - CHECK_IF (!strcmp (method_getTypeEncoding (meth), "@44@0:8@16r*24^^{?}32i40")); + CHECK_IF (method_getTypeEncoding (meth), "@44@0:8@16r*24^^{?}32i40"); meth = class_getInstanceMethod (fooClass, @selector(formatter_func:run:)); - CHECK_IF (!strcmp (method_getTypeEncoding (meth), "^{?=^?@I}32@0:8@16r^^{?}24")); + CHECK_IF (method_getTypeEncoding (meth), "^{?=^?@I}32@0:8@16r^^{?}24"); meth = class_getInstanceMethod (fooClass, @selector(_forgetWord:inDictionary:)); - CHECK_IF (!strcmp (method_getTypeEncoding (meth), "c32@0:8nO@16nO@24")); + CHECK_IF (method_getTypeEncoding (meth), "c32@0:8nO@16nO@24"); meth = class_getInstanceMethod (fooClass, @selector(_registerServicesMenu:withSendTypes:andReturnTypes:addToList:)); - CHECK_IF (!strcmp (method_getTypeEncoding (meth), "v44@0:8@16r^*24r^*32c40")); + CHECK_IF (method_getTypeEncoding (meth), "v44@0:8@16r^*24r^*32c40"); meth = class_getClassMethod (fooClass, @selector(_proxySharePointer)); - CHECK_IF (!strcmp (method_getTypeEncoding (meth), "^^{__CFSet}16@0:8")); + CHECK_IF (method_getTypeEncoding (meth), "^^{__CFSet}16@0:8"); meth = class_getInstanceMethod (fooClass, @selector(_checkGrammarInString:language:details:)); - CHECK_IF (!strcmp (method_getTypeEncoding (meth), "{_NSRange=II}40@0:8n@16nO@24oO^@32")); + CHECK_IF (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 (method_getTypeEncoding (meth), "B60@0:8^{__CTLine=}16{_NSRect={_NSPoint=ff}{_NSSize=ff}}24f40f44f48^Q52")); + CHECK_IF (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 (method_getTypeEncoding (meth), "c40@0:8@16^I24^I32")); + CHECK_IF (method_getTypeEncoding (meth), "c40@0:8@16^I24^I32"); ivars = class_copyIvarList (fooClass, &ivar_count); - CHECK_IF (ivar_count == 1); + if (ivar_count != 1) { + abort (); + } ivar = ivars[0]; - CHECK_IF (!strcmp (ivar_getName(ivar), "r")); - CHECK_IF (!strcmp (ivar_getTypeEncoding(ivar), + CHECK_IF (ivar_getName(ivar), "r"); + CHECK_IF (ivar_getTypeEncoding(ivar), "{?=\"_attributes\"@\"NSDictionary\"\"_font\"@\"NSFont\"\"_characterLength\"" - "Q\"_nominalGlyphLocation\"Q\"p\"^Q\"_defaultLineHeight\"f\"_defaultBaselineOffset\"" + "q\"_nominalGlyphLocation\"q\"p\"^q\"_defaultLineHeight\"f\"_defaultBaselineOffset\"" "f\"_horizExpansion\"f\"_baselineDelta\"f\"_attachmentBBox\"{_NSRect=\"origin\"" "{_NSPoint=\"x\"f\"y\"f}\"size\"{_NSSize=\"width\"f\"height\"f}}\"ll\"q\"llp\"^q\"ull\"" "Q\"ullp\"^Q\"a\"@\"a1\"@\"a2\"@\"b\":\"b1\":\"b2\":\"str1\"*\"str2\"*\"str3\"*\"str4\"" "*\"_rFlags\"{?=\"_isAttachmentRun\"b1\"_hasPositionalStake\"b1\"_isDefaultFace\"" - "b1\"_hasCombiningMarks\"b1\"_isScreenFont\"b1\"_reserved\"b27}}")); - + "b1\"_hasCombiningMarks\"b1\"_isScreenFont\"b1\"_reserved\"b27}}"); +/*"{?=\"_attributes\"@\"NSDictionary\"\"_font\"@\"NSFont\"\"_characterLength\"q\"_nominalGlyphLocation\"q\"p\"^q\"_defaultLineHeight\"f\"_defaultBaselineOffset\"f\"_horizExpansion\"f\"_baselineDelta\"f\"_attachmentBBox\"{_NSRect=\"origin\"{_NSPoint=\"x\"f\"y\"f}\"size\"{_NSSize=\"width\"f\"height\"f}}\"ll\"q\"llp\"^q\"ull\"Q\"ullp\"^Q\"a\"@\"a1\"@\"a2\"@\"b\":\"b1\":\"b2\"^{objc_selector}\"str1\"*\"str2\"*\"str3\"*\"str4\"*\"_rFlags\"{?=\"_isAttachmentRun\"b1\"_hasPositionalStake\"b1\"_isDefaultFace\"b1\"_hasCombiningMarks\"b1\"_isScreenFont\"b1\"_reserved\"b27}}"*/ return 0; } diff --git a/gcc/testsuite/objc.dg/image-info.m b/gcc/testsuite/objc.dg/image-info.m index 194d366..0932913 100644 --- a/gcc/testsuite/objc.dg/image-info.m +++ b/gcc/testsuite/objc.dg/image-info.m @@ -7,20 +7,19 @@ /* { dg-skip-if "NeXT-only" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-freplace-objc-classes" } */ -#include -#include +#include extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort(); -@interface Object (TEST_SUITE_C1) +@interface NSObject (TEST_SUITE_C1) - init; @end -@implementation Object (TEST_SUITE_C1) +@implementation NSObject (TEST_SUITE_C1) - init {return self;} @end -@interface Base: Object { +@interface Base: NSObject { @public int a; float b; diff --git a/gcc/testsuite/objc.dg/method-6.m b/gcc/testsuite/objc.dg/method-6.m index 8d868d1..a14c14d 100644 --- a/gcc/testsuite/objc.dg/method-6.m +++ b/gcc/testsuite/objc.dg/method-6.m @@ -4,14 +4,21 @@ /* { dg-do compile } */ /* { dg-options "-Wstrict-selector-match" } */ +#ifdef __NEXT_RUNTIME__ +#include +#define OBJECT NSObject +#else +#include #include +#define OBJECT Object +#endif @interface Base - (unsigned)port; @end @interface Derived: Base -- (Object *)port; +- (OBJECT *)port; + (Protocol *)port; - (id)starboard; @end @@ -20,13 +27,13 @@ void foo(void) { Class receiver; [receiver port]; /* { dg-warning "multiple methods named .\\+port. found" } */ - /* { dg-message "using .\\-\\(unsigned( int)?\\)port." "" { target *-*-* } 10 } */ - /* { dg-message "also found .\\+\\(Protocol \\*\\)port." "" { target *-*-* } 15 } */ + /* { dg-message "using .\\-\\(unsigned( int)?\\)port." "" { target *-*-* } 17 } */ + /* { dg-message "also found .\\+\\(Protocol \\*\\)port." "" { target *-*-* } 22 } */ [receiver starboard]; /* { dg-warning "no .\\+starboard. method found" } */ - /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 26 } */ - /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 26 } */ - /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 26 } */ + /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 33 } */ + /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 33 } */ + /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 33 } */ [Class port]; /* { dg-error ".Class. is not an Objective\\-C class name or alias" } */ } diff --git a/gcc/testsuite/objc.dg/no-extra-load.m b/gcc/testsuite/objc.dg/no-extra-load.m index 7503535..f5e1d74 100644 --- a/gcc/testsuite/objc.dg/no-extra-load.m +++ b/gcc/testsuite/objc.dg/no-extra-load.m @@ -1,7 +1,7 @@ /* { dg-do compile { target *-*-darwin* } } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ -#import +#include main() { [NSObject new]; } /* { dg-final { scan-assembler-not "L_objc_msgSend\\\$non_lazy_ptr" } } */ diff --git a/gcc/testsuite/objc.dg/objc-foreach-4.m b/gcc/testsuite/objc.dg/objc-foreach-4.m index 292a908..4d902f5 100644 --- a/gcc/testsuite/objc.dg/objc-foreach-4.m +++ b/gcc/testsuite/objc.dg/objc-foreach-4.m @@ -1,17 +1,13 @@ /* Test for valid objc objects used in a for-each statement. */ /* FIXME: Run this test with the GNU runtime as well. */ -/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-do run { target *-*-darwin* } } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-skip-if "No NeXT fast enum. pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ +/* { dg-additional-options "-framework Foundation" { target { *-*-darwin* } } } */ -#include -#include - -#if defined (__NEXT_RUNTIME__) && defined (__LP64__) -/* Fudge the class reference until we implement the compiler-side - const strings. */ -extern void *_NSConstantStringClassReference; -#endif +#include +#include +#include // gcc -o foo foo.m -framework Foundation diff --git a/gcc/testsuite/objc.dg/objc-foreach-5.m b/gcc/testsuite/objc.dg/objc-foreach-5.m index cb15781..7113a7a 100644 --- a/gcc/testsuite/objc.dg/objc-foreach-5.m +++ b/gcc/testsuite/objc.dg/objc-foreach-5.m @@ -2,8 +2,10 @@ /* { dg-do compile { target *-*-darwin* } } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-skip-if "No NeXT fast enum. pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ +/* { dg-additional-options "-framework Foundation" { target { *-*-darwin* } } } */ -#import +#include +#include NSArray * createTestVictim(unsigned capacity) { NSMutableArray * arr = [[NSMutableArray alloc] initWithCapacity:capacity]; diff --git a/gcc/testsuite/objc.dg/pr23214.m b/gcc/testsuite/objc.dg/pr23214.m index cf2631c..341a283 100644 --- a/gcc/testsuite/objc.dg/pr23214.m +++ b/gcc/testsuite/objc.dg/pr23214.m @@ -3,14 +3,24 @@ /* { dg-do run } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ +/* { dg-additional-options "-framework Foundation" { target { { *-*-darwin* } && objc2 } } } */ +#if defined (__NEXT_RUNTIME__) && defined(__OBJC2__) \ + && defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) \ + && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1070 #include - -@interface Object (TS_CAT) +#define OBJECT NSObject +#else +#include +#define OBJECT Object +#include +#endif + +@interface OBJECT (TS_CAT) - test; @end -@implementation Object (TS_CAT) +@implementation OBJECT (TS_CAT) - test { return self; } @end @@ -20,7 +30,7 @@ @protocol B @end -@interface Dummy : Object +@interface Dummy : OBJECT @end int main () diff --git a/gcc/testsuite/objc.dg/proto-lossage-7.m b/gcc/testsuite/objc.dg/proto-lossage-7.m index b7746d7..b32cfd8 100644 --- a/gcc/testsuite/objc.dg/proto-lossage-7.m +++ b/gcc/testsuite/objc.dg/proto-lossage-7.m @@ -1,12 +1,19 @@ /* Check that typedefs of ObjC classes preserve any @protocol qualifiers. */ /* { dg-do compile } */ + +#ifdef __NEXT_RUNTIME__ +#include +#define OBJECT NSObject +#else #include +#define OBJECT Object +#endif @protocol CanDoStuff; -typedef Object CanDoStuffType; -typedef Object *CanDoStuffTypePtr; +typedef OBJECT CanDoStuffType; +typedef OBJECT *CanDoStuffTypePtr; @protocol CanDoStuff - (int) dostuff; diff --git a/gcc/testsuite/objc.dg/strings/const-cfstring-5.m b/gcc/testsuite/objc.dg/strings/const-cfstring-5.m index 13cb789..98bb7c5 100644 --- a/gcc/testsuite/objc.dg/strings/const-cfstring-5.m +++ b/gcc/testsuite/objc.dg/strings/const-cfstring-5.m @@ -6,16 +6,16 @@ /* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mconstant-cfstrings" } */ -#include +#include -@interface Foo: Object { +@interface Foo: NSObject { char *cString; unsigned int len; } + (Foo *)description; @end -@interface Bar: Object +@interface Bar: NSObject + (Foo *) getString: (int) which; @end diff --git a/gcc/testsuite/objc.dg/strings/const-str-12b.m b/gcc/testsuite/objc.dg/strings/const-str-12b.m index 430ab5d..d0dfb66 100644 --- a/gcc/testsuite/objc.dg/strings/const-str-12b.m +++ b/gcc/testsuite/objc.dg/strings/const-str-12b.m @@ -5,17 +5,23 @@ /* { dg-options "-fconstant-string-class=Foo" } */ /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=Foo" { target *-*-darwin* } } */ +#ifdef __NEXT_RUNTIME__ +#include +#define OBJECT NSObject +#else #include +#define OBJECT Object +#endif #include "../../objc-obj-c++-shared/objc-test-suite-types.h" -@interface Foo: Object { +@interface Foo: OBJECT { char *cString; unsigned int len; } + (id)description; @end -@interface Bar: Object +@interface Bar: OBJECT + (Foo *) getString: (int) which; @end diff --git a/gcc/testsuite/objc.dg/symtab-1.m b/gcc/testsuite/objc.dg/symtab-1.m index 936f8d4..04d747d 100644 --- a/gcc/testsuite/objc.dg/symtab-1.m +++ b/gcc/testsuite/objc.dg/symtab-1.m @@ -4,9 +4,9 @@ /* { dg-do compile { target { *-*-darwin* } } } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ -#include +#include -@interface Base: Object +@interface Base: NSObject - (void)setValues; @end 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 e35b83b..120bcd9 100644 --- a/gcc/testsuite/objc.dg/torture/strings/const-str-10.m +++ b/gcc/testsuite/objc.dg/torture/strings/const-str-10.m @@ -6,10 +6,10 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */ -#include +#include #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ -@interface NSString: Object +@interface NSString: NSObject @end @interface NSSimpleCString : NSString { 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 765f648..4c3f9ea 100644 --- a/gcc/testsuite/objc.dg/torture/strings/const-str-11.m +++ b/gcc/testsuite/objc.dg/torture/strings/const-str-11.m @@ -7,10 +7,10 @@ /* { dg-options "-fconstant-string-class=XStr" } */ /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=XStr" { target *-*-darwin* } } */ -#include +#include #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ -@interface XString: Object { +@interface XString: NSObject { @protected char *bytes; } 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 e69fb01..d65aa01 100644 --- a/gcc/testsuite/objc.dg/torture/strings/const-str-9.m +++ b/gcc/testsuite/objc.dg/torture/strings/const-str-9.m @@ -5,10 +5,10 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */ -#include +#include #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ -@interface NSConstantString: Object { +@interface NSConstantString: NSObject { char *cString; unsigned int len; } diff --git a/gcc/testsuite/objc.dg/zero-link-1.m b/gcc/testsuite/objc.dg/zero-link-1.m index 4917495..812267b 100644 --- a/gcc/testsuite/objc.dg/zero-link-1.m +++ b/gcc/testsuite/objc.dg/zero-link-1.m @@ -5,13 +5,12 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-fzero-link" } */ -#include -#include +#include extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort(); -@interface Base: Object +@interface Base: NSObject + (int) getValue; @end diff --git a/gcc/testsuite/objc.dg/zero-link-2.m b/gcc/testsuite/objc.dg/zero-link-2.m index ff82e5e..3bfe84d 100644 --- a/gcc/testsuite/objc.dg/zero-link-2.m +++ b/gcc/testsuite/objc.dg/zero-link-2.m @@ -5,12 +5,12 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-fno-zero-link" } */ -#include +#include extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort(); -@interface Base: Object +@interface Base: NSObject + (int) getValue; @end diff --git a/gcc/testsuite/objc.dg/zero-link-3.m b/gcc/testsuite/objc.dg/zero-link-3.m index 5da7422..18f21db 100644 --- a/gcc/testsuite/objc.dg/zero-link-3.m +++ b/gcc/testsuite/objc.dg/zero-link-3.m @@ -2,15 +2,23 @@ /* Contributed by Ziemowit Laski . */ /* { dg-do run { target *-*-darwin* } } */ -/* { dg-options "-fzero-link" } */ +/* { dg-additional-options "-fzero-link" } */ +/* { dg-additional-options "-framework Foundation" { target { *-*-darwin* } } } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ +#ifdef __NEXT_RUNTIME__ +#include +#define OBJECT NSObject +#else #include +#include +#define OBJECT Object +#endif extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort(); -@interface Base: Object +@interface Base: OBJECT + (int) getValue; @end