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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [exceptions-1.m] - Blame information for rev 714

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 704 jeremybenn
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2
/* { dg-options "-fobjc-exceptions" } */
3
/* { dg-do compile } */
4
 
5
/* This test checks the syntax @catch (...) which catches any
6
   exceptions.  At the moment, @catch (...) is identical to @catch (id
7
   exception).  */
8
 
9
#include <objc/objc.h>
10
 
11
@interface MyObject
12
{
13
  Class isa;
14
}
15
@end
16
 
17
@implementation MyObject
18
@end
19
 
20
int test (id object)
21
{
22
  int i = 0;
23
 
24
  @try
25
    {
26
      @throw object;
27
    }
28
  @catch (MyObject *o)
29
    {
30
      i += 1;
31
    }
32
  @catch (...)
33
    {
34
      i += 2;
35
    }
36
  @finally
37
    {
38
      i += 4;
39
    }
40
 
41
  return i;
42
}

powered by: WebSVN 2.1.0

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