]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
NeXT runtime compatibility changes.
authorIain Sandoe <iains@gcc.gnu.org>
Fri, 5 Nov 2010 10:03:54 +0000 (10:03 +0000)
committerIain Sandoe <iains@gcc.gnu.org>
Fri, 5 Nov 2010 10:03:54 +0000 (10:03 +0000)
gcc/testsuite:

* objc.dg/torture/forward-1.m: Restore for m32 NeXT.
* objc.dg/demangle-1.m: Remove NeXT ifdef around +initialize
declaration and implementation.
* objc.dg/property/dotsyntax-3.m: XFAIL NeXT m64 run.
* obj-c++.dg/property/at-property-13.mm: Likewise.
* obj-c++.dg/property/fsf-property-method-access.mm: Likewise.
* obj-c++.dg/property/property-1.mm: Likewise.
* obj-c++.dg/property/at-property-7.mm: Likewise.
* obj-c++.dg/property/at-property-9.mm: Likewise.
* obj-c++.dg/property/dotsyntax-2.mm: Likewise.
* obj-c++.dg/property/at-property-10.mm: Likewise.
* obj-c++.dg/property/synthesize-2.mm: Likewise.
* obj-c++.dg/property/at-property-12.mm: Likewise.
* obj-c++.dg/property/fsf-property-basic.mm: Likewise.
* obj-c++.dg/property/fsf-property-named-ivar.mm: Likewise.
* obj-c++.dg/property/at-property-6.mm: Likewise.
* obj-c++.dg/property/at-property-8.mm: Likewise.
* obj-c++.dg/property/dotsyntax-1.mm: Likewise.
* obj-c++.dg/property/dotsyntax-3.mm: Likewise.
* obj-c++.dg/property/at-property-11.mm: Likewise.
* obj-c++.dg/template-8.mm: Likewise.
* obj-c++.dg/encode-3.mm: Use abort (), cast char types.
* obj-c++.dg/demangle-2.mm: Add +initialize:, XFAIL NeXT m64.
* obj-c++.dg/property/at-property-2.mm: Comment out a case that ICEs and
put a FIXME for this.
* obj-c++.dg/property/property-2.mm: Remove.
* obj-c++.dg/property/property-3.mm: Remove.

From-SVN: r166352

26 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/obj-c++.dg/demangle-2.mm
gcc/testsuite/obj-c++.dg/encode-3.mm
gcc/testsuite/obj-c++.dg/property/at-property-10.mm
gcc/testsuite/obj-c++.dg/property/at-property-11.mm
gcc/testsuite/obj-c++.dg/property/at-property-12.mm
gcc/testsuite/obj-c++.dg/property/at-property-13.mm
gcc/testsuite/obj-c++.dg/property/at-property-2.mm
gcc/testsuite/obj-c++.dg/property/at-property-6.mm
gcc/testsuite/obj-c++.dg/property/at-property-7.mm
gcc/testsuite/obj-c++.dg/property/at-property-8.mm
gcc/testsuite/obj-c++.dg/property/at-property-9.mm
gcc/testsuite/obj-c++.dg/property/dotsyntax-1.mm
gcc/testsuite/obj-c++.dg/property/dotsyntax-2.mm
gcc/testsuite/obj-c++.dg/property/dotsyntax-3.mm
gcc/testsuite/obj-c++.dg/property/fsf-property-basic.mm
gcc/testsuite/obj-c++.dg/property/fsf-property-method-access.mm
gcc/testsuite/obj-c++.dg/property/fsf-property-named-ivar.mm
gcc/testsuite/obj-c++.dg/property/property-1.mm
gcc/testsuite/obj-c++.dg/property/property-2.mm [deleted file]
gcc/testsuite/obj-c++.dg/property/property-3.mm [deleted file]
gcc/testsuite/obj-c++.dg/property/synthesize-2.mm
gcc/testsuite/obj-c++.dg/template-8.mm
gcc/testsuite/objc.dg/demangle-1.m
gcc/testsuite/objc.dg/property/dotsyntax-3.m
gcc/testsuite/objc.dg/torture/forward-1.m [new file with mode: 0644]

