Debian Codegraph @

gcc/testsuite/objc/execute/exceptions/throw-nil.m

raw
1 #include <objc/objc.h>
2 #include "../../../objc-obj-c++-shared/TestsuiteObject.m"
3
4 #ifdef __NEXT_RUNTIME__
5 /* This test only runs for the GNU runtime. */
6
7 int main(void)
8 {
9 return 0;
10 }
11
12 #else
13
14 /* Test throwing a nil exception. A 'nil' exception can only be
15 caugth by a generic exception handler.
16 */
17
18 int main (void)
19 {
20 int exception_catched = 0;
21 int finally_called = 0;
22
23 @try
24 {
25 @throw nil;
26 }
27 @catch (TestsuiteObject *exc)
28 {
29 abort ();
30 }
31 @catch (id exc)
32 {
33 exception_catched = 1;
34 }
35 @finally
36 {
37 finally_called = 1;
38 }
39
40
41 if (exception_catched != 1
42 || finally_called != 1)
43 {
44 abort ();
45 }
46
47 return 0;
48 }
49
50 #endif