URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 308 |
Rev 338 |
/* Test if the compiler accepts @throw / @try..@catch..@finally syntax. */
|
/* Test if the compiler accepts @throw / @try..@catch..@finally syntax. */
|
/* Developed by Ziemowit Laski . */
|
/* Developed by Ziemowit Laski . */
|
|
|
/* { dg-options "-fobjc-exceptions" } */
|
/* { dg-options "-fobjc-exceptions" } */
|
/* { dg-do compile } */
|
/* { dg-do compile } */
|
|
|
#include "../objc-obj-c++-shared/Object1.h"
|
#include "../objc-obj-c++-shared/Object1.h"
|
#include
|
#include
|
#include
|
#include
|
|
|
@interface Frob: Object
|
@interface Frob: Object
|
@end
|
@end
|
|
|
@implementation Frob: Object
|
@implementation Frob: Object
|
@end
|
@end
|
|
|
static int exc_control = 0;
|
static int exc_control = 0;
|
|
|
int proc() {
|
int proc() {
|
if(exc_control) {
|
if(exc_control) {
|
printf ("Throwing (%d)... ", exc_control);
|
printf ("Throwing (%d)... ", exc_control);
|
@throw [Frob new];
|
@throw [Frob new];
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
int foo()
|
int foo()
|
{
|
{
|
@try {
|
@try {
|
return proc();
|
return proc();
|
}
|
}
|
@catch (Frob* ex) {
|
@catch (Frob* ex) {
|
if(exc_control > 1) {
|
if(exc_control > 1) {
|
printf("Rethrowing (%d)... ", exc_control);
|
printf("Rethrowing (%d)... ", exc_control);
|
@throw;
|
@throw;
|
}
|
}
|
return 0;
|
return 0;
|
}
|
}
|
@finally {
|
@finally {
|
printf("In @finally block (%d)... ", exc_control);
|
printf("In @finally block (%d)... ", exc_control);
|
}
|
}
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.