index 6ef03bdac94f313971216dab1a6af2ad81289557..2041a7a762047f906fb3284853107167111e5ea8 100644 (file)
@@ -1,3 +1,33 @@
+2010-11-05  Iain Sandoe  <iains@gcc.gnu.org>
+
+       * objc.dg/torture/forward-1.m: Restore for m32 NeXT.
+       * objc.dg/demangle-1.m: Remove NeXT ifdef around +initialize 
+       declaration and implementation.
+       * objc.dg/property/dotsyntax-3.m: XFAIL NeXT m64 run.
+       * obj-c++.dg/property/at-property-13.mm: Likewise.
+       * obj-c++.dg/property/fsf-property-method-access.mm: Likewise.
+       * obj-c++.dg/property/property-1.mm: Likewise.
+       * obj-c++.dg/property/at-property-7.mm: Likewise.
+       * obj-c++.dg/property/at-property-9.mm: Likewise.
+       * obj-c++.dg/property/dotsyntax-2.mm: Likewise.
+       * obj-c++.dg/property/at-property-10.mm: Likewise.
+       * obj-c++.dg/property/synthesize-2.mm: Likewise.
+       * obj-c++.dg/property/at-property-12.mm: Likewise.
+       * obj-c++.dg/property/fsf-property-basic.mm: Likewise.
+       * obj-c++.dg/property/fsf-property-named-ivar.mm: Likewise.
+       * obj-c++.dg/property/at-property-6.mm: Likewise.
+       * obj-c++.dg/property/at-property-8.mm: Likewise.
+       * obj-c++.dg/property/dotsyntax-1.mm: Likewise.
+       * obj-c++.dg/property/dotsyntax-3.mm: Likewise.
+       * obj-c++.dg/property/at-property-11.mm: Likewise.
+       * obj-c++.dg/template-8.mm: Likewise.
+       * obj-c++.dg/encode-3.mm: Use abort (), cast char types.
+       * obj-c++.dg/demangle-2.mm: Add +initialize:, XFAIL NeXT m64.
+       * obj-c++.dg/property/at-property-2.mm: Comment out a case that ICEs and
+       put a FIXME for this.
+       * obj-c++.dg/property/property-2.mm: Remove.
+       * obj-c++.dg/property/property-3.mm: Remove.
+
 2010-11-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/46307
        * objc.dg/encode-7-next.m: Use next-mapping.h, ignore deprecation 
        warnings.
        * objc.dg/encode-7-next-64bit.m: Use next-mapping.h, ignore 
-       deprecation warnings.  Use Object1 implemenation.
+       deprecation warnings.  Use Object1 implementation.
        * objc.dg/demangle-1.m: Provide +initialize.  XFAIL m64 NeXT run.
-       * objc/execute/forward-1.m: Move to objc.dg/torture and reduce scope
-       to m32 NeXT.
+       * objc/execute/forward-1.m: Remove.
        * objc/execute/forward-1.x: Remove.
        
 2010-11-04  Jason Merrill  <jason@redhat.com>
index c58a4f8ce4fc075a2943636b0fd39ad10704b982..f28208591372a443f155e09f40ffff15498c4871 100644 (file)
@@ -1,5 +1,6 @@
 /* Test demangling an Objective-C method.  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 #include <cstring>
 #include <cstdlib>
@@ -13,6 +14,7 @@
 + (int) testFunction1;
 + (int) test_function2;
 + (int) __testFunction3: (int)unused  andArgument: (char)unused2;
++ (id) initialize;
 @end
 
 @implementation DemangleTest
@@ -31,6 +33,7 @@
   std::cout << __PRETTY_FUNCTION__ << "\n";
   return std::strcmp (__PRETTY_FUNCTION__, "+[DemangleTest __testFunction3:andArgument:]");
 }
++ (id) initialize { return self; }
 @end
 
 int main ()
index 8627a773e254e2e7882bb48172d045892ffc11c5..44f288d7de09d9a17f8c67159c1e8da0794eefd1 100644 (file)
@@ -1,8 +1,8 @@
 /* { dg-do run } */
 
 extern "C" {
-extern void _exit(int);
-extern int strcmp(const char *, const char *);
+extern void abort (void);
+extern int strcmp (const char *, const char *);
 }
 
 template <class T>
