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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [exceptions-4.mm] - Blame information for rev 720

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

Line No. Rev Author Line
1 703 jeremybenn
/* Contributed by Nicola Pero , November 2010.  */
2
/* { dg-options "-fobjc-exceptions" } */
3
/* { dg-do compile } */
4
 
5
/* Test warnings when parsing syntax errors in @catch().  */
6
 
7
#include 
8
 
9
@interface MyObject
10
{
11
  Class isa;
12
}
13
@end
14
 
15
@implementation MyObject
16
@end
17
 
18
@interface MyObject2
19
{
20
  Class isa;
21
}
22
@end
23
 
24
@implementation MyObject2
25
@end
26
 
27
@protocol MyProtocol;
28
 
29
int test (id object)
30
{
31
  int dummy = 0;
32
 
33
  @try { @throw object; }
34
  @catch
35
    {          /* { dg-error "expected" } */
36
      dummy++; /* { dg-error "@catch parameter is not a known Objective-C class type" "" { target *-*-* } 35 } */
37
    }
38
  @catch ()  /* { dg-error "expected identifier before" } */
39
    {        /* { dg-error "@catch parameter is not a known Objective-C class type" "" { target *-*-* } 38 } */
40
      dummy++;
41
    }
42
  @catch (i) /* { dg-error ".i. has not been declared" } */
43
    {        /* { dg-error "@catch parameter is not a known Objective-C class type" "" { target *-*-* } 42 } */
44
      dummy++;
45
    }
46
  @catch (id 
47
    {                       /* { dg-error "@catch parameter can not be protocol-qualified" "" { target *-*-* } 46 } */
48
      dummy++;
49
    }
50
  @catch MyObject *x       /* { dg-error "expected ... before .MyObject." } */
51
    {
52
      dummy++;
53
    }
54
  @catch MyObject2 *x)     /* { dg-error "expected ... before .MyObject2." } */
55
   {
56
     dummy++;
57
   }
58
 
59
  @try { @throw object; }
60
  @catch (MyObject *x)
61
  @catch (MyObject2 *y)    /* { dg-error "expected ... before .catch." } */
62
 
63
  return dummy;            /* { dg-error "expected ... before .return." } */
64
}

powered by: WebSVN 2.1.0

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