aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/objc/execute/exceptions/handler-1.m38
2 files changed, 43 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1940fe5..8198504 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-03-12 David Ayers <ayers@fsfe.org>
+
+ PR libobjc/27466
+ * objc/execute/exceptions/handler-1.m. New test.
+
2008-03-12 Jakub Jelinek <jakub@redhat.com>
PR target/39431
diff --git a/gcc/testsuite/objc/execute/exceptions/handler-1.m b/gcc/testsuite/objc/execute/exceptions/handler-1.m
new file mode 100644
index 0000000..9cd8df1
--- /dev/null
+++ b/gcc/testsuite/objc/execute/exceptions/handler-1.m
@@ -0,0 +1,38 @@
+/* Test custom exception handlers */
+/* Author: David Ayers */
+
+#include <objc/objc-api.h>
+#include <objc/Object.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static unsigned int handlerExpected = 0;
+
+void
+my_exception_handler(id excp)
+{
+ /* Returning from the handler would abort. */
+ if (handlerExpected)
+ exit(0);
+
+ abort();
+}
+
+int
+main(int argc, char *argv[])
+{
+ _objc_unexpected_exception = my_exception_handler;
+
+ @try
+ {
+ @throw [Object new];
+ }
+ @catch (id exc)
+ {
+ handlerExpected = 1;
+ }
+
+ @throw [Object new];
+ abort();
+ return 0;
+}