@@ -36,16 +36,16 @@ int main(void) {
   const char *encode = @encode(long);
 
   if (strcmp (encode, L))
-    _exit(-(__LINE__));
+    abort ();
 
-  if (strcmp (enc, "{Vec<float>=ff" L "q}"))
-    _exit(-(__LINE__));
+  if (strcmp (enc, (const char *)"{Vec<float>=ff" L "q}"))
+    abort ();
 
-  if (strcmp (enc2, "{Vec<double>=dd" L "q}"))
-    _exit(-(__LINE__));
+  if (strcmp (enc2, (const char *)"{Vec<double>=dd" L "q}"))
+    abort ();
 
-  if (strcmp (enc3, "{?=f[10d]i" L "q{Vec<const signed char>=rcrc" L "q}}"))
-    _exit(-(__LINE__));
+  if (strcmp (enc3, (const char *)"{?=f[10d]i" L "q{Vec<const signed char>=rcrc" L "q}}"))
+    abort ();
 
   return 0;
 }
index 83494ec3bccd1a6d291a43e91d7ab6a1889d0543..b867896f8b547719326eb172da30adcbeb97f349 100644 (file)
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 /* Test the property syntax in a number of expressions.  */
 
index 82880521680d0c3cca6c622767f9f24e24f8f8ca..51c402346470ed2901018bf57dc9cf2b450e9703 100644 (file)
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 /* Test that properties are found even if implemented in superclasses.  */
 
index 8d28bde966847ce8826ebd1bab09b6dbd2c4ea3d..89001e73b85af93f5854605c3f57841e84d092e4 100644 (file)
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 /* Test atomic, assign synthesized methods.  */
 
index 5a5dcbbf63ce937b6d2ea84eaa63d73586640084..6786c3aa857960cde6cbb1bdf00dd866aa6a4a2c 100644 (file)
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 /* Test retain and copy synthesized methods.  */
 
index a97c33ea87457cc0c55751e40445b11aa420c01d..7966b9a44d0f7b57150618941e370a8216b849dd 100644 (file)
@@ -8,6 +8,7 @@
 }
 @property int name __attribute__((deprecated));
 @property int table __attribute__((xxx));       /* { dg-warning ".xxx. attribute directive ignored" } */
-@property void function (void);                 /* { dg-error "can.t make .function. into a method" } */
-@property typedef int j;                        /* { dg-error "invalid type for property" } */
+/* FIXME: the test below should not ICE.
+@property void function (void);                  { dg-error "can.t make .function. into a method" } */
+@property typedef int j;                        /*  { dg-error "invalid type for property" } */
 @end
index 8b7346b95af70a3739823c184341ce2f651af372..f2e2044cc3ba313deb6e8e53689a7893511eda3a 100644 (file)
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 /* Test the property syntax with non-synthesized setter/getter
    and with standard names.  */
index bace2420e57e7ca0dfcc6d84c31bccacddc311e7..dc8e90fc3b973e4dfd53aba7ee76264dc67858c1 100644 (file)
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 /* Test the property syntax with non-synthesized setter/getter
    and with a non-standard name for the getter.  */
index a290dd3df35c14c3120d291379c9da212955eac3..f404165675251bd4738d5d2a29188ca2c412e7de 100644 (file)
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 /* Test the property syntax with non-synthesized setter/getter
    and with a non-standard name for the setter.  */
index be52e37f5d068fc9aeecb208a1c8ccaedc04be57..4b2b64d3f04239d141324636e1af1a9b561bcf31 100644 (file)
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 /* Test the property syntax with synthesized setter/getter
    and with a non-standard name for the getter and setter.  */
