* auto-profile.c (afdo_annotate_cfg): Use update_max_bb_count.
[official-gcc.git] / gcc / testsuite / obj-c++.dg / try-catch-1.mm
blobcbdace62d43ccad1af98ef85dbbd3207246e691b
1 /* Test if the compiler accepts @throw / @try..@catch..@finally syntax.  */
2 /* Developed by Ziemowit Laski <zlaski@apple.com>.  */
4 /* { dg-options "-fobjc-exceptions" } */
5 /* { dg-do compile } */
7 #include "../objc-obj-c++-shared/TestsuiteObject.h"
8 #include <stdio.h>
9 #include <setjmp.h>
11 @interface Frob: TestsuiteObject
12 @end
14 @implementation Frob: TestsuiteObject
15 @end
17 static int exc_control = 0;
19 int proc() {
20   if(exc_control) {
21     printf ("Throwing (%d)... ", exc_control);
22     @throw [Frob new];
23   }
24   return 1;
27 int foo()
29   @try {
30     return proc();
31   }
32   @catch (Frob* ex) {
33     if(exc_control > 1) {
34       printf("Rethrowing (%d)... ", exc_control);
35       @throw;
36     }
37     return 0;
38   }
39   @finally {
40     printf("In @finally block (%d)... ", exc_control);
41   }