diff options
author | David Ayers <ayers@gcc.gnu.org> | 2009-03-12 22:28:15 +0000 |
---|---|---|
committer | David Ayers <ayers@gcc.gnu.org> | 2009-03-12 22:28:15 +0000 |
commit | faef499bdf0a88f9ec9d3282728ee081f12b8cb4 (patch) | |
tree | 53acb0e9cd94a0ada09c499da8ecc1b24cdba655 /gcc | |
parent | 03a181983d217bfc13d295e698edc1eae0e8dacd (diff) | |
download | gcc-faef499bdf0a88f9ec9d3282728ee081f12b8cb4.zip gcc-faef499bdf0a88f9ec9d3282728ee081f12b8cb4.tar.gz gcc-faef499bdf0a88f9ec9d3282728ee081f12b8cb4.tar.bz2 |
re PR libobjc/27466 (RFE: Support for libobjc equivalent of std::set_unexpected)
libobjc/
2009-03-12 Richard Frith-Macdonald <rfm@gnu.org>
David Ayers <ayers@fsfe.org>
PR libobjc/27466
* objc/objc-api.h (_objc_unexpected_exception): Declare
new hook. Update copyright dates.
* exception.c (objc_exception_throw): Use hook. Update
copyright dates.
* libobjc.def (_objc_unexpected_exception): Export hook.
Update copyright dates.
gcc/testsuite/
2009-03-12 David Ayers <ayers@fsfe.org>
PR libobjc/27466
* objc/execute/exceptions/handler-1.m. New test.
From-SVN: r144826
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/objc/execute/exceptions/handler-1.m | 38 |
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; +} |