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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [attr-weakref-1.c] - Blame information for rev 867

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

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do run }
2
// { dg-require-weak "" }
3
// On darwin, we use attr-weakref-1-darwin.c.
4
// This test requires support for undefined weak symbols.  This support
5
// is not available on hppa*-*-hpux*.  The test is skipped rather than
6
// xfailed to suppress the warning that would otherwise arise.
7
// { dg-skip-if "" { "*-*-darwin*" "hppa*-*-hpux*" } "*" { "" } }
8
// { dg-options "-O2" }
9
// { dg-additional-sources "attr-weakref-1a.c" }
10
 
11
// Copyright 2005 Free Software Foundation, Inc.
12
// Contributed by Alexandre Oliva <aoliva@redhat.com>
13
 
14
// Torture test for weakrefs.  The first letter of an identifier
15
// indicates whether/how it is defined; the second letter indicates
16
// whether it is part of a variable or function test; the number that
17
// follows is a test counter, and a letter that may follow enables
18
// multiple identifiers within the same test (e.g., multiple weakrefs
19
// or pointers to the same identifier).
20
 
21
// Identifiers starting with W are weakrefs; those with p are
22
// pointers; those with g are global definitions; those with l are
23
// local definitions; those with w are expected to be weak undefined
24
// in the symbol table; those with u are expected to be marked as
25
// non-weak undefined in the symbol table.
26
 
27
#include <stdlib.h>
28
 
29
#define USED __attribute__((used))
30
 
31
typedef int vtype;
32
 
33
extern vtype wv1;
34
static vtype Wv1a __attribute__((weakref ("wv1")));
35
static vtype *pv1a USED = &Wv1a;
36
 
37
vtype gv2;
38
static vtype Wv2a __attribute__((weakref ("gv2")));
39
static vtype *pv2a USED = &Wv2a;
40
 
41
static vtype lv3;
42
static vtype Wv3a __attribute__((weakref ("lv3")));
43
static vtype *pv3a USED = &Wv3a;
44
 
45
extern vtype uv4;
46
static vtype Wv4a __attribute__((weakref ("uv4")));
47
static vtype *pv4a USED = &Wv4a;
48
static vtype *pv4 USED = &uv4;
49
 
50
static vtype Wv5a __attribute__((weakref ("uv5")));
51
static vtype *pv5a USED = &Wv5a;
52
extern vtype uv5;
53
static vtype *pv5 USED = &uv5;
54
 
55
static vtype Wv6a __attribute__((weakref ("wv6")));
56
static vtype *pv6a USED = &Wv6a;
57
extern vtype wv6;
58
 
59
static vtype Wv7a __attribute__((weakref ("uv7")));
60
static vtype* USED fv7 (void) {
61
  return &Wv7a;
62
}
63
extern vtype uv7;
64
static vtype* USED fv7a (void) {
65
  return &uv7;
66
}
67
 
68
extern vtype uv8;
69
static vtype* USED fv8a (void) {
70
  return &uv8;
71
}
72
static vtype Wv8a __attribute__((weakref ("uv8")));
73
static vtype* USED fv8 (void) {
74
  return &Wv8a;
75
}
76
 
77
extern vtype wv9 __attribute__((weak));
78
static vtype Wv9a __attribute__((weakref ("wv9")));
79
static vtype *pv9a USED = &Wv9a;
80
 
81
static vtype Wv10a __attribute__((weakref ("Wv10b")));
82
static vtype Wv10b __attribute__((weakref ("Wv10c")));
83
static vtype Wv10c __attribute__((weakref ("Wv10d")));
84
static vtype Wv10d __attribute__((weakref ("wv10")));
85
extern vtype wv10;
86
 
87
extern vtype wv11;
88
static vtype Wv11d __attribute__((weakref ("wv11")));
89
static vtype Wv11c __attribute__((weakref ("Wv11d")));
90
static vtype Wv11b __attribute__((weakref ("Wv11c")));
91
static vtype Wv11a __attribute__((weakref ("Wv11b")));
92
 
93
static vtype Wv12 __attribute__((weakref ("wv12")));
94
extern vtype wv12 __attribute__((weak));
95
 
96
static vtype Wv13 __attribute__((weakref ("wv13")));
97
extern vtype wv13 __attribute__((weak));
98
 
99
static vtype Wv14a __attribute__((weakref ("wv14")));
100
static vtype Wv14b __attribute__((weakref ("wv14")));
101
extern vtype wv14 __attribute__((weak));
102
 
103
typedef void ftype(void);
104
 
