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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [sync-3.mm] - Blame information for rev 762

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

Line No. Rev Author Line
1 703 jeremybenn
/* Contributed by Nicola Pero , December 2010.  */
2
/* { dg-options "-fobjc-exceptions" } */
3
/* { dg-do compile } */
4
 
5
/* Test that the compiler is checking the argument of @synchronized(),
6
   and produce errors when invalid types are used.  */
7
 
8
#include 
9
 
10
@interface MyObject
11
{
12
  Class isa;
13
}
14
@end
15
 
16
@implementation MyObject
17
@end
18
 
19
@protocol MyProtocol;
20
 
21
typedef MyObject MyObjectTypedef;
22
typedef MyObject *MyObjectPtrTypedef;
23
typedef int intTypedef;
24
 
25
typedef struct { float x; float y; } point, *point_ptr;
26
 
27
int test (id object)
28
{
29
  int dummy = 0;
30
 
31
  {
32
    int x;
33
    @synchronized (x) /* { dg-error ".@synchronized. argument is not an object" } */
34
    { dummy++; }
35
  }
36
 
37
  {
38
    intTypedef x;
39
    @synchronized (x) /* { dg-error ".@synchronized. argument is not an object" } */
40
    { dummy++; }
41
  }
42
 
43
  {
44
    int *x;
45
    @synchronized (x) /* { dg-error ".@synchronized. argument is not an object" } */
46
    { dummy++; }
47
  }
48
 
49
  {
50
    point x;
51
    @synchronized (x) /* { dg-error ".@synchronized. argument is not an object" } */
52
    { dummy++; }
53
  }
54
 
55
  {
56
    point_ptr x;
57
    @synchronized (x) /* { dg-error ".@synchronized. argument is not an object" } */
58
    { dummy++; }
59
  }
60
 
61
  {
62
    id x;
63
    @synchronized (x) /* Ok */
64
    { dummy++; }
65
  }
66
 
67
  {
68
    id  x;
69
    @synchronized (x) /* Ok */
70
    { dummy++; }
71
  }
72
 
73
  {
74
    MyObject *x;
75
    @synchronized (x) /* Ok */
76
    { dummy++; }
77
  }
78
 
79
  {
80
    MyObject  *x;
81
    @synchronized (x) /* Ok */
82
    { dummy++; }
83
  }
84
 
85
  {
86
    static MyObject *x;
87
    @synchronized (x) /* Ok */
88
    { dummy++; }
89
  }
90
 
91
  {
92
    MyObjectTypedef *x;
93
    @synchronized (x) /* Ok */
94
    { dummy++; }
95
  }
96
 
97
  {
98
    MyObjectTypedef  *x;
99
    @synchronized (x) /* Ok */
100
    { dummy++; }
101
  }
102
 
103
  {
104
    MyObjectPtrTypedef x;
105
    @synchronized (x) /* Ok */
106
    { dummy++; }
107
  }
108
 
109
  {
110
    Class x;
111
    @synchronized (x) /* Ok */
112
    { dummy++; }
113
  }
114
 
115
  @synchronized (1) /* { dg-error ".@synchronized. argument is not an object" } */
116
    { dummy++; }
117
 
118
  @synchronized ("Test") /* { dg-error ".@synchronized. argument is not an object" } */
119
    { dummy++; }
120
 
121
  @synchronized () /* { dg-error "expected" } */
122
    { dummy++; }
123
 
124
  @synchronized (int) /* { dg-error "expected" } */
125
    { dummy++; }
126
 
127
  return dummy;
128
}

powered by: WebSVN 2.1.0

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