Debian Codegraph @

gcc/testsuite/objc/execute/exceptions/finally-1.m

raw
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "../../../objc-obj-c++-shared/TestsuiteObject.m"
4
5 static int made_try = 0;
6
7 int
8 thrower_try_body()
9 {
10 made_try++;
11 return (0);
12 }
13
14 static int made_finally = 0;
15
16 int
17 finally_body()
18 {
19 made_finally++;
20 return (0);
21 }
22
23 int
24 thrower()
25 {
26 @try
27 {
28 thrower_try_body();
29 @throw [TestsuiteObject new];
30 }
31 @finally
32 {
33 finally_body();
34 }
35 return 0;
36 }
37
38 static int made_catch = 0;
39
40 int
41 main(int ac, char *av[])
42 {
43 @try
44 {
45 thrower();
46 }
47 @catch (id exc)
48 {
49 made_catch++;
50 [exc free];
51 }
52 if (made_try != 1)
53 abort ();
54 if (made_finally != 1)
55 abort ();
56 if (made_catch != 1)
57 abort ();
58 return 0;
59 }
60