105
extern ftype wf1;
106
static ftype Wf1a __attribute__((weakref ("wf1")));
107
static ftype *pf1a USED = &Wf1a;
108
static ftype Wf1c __attribute__((weakref));
109
extern ftype Wf1c __attribute__((alias ("wf1")));
110
static ftype *pf1c USED = &Wf1c;
111
 
112
void gf2(void) {}
113
static ftype Wf2a __attribute__((weakref ("gf2")));
114
static ftype *pf2a USED = &Wf2a;
115
 
116
static void lf3(void) {}
117
static ftype Wf3a __attribute__((weakref ("lf3")));
118
static ftype *pf3a USED = &Wf3a;
119
 
120
extern ftype uf4;
121
static ftype Wf4a __attribute__((weakref ("uf4")));
122
static ftype *pf4a USED = &Wf4a;
123
static ftype *pf4 USED = &uf4;
124
 
125
static ftype Wf5a __attribute__((weakref ("uf5")));
126
static ftype *pf5a USED = &Wf5a;
127
extern ftype uf5;
128
static ftype *pf5 USED = &uf5;
129
 
130
static ftype Wf6a __attribute__((weakref ("wf6")));
131
static ftype *pf6a USED = &Wf6a;
132
extern ftype wf6;
133
 
134
static ftype Wf7a __attribute__((weakref ("uf7")));
135
static ftype* USED ff7 (void) {
136
  return &Wf7a;
137
}
138
extern ftype uf7;
139
static ftype* USED ff7a (void) {
140
  return &uf7;
141
}
142
 
143
extern ftype uf8;
144
static ftype* USED ff8a (void) {
145
  return &uf8;
146
}
147
static ftype Wf8a __attribute__((weakref ("uf8")));
148
static ftype* USED ff8 (void) {
149
  return &Wf8a;
150
}
151
 
152
extern ftype wf9 __attribute__((weak));
153
static ftype Wf9a __attribute__((weakref ("wf9")));
154
static ftype *pf9a USED = &Wf9a;
155
 
156
static ftype Wf10a __attribute__((weakref ("Wf10b")));
157
static ftype Wf10b __attribute__((weakref ("Wf10c")));
158
static ftype Wf10c __attribute__((weakref ("Wf10d")));
159
static ftype Wf10d __attribute__((weakref ("wf10")));
160
extern ftype wf10;
161
 
162
extern ftype wf11;
163
static ftype Wf11d __attribute__((weakref ("wf11")));
164
static ftype Wf11c __attribute__((weakref ("Wf11d")));
165
static ftype Wf11b __attribute__((weakref ("Wf11c")));
166
static ftype Wf11a __attribute__((weakref ("Wf11b")));
167
 
168
static ftype Wf12 __attribute__((weakref ("wf12")));
169
extern ftype wf12 __attribute__((weak));
170
 
171
static ftype Wf13 __attribute__((weakref ("wf13")));
172
extern ftype wf13 __attribute__((weak));
173
 
174
static ftype Wf14a __attribute__((weakref ("wf14")));
175
static ftype Wf14b __attribute__((weakref ("wf14")));
176
extern ftype wf14 __attribute__((weak));
177
 
178
#ifndef __APPLE__
179
#define chk(p) do { if (!p) abort (); } while (0)
180
#else
181
#define chk(p) /* */
182
#endif
183
 
184
int main () {
185
  chk (!pv1a);
186
  chk (pv2a);
187
  chk (pv3a);
188
  chk (pv4a);
189
  chk (pv4);
190
  chk (pv5a);
191
  chk (pv5);
192
  chk (!pv6a);
193
  chk (fv7 ());
194
  chk (fv7a ());
195
  chk (fv8 ());
196
  chk (fv8a ());
197
  chk (!pv9a);
198
  chk (!&Wv10a);
199
  chk (!&Wv11a);
200
  chk (!&Wv12);
201
  chk (!&wv12);
202
  chk (!&wv13);
203
  chk (!&Wv14a);
204
 
205
  chk (!pf1a);
206
  chk (!pf1c);
207
  chk (pf2a);
208
  chk (pf3a);
209
  chk (pf4a);
210
  chk (pf4);
211
  chk (pf5a);
212
  chk (pf5);
213
  chk (!pf6a);
214
  chk (ff7 ());
215
  chk (ff7a ());
216
  chk (ff8 ());
217
  chk (ff8a ());
218
  chk (!pf9a);
219
  chk (!&Wf10a);
220
  chk (!&Wf11a);
221
  chk (!&Wf12);
222
  chk (!&wf12);
223
  chk (!&wf13);
224
  chk (!&Wf14a);
225
 
226
  exit (0);
227
}

powered by: WebSVN 2.1.0

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