aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Ayers <d.ayers@inode.at>2005-10-21 23:27:08 +0200
committerDavid Ayers <ayers@gcc.gnu.org>2005-10-21 21:27:08 +0000
commit9cd470742f356c4898b56bfca15f84c569701ce6 (patch)
tree6d8886dafe4c87964c07d3b3da9e3f156d496943
parentc7ba5f8dff6d2607cf0b6822f89997fdc7e8f1ee (diff)
downloadgcc-9cd470742f356c4898b56bfca15f84c569701ce6.zip
gcc-9cd470742f356c4898b56bfca15f84c569701ce6.tar.gz
gcc-9cd470742f356c4898b56bfca15f84c569701ce6.tar.bz2
except-1.mm: Generalize for both Objective-C runtimes.
2005-10-21 David Ayers <d.ayers@inode.at> * obj-c++.dg/except-1.mm: Generalize for both Objective-C runtimes. From-SVN: r105770
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/obj-c++.dg/except-1.mm46
2 files changed, 46 insertions, 4 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 741fb74..8b7ea12 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2005-10-21 David Ayers <d.ayers@inode.at>
+
+ * obj-c++.dg/except-1.mm: Generalize for both Objective-C runtimes.
+
2005-10-21 Jakub Jelinek <jakub@redhat.com>
* gfortran.dg/assumed_dummy_2.f90: New test.
diff --git a/gcc/testsuite/obj-c++.dg/except-1.mm b/gcc/testsuite/obj-c++.dg/except-1.mm
index 79eaf12..d92ac79 100644
--- a/gcc/testsuite/obj-c++.dg/except-1.mm
+++ b/gcc/testsuite/obj-c++.dg/except-1.mm
@@ -1,5 +1,4 @@
-/* { dg-do run { target "*-*-darwin*" } } */
-/* { dg-options "-framework Foundation" } */
+/* { dg-do run } */
/* This tests that exceptions work. It used to fail because
objc_msgSend was marked with DECL_NOTHROW.
@@ -7,12 +6,30 @@
that file includes objc/objc-runtime.h which explicitly prototypes
objc_msgSend without 'nothrow'. */
-#include <Foundation/Foundation.h>
#include <stdio.h>
#include <stdlib.h>
+#ifndef __NEXT_RUNTIME__
+extern "C" {
+ extern id class_create_instance(Class _class);
+}
+#else
+extern "C" {
+ extern id (*_zoneAlloc)(Class, unsigned int, void *);
+ extern void *malloc_default_zone(void);
+}
+#endif
+
+@interface RObject {
+ Class isa;
+}
++ initialize;
++ alloc;
+- init;
+@end
+
// ObjectiveC class header
-@interface ObjCclass : NSObject {
+@interface ObjCclass : RObject {
}
-(void)method1;
-(void)method2;
@@ -63,3 +80,24 @@ void CPPclass::function1()
/* Shouldn't be here because we threw. */
abort ();
}
+
+@implementation RObject
++ initialize
+{
+ return self;
+}
+
+- init
+{
+ return self;
+}
+
++ alloc
+{
+#ifndef __NEXT_RUNTIME__
+ return class_create_instance(self);
+#else
+ return (*_zoneAlloc)((Class)self, 0, malloc_default_zone());
+#endif
+}
+@end