index 8bc3b3a595750d64c9187a74a2e18acbf2a9d952..8922f5f03404c87491ffd5ab65836a1a215f43f0 100644 (file)
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 /* Test the 'dot syntax' without a declarated property.  */
 
index ba615a318257274e9826ede1d77b65fb3b91167d..03e49aebc5279b6536b2f150ca80b6b4cc977769 100644 (file)
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 /* Test the 'dot syntax' without a declarated property.  This tests the case where
    only the setter (or only the getter) exists.  */
index 5991962b921af17e1fe6359199b107d533a5f0ae..d3478062882cb1f9b6ee455a2c0a588d2bb01e56 100644 (file)
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 /* Test the 'dot syntax' without a declarated property.  This tests the case where
    the object is a Class.  */
index e7f8cbb7730ea7642c83f51d6c5f7d36f02efaf2..2c3774a9324cb800921466289972bfff2bb7747c 100644 (file)
@@ -1,5 +1,6 @@
 /* Basic test, auto-generated getter/setter based on property name.  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 #ifdef __cplusplus
 extern "C" {
index 8053c84f9f775beb5412b5cc06fa784fe94f3b68..11efb4af0ffb9b388f34f518439019680d64bdd7 100644 (file)
@@ -1,5 +1,6 @@
 /* test access in methods, auto-generated getter/setter based on property name.  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 #ifdef __cplusplus
 extern "C" {
index 8538a1f5601a6ddaebc259f960c89a54f6331c79..d29f43106576945bf33191f5153486ab91d204f7 100644 (file)
@@ -1,5 +1,6 @@
 /* Basic test, auto-generated getter/setter based on named ivar  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 #ifdef __cplusplus
 extern "C" {
index b89d34bf2a424e704cd7d8e7081546c390372bae..4447946d1ab5343ba5be693e4af31d9e24a075da 100644 (file)
@@ -1,5 +1,6 @@
 /* This program tests use of property provided setter/getter functions. */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 /* { dg-additional-sources "../../objc-obj-c++-shared/Object1.mm" } */
 
 #import "../../objc-obj-c++-shared/Object1.h"
diff --git a/gcc/testsuite/obj-c++.dg/property/property-2.mm b/gcc/testsuite/obj-c++.dg/property/property-2.mm
deleted file mode 100644 (file)
index 5d55b40..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/* { dg-do run { target *-*-darwin* } } */
-/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
-/* We can't do this yet on m64, since we have not got the NSConstantString implementation
-   built-in to the compiler, and therefore we get missing implementation warnings.  */
-/* { dg-require-effective-target ilp32 } */
-/* Force ABI = 0 in the NeXT headers, also suppress deprecation warnings.  */
-/* { dg-options "-framework Foundation -fobjc-exceptions -mmacosx-version-min=10.4 -Wno-deprecated-declarations" } */
-
-#include <objc/objc-api.h>
-#include <Foundation/Foundation.h>
-
-@interface Person : NSObject
-@property NSString *firstName, *lastName;
-@property(readonly) NSString *fullName;
-@end
-
-@interface Group : NSObject
-@property Person *techLead, *runtimeGuru, *propertiesMaven;
-@end
-
-@implementation Group
-@property Person *techLead, *runtimeGuru, *propertiesMaven;
-- init {
-  techLead = [[Person alloc] init];
-  runtimeGuru = [[Person alloc] init];
-  propertiesMaven = [[Person alloc] init];
-  return self;
-}
-@end
-
-@implementation Person
-@property NSString *firstName, *lastName;
-@property(readonly) NSString *fullName;
-- (NSString*)fullName { // computed getter
-    return [NSString stringWithFormat:@"%@ %@", firstName, lastName];
-}
-@end
-
-NSString *playWithProperties()
-{
-  Group *g = [[Group alloc] init] ;
-
-  g.techLead.firstName = @"Blaine";
-  g.techLead.lastName = @"Garst";
-  g.runtimeGuru.firstName = @"Greg";
-  g.runtimeGuru.lastName = @"Parker";
-  g.propertiesMaven.firstName = @"Patrick";
-  g.propertiesMaven.lastName = @"Beard";
-
-  return [NSString stringWithFormat:@"techlead %@ runtimeGuru %@ propertiesMaven %@",
-                        g.techLead.fullName, g.runtimeGuru.fullName, g.propertiesMaven.fullName];
-}
-
-main()
-{
-    char buf [256];
-    NSAutoreleasePool* pool  = [[NSAutoreleasePool alloc] init];
-    sprintf(buf, "%s", [playWithProperties() cString]);
-    [pool release];
-    return strcmp (buf, "techlead Blaine Garst runtimeGuru Greg Parker propertiesMaven Patrick Beard");
-}
-
diff --git a/gcc/testsuite/obj-c++.dg/property/property-3.mm b/gcc/testsuite/obj-c++.dg/property/property-3.mm
deleted file mode 100644 (file)
index 5a83263..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/* This program tests use of properties . */
-/* { dg-do run { target *-*-darwin* } } */
-/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
-/* We can't do this yet on m64, since we have not got the NSConstantString implementation
-   built-in to the compiler, and therefore we get missing implementation warnings.  */
-/* { dg-require-effective-target ilp32 } */
-/* Force ABI = 0 in the NeXT headers, also suppress deprecation warnings.  */
-/* { dg-options "-framework Foundation -fobjc-exceptions -mmacosx-version-min=10.4 -Wno-deprecated-declarations" } */
-
-#include <objc/objc-api.h>
-#include <Foundation/Foundation.h>
-
-@interface Person : NSObject
-{
-}
-@property NSString *firstName, *lastName;
-@property(readonly) NSString *fullName;
-
-@end
-
-@interface Group : NSObject
-{
-}
-
-@property Person *techLead, *runtimeGuru, *propertiesMaven;
-
-@end
-
-@implementation Group
-
-@property Person *techLead, *runtimeGuru, *propertiesMaven;
-- init {
-  techLead = [[Person alloc] init];
-  runtimeGuru = [[Person alloc] init];
-  propertiesMaven = [[Person alloc] init];
-  return self;
-}
-
-@end
-
-@implementation Person
-
-@property NSString *firstName, *lastName;
-@property(readonly, getter = fullName) NSString *fullName;
-
-- (NSString*)fullName { // computed getter
-    return [NSString stringWithFormat:@"%@ %@", firstName, lastName];
-}
-
-@end
-
-NSString *playWithProperties()
-{
-  Group *g = [[Group alloc] init] ;
-
-  g.techLead.firstName = @"Blaine";
-  g.techLead.lastName = @"Garst";
-  g.runtimeGuru.firstName = @"Greg";
-  g.runtimeGuru.lastName = @"Parker";
-  g.propertiesMaven.firstName = @"Patrick";
-  g.propertiesMaven.lastName = @"Beard";
-
-  return [NSString stringWithFormat:@"techlead %@ runtimeGuru %@ propertiesMaven %@",
-                        g.techLead.fullName, g.runtimeGuru.fullName, g.propertiesMaven.fullName];
-}
-
-main()
-{
-    char buf [256];
-    NSAutoreleasePool* pool  = [[NSAutoreleasePool alloc] init];
-    sprintf(buf, "%s", [playWithProperties() cString]);
-    [pool release];
-    return strcmp (buf, "techlead Blaine Garst runtimeGuru Greg Parker propertiesMaven Patrick Beard");
-}
-
index dfa3fd576a56de38c96978ee9e19d778d02cdf9f..b14fe264abe98d50f3eafd1118e6254b8278eade 100644 (file)
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 #include <objc/objc.h>
 #include <objc/runtime.h>
index eb01aa8471011b3f2df91188e241ae9a0fe7ff14..97bdb7fb000dbb2e27eb08a8fb68b49a05fa50a4 100644 (file)
@@ -3,18 +3,21 @@
 /* Author: Fariborz Jahanian <fjahanian@apple.com> */
 /* Adapted by Nicola Pero <nicola.pero@meta-innovation.com> */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 #include <objc/objc.h>
 #include <objc/runtime.h>
 
 @interface MyRootClass
 { Class isa; }
++ (id) initialize;
 + alloc;
 - init;
 - doSomething;
 @end
 
 @implementation MyRootClass
++ (id) initialize { return self; }
 + alloc { return class_createInstance (self, 0); }
 - init  { return self; }
 - doSomething { return self; }
index f790c56ca6afdbb49ead2e0235978ecad0b4adbc..42b79a9eb0a48b83cd36fcad4f0d6e7c1bd8fa20 100644 (file)
 {
   Class isa;
 }
++ (id) initialize;
 + (int) testFunction1;
 + (int) test_function2;
 + (int) __testFunction3: (int)unused  andArgument: (char)unused2;
-#ifdef __NEXT_RUNTIME__
-+ (id) initialize ;
-#endif
 @end
 
 @implementation DemangleTest
++ (id) initialize { return self; }
 + (int) testFunction1
 {
   printf ("%s\n", __PRETTY_FUNCTION__);
@@ -41,9 +40,6 @@
   printf ("%s\n", __PRETTY_FUNCTION__);
   return strcmp (__PRETTY_FUNCTION__, "+[DemangleTest __testFunction3:andArgument:]");
 }
-#ifdef __NEXT_RUNTIME__
-+ (id) initialize { return self; }
-#endif
 @end
 
 int main ()
index 5991962b921af17e1fe6359199b107d533a5f0ae..d3478062882cb1f9b6ee455a2c0a588d2bb01e56 100644 (file)
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
 /* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 /* Test the 'dot syntax' without a declarated property.  This tests the case where
    the object is a Class.  */
diff --git a/gcc/testsuite/objc.dg/torture/forward-1.m b/gcc/testsuite/objc.dg/torture/forward-1.m
new file mode 100644 (file)
index 0000000..086d69e
--- /dev/null
@@ -0,0 +1,83 @@
+/* { dg-do run } */
+/* See if -forward::/-performv:: is able to work. */
+/* { dg-skip-if "PR36610" { *-*-* } { "-fgnu-runtime" } { "" } } */
+/* { dg-skip-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+
+#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>
+
+#define VALUETOUSE 1234567890
+
+id forwarder, receiver;
+
+@interface Forwarder: Object
+{
+    id receiver;
+}
+
+-initWithReceiver:theReceiver;
+
+@end
+
+@interface Receiver:Object
+{
+    int foo;
+}
+-display;
+-initWithFoo:(int)theFoo;
+@end
+@implementation Receiver
+
+-initWithFoo: (int)theFoo
+{
+    foo = theFoo;
+    return self;
+}
+
+-display
+{
+    /* Check to see if we are really the reciever. */
+    if (self != receiver)
+        abort ();
+    /* And the value of foo is set correctly. */
+    if (foo != VALUETOUSE)
+      abort ();
+    return self;
+}
+
+@end
+
+@implementation Forwarder
+-initWithReceiver: theReceiver
+{
+    [super init];
+    receiver = theReceiver;
+    return self;
+}
+#ifdef __NEXT_RUNTIME__
+- forward: (SEL)theSel: (marg_list)theArgFrame
+#else
+-(retval_t) forward: (SEL)theSel: (arglist_t)theArgFrame
+#endif
+{
+  /* If we have a reciever try to perform on that object */
+    if (receiver)
+        return [receiver performv: theSel: theArgFrame];
+    return [self doesNotRecognize:theSel];
+}
+@end
+int main()
+{
+    /* Init the reciever. */
+    receiver = [[Receiver alloc] initWithFoo: VALUETOUSE];
+    /* Init the fowarder. */
+    forwarder = [[Forwarder alloc] initWithReceiver: receiver];
+    /* Call display on the forwarder which in turns calls display on
+       the reciever. */
+    [forwarder display];
+    exit(0);
+}