diff options
27 files changed, 210 insertions, 110 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2388ed9..75f75de 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,37 @@ +2013-07-16 Iain Sandoe <iain@codesourcery.com> + + PR target/55654 + PR target/55656 + PR target/55657 + * obj-c++.dg/cxx-ivars-3.mm: Use NSObject instead of Object. + * obj-c++.dg/strings/const-cfstring-5.mm: Likewise. + * obj-c++.dg/torture/strings/const-str-10.mm: Likewise. + * obj-c++.dg/torture/strings/const-str-9.mm: Likewise. + * objc.dg/image-info.m: Likewise. + * objc.dg/symtab-1.m: Likewise. + * objc.dg/torture/strings/const-str-10.m: Likewise. + * objc.dg/torture/strings/const-str-11.m: Likewise. + * objc.dg/torture/strings/const-str-9.m: Likewise. + * objc.dg/zero-link-1.m: Likewise. + * objc.dg/zero-link-2.m: Likewise. + * objc.dg/no-extra-load.m: Avoid Foundation.h. + * objc.dg/objc-foreach-4.m: Likewise. + * objc.dg/objc-foreach-5.m: Likewise. + * obj-c++.dg/proto-lossage-7.mm: Use NSObject instead of Object + (for Darwin). + * obj-c++.dg/strings/const-str-12.mm: Likewise. + * obj-c++.dg/syntax-error-1.mm: Likewise. + * objc.dg/method-6.m: Likewise. + * objc.dg/pr23214.m: Likewise. + * objc.dg/proto-lossage-7.m: Likewise. + * objc.dg/strings/const-str-12b.m: Likewise. + * objc.dg/zero-link-3.m: Likewise. + * obj-c++.dg/method-12.mm: Skip on Darwin versions without 'Object'. + * objc.dg/encode-7-next-64bit.m: Use NSObject instead of Object, + adjust headers, interfaces and encoded types to reflect current system + versions. Add FIXME and outputs from current system compiler for + reference. + 2013-07-15 Cong Hou <congh@google.com> * gcc.target/i386/l_fma_float_1.c: Update the instruction to be 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 <objc/objc-runtime.h> #include <stdlib.h> +#include <Foundation/NSObject.h> + +//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 <zlaski@apple.com> */ /* { dg-options "-Wstrict-selector-match" } */ /* { dg-do compile } */ +/* { dg-skip-if "Object interface removed" { *-*-darwin[1-2]* && { lp64 } } { "-fnext-runtime" } { "" } } */ #include <objc/Protocol.h> @@ -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 <Foundation/NSObject.h> +#define OBJECT NSObject +#else #include <objc/Object.h> +#define OBJECT Object +#endif @protocol CanDoStuff; -typedef Object<CanDoStuff> CanDoStuffType; -typedef Object<CanDoStuff> *CanDoStuffTypePtr; +typedef OBJECT<CanDoStuff> CanDoStuffType; +typedef OBJECT<CanDoStuff> *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 <objc/Object.h> +#include <Foundation/NSObject.h> -@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 <Foundation/NSObject.h> +#define OBJECT NSObject +#else #include <objc/Object.h> +#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 <Foundation/NSObject.h> +#define OBJECT NSObject +#else #include <objc/Object.h> +#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 <objc/Object.h> +#include <Foundation/NSObject.h> #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 <objc/Object.h> +#include <Foundation/NSObject.h> #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 <objc/Object.h> +#include <Foundation/NSObject.h> #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 <stdbool.h> #include <string.h> #include <stdlib.h> -#include <objc/Object.h> +#include <Foundation/NSObject.h> #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 <objc/objc.h> -#include <objc/Object.h> +#include <Foundation/NSObject.h> 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 <Foundation/NSObject.h> +#define OBJECT NSObject +#else +#include <objc/Object.h> #include <objc/Protocol.h> +#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 <Foundation/Foundation.h> +#include <Foundation/NSObject.h> 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 <objc/objc-api.h> -#include <Foundation/Foundation.h> - -#if defined (__NEXT_RUNTIME__) && defined (__LP64__) -/* Fudge the class reference until we implement the compiler-side - const strings. */ -extern void *_NSConstantStringClassReference; -#endif +#include <Foundation/NSString.h> +#include <Foundation/NSAutoreleasePool.h> +#include <Foundation/NSArray.h> // 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 <Foundation/Foundation.h> +#include <Foundation/NSArray.h> +#include <Foundation/NSAutoreleasePool.h> 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 <objc/Protocol.h> - -@interface Object (TS_CAT) +#define OBJECT NSObject +#else +#include <objc/Object.h> +#define OBJECT Object +#include <objc/Protocol.h> +#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 <B> +@interface Dummy : OBJECT <B> @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 <Foundation/NSObject.h> +#define OBJECT NSObject +#else #include <objc/Object.h> +#define OBJECT Object +#endif @protocol CanDoStuff; -typedef Object<CanDoStuff> CanDoStuffType; -typedef Object<CanDoStuff> *CanDoStuffTypePtr; +typedef OBJECT<CanDoStuff> CanDoStuffType; +typedef OBJECT<CanDoStuff> *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 <objc/Object.h> +#include <Foundation/NSObject.h> -@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 <Foundation/NSObject.h> +#define OBJECT NSObject +#else #include <objc/Object.h> +#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 <objc/Object.h> +#include <Foundation/NSObject.h> -@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 <objc/Object.h> +#include <Foundation/NSObject.h> #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 <objc/Object.h> +#include <Foundation/NSObject.h> #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 <objc/Object.h> +#include <Foundation/NSObject.h> #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 <objc/Object.h> -#include <objc/objc.h> +#include <Foundation/NSObject.h> 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 <objc/Object.h> +#include <Foundation/NSObject.h> 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 <zlaski@apple.com>. */ /* { 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 <Foundation/NSObject.h> +#define OBJECT NSObject +#else #include <objc/Object.h> +#include <objc/Protocol.h> +#define OBJECT Object +#endif extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort(); -@interface Base: Object +@interface Base: OBJECT + (int) getValue; @end |