Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/objc.dg/try-catch-1.m @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
/* Test if the compiler accepts @throw / @try..@catch..@finally syntax. */ /* Developed by Ziemowit Laski <zlaski@apple.com>. */ /* { dg-options "-fobjc-exceptions" } */ /* { dg-do compile } */ #include "../objc-obj-c++-shared/TestsuiteObject.h" #include <stdio.h> #include <setjmp.h> @interface Frob: TestsuiteObject @end @implementation Frob: TestsuiteObject @end static int exc_control = 0; int proc() { if(exc_control) { printf ("Throwing (%d)... ", exc_control); @throw [Frob new]; } return 1; } int foo() { @try { return proc(); } @catch (Frob* ex) { if(exc_control > 1) { printf("Rethrowing (%d)... ", exc_control); @throw; } return 0; } @finally { printf("In @finally block (%d)... ", exc_control); } }