bd52d17906
too large to list, but see: http://gcc.gnu.org/gcc-3.4/changes.html http://gcc.gnu.org/gcc-4.0/changes.html http://gcc.gnu.org/gcc-4.1/changes.html for the details.
43 lines
733 B
Plaintext
43 lines
733 B
Plaintext
/* 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/Object.h>
|
|
#include <stdio.h>
|
|
#include <setjmp.h>
|
|
|
|
@interface Frob: Object
|
|
@end
|
|
|
|
@implementation Frob: Object
|
|
@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);
|
|
}
|
|
}
|