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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [objc/] [execute/] [exceptions/] [finally-1.m] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 307 jeremybenn
#include <stdio.h>
2
#include <stdlib.h>
3
#import "../../../objc-obj-c++-shared/Object1.h"
4
 
5
static int made_try = 0;
6
 
7
int
8
thrower_try_body()
9
{
10
  made_try++;
11
  return (0);
12
}
13
 
14
static int made_finally = 0;
15
 
16
int
17
finally_body()
18
{
19
  made_finally++;
20
  return (0);
21
}
22
 
23
int
24
thrower()
25
{
26
  @try
27
  {
28
    thrower_try_body();
29
    @throw [Object new];
30
  }
31
  @finally
32
  {
33
    finally_body();
34
  }
35
  return 0;
36
}
37
 
38
static int made_catch = 0;
39
 
40
int
41
main(int ac, char *av[])
42
{
43
  @try
44
  {
45
    thrower();
46
  }
47
  @catch (id exc)
48
  {
49
    made_catch++;
50
    [exc free];
51
  }
52
  if (made_try != 1)
53
    abort ();
54
  if (made_finally != 1)
55
    abort ();
56
  if (made_catch != 1)
57
    abort ();
58
  return 0;
59
}

powered by: WebSVN 2.1.0

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