OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [try-catch-1.mm] - Blame information for rev 703

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 703 jeremybenn
/* Test if the compiler accepts @throw / @try..@catch..@finally syntax.  */
2
/* Developed by Ziemowit Laski .  */
3
 
4
/* { dg-options "-fobjc-exceptions" } */
5
/* { dg-do compile } */
6
 
7
#include "../objc-obj-c++-shared/TestsuiteObject.h"
8
#include 
9
#include 
10
 
11
@interface Frob: TestsuiteObject
12
@end
13
 
14
@implementation Frob: TestsuiteObject
15
@end
16
 
17
static int exc_control = 0;
18
 
19
int proc() {
20
  if(exc_control) {
21
    printf ("Throwing (%d)... ", exc_control);
22
    @throw [Frob new];
23
  }
24
  return 1;
25
}
26
 
27
int foo()
28
{
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
  }
42
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.