OSDN Git Service

* gcc.dg/cpp/assert4.c: New test.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / cpp / assert4.c
1 /* Copyright (C) 2003 Free Software Foundation, Inc.
2    Test builtin preprocessor assertions.
3    By Kaveh Ghazi <ghazi@caip.rutgers.edu>.  */
4
5 /* { dg-do preprocess } */
6
7 /* Check for #system assertions.  */
8
9 #if defined __gnu_linux__
10 # if !#system(linux) || !#system(unix) || !#system(posix)
11 #  error
12 # endif
13 #elif #system(linux)
14 # error
15 #endif
16
17 #if defined __gnu_hurd__
18 # if !#system(gnu) || !#system(unix) || !#system(posix)
19 #  error
20 # endif
21 #elif #system(gnu)
22 # error
23 #endif
24
25 #if defined __FreeBSD__
26 # if !#system(FreeBSD) || !#system(unix) || !#system(bsd)
27 #  error
28 # endif
29 #elif #system(FreeBSD)
30 # error
31 #endif
32
33 #if defined __NetBSD__
34 # if !#system(NetBSD) || !#system(unix) || !#system(bsd)
35 #  error
36 # endif
37 #elif #system(NetBSD)
38 # error
39 #endif
40
41 #if defined __OpenBSD__
42 # if !#system(OpenBSD) || !#system(unix) || !#system(bsd)
43 #  error
44 # endif
45 #elif #system(OpenBSD)
46 # error
47 #endif
48
49 #if defined __svr4__ || defined __SYSTYPE_SVR4__
50 # if !#system(svr4) || !#system(unix)
51 #  error
52 # endif
53 #elif #system(svr4)
54 # error
55 #endif
56
57 #if defined __hpux__
58 # if !#system(hpux) || !#system(unix)
59 #  error
60 # endif
61 #elif #system(hpux)
62 # error
63 #endif
64
65 #if defined _AIX
66 # if !#system(aix) || !#system(unix)
67 #  error
68 # endif
69 #elif #system(aix)
70 # error
71 #endif
72
73 #if defined __lynx__
74 # if !#system(lynx) || !#system(unix)
75 #  error
76 # endif
77 #elif #system(lynx)
78 # error
79 #endif
80
81 #if defined __rtems__
82 # if !#system(rtems)
83 #  error
84 # endif
85 #elif #system(rtems)
86 # error
87 #endif
88
89
90 /* Check for #cpu and #machine assertions.  */
91
92 #if defined __arc__
93 # if !#cpu(arc) || !#machine(arc)
94 #  error
95 # endif
96 #elif #cpu(arc) || #machine(arc)
97 # error
98 #endif
99
100 #if defined __alpha__
101 # if !#cpu(alpha) || !#machine(alpha) \
102         || (defined __alpha_cix__ && !#cpu(cix)) \
103         || (!defined __alpha_cix__ && #cpu(cix)) \
104         || (defined __alpha_fix__ && !#cpu(fix)) \
105         || (!defined __alpha_fix__ && #cpu(fix)) \
106         || (defined __alpha_bwx__ && !#cpu(bwx)) \
107         || (!defined __alpha_bwx__ && #cpu(bwx)) \
108         || (defined __alpha_max__ && !#cpu(max)) \
109         || (!defined __alpha_max__ && #cpu(max)) \
110         || (defined __alpha_ev6__ && !#cpu(ev6)) \
111         || (!defined __alpha_ev6__ && #cpu(ev6)) \
112         || (defined __alpha_ev5__ && !#cpu(ev5)) \
113         || (!defined __alpha_ev5__ && #cpu(ev5)) \
114         || (defined __alpha_ev4__ && !#cpu(ev4)) \
115         || (!defined __alpha_ev4__ && #cpu(ev4))
116 #  error
117 # endif
118 #elif #cpu(alpha) || #machine(alpha) || #cpu(cix) || #cpu(fix) || #cpu(bwx) \
119         || #cpu(max) || #cpu(ev6) || #cpu(ev5) || #cpu(ev4)
120 # error
121 #endif
122
123 #if defined __arm__
124 # if !#cpu(arm) || !#machine(arm)
125 #  error
126 # endif
127 #elif #cpu(arm) || #machine(arm)
128 # error
129 #endif
130
131 #if defined __d30v__
132 # if !#cpu(d30v) || !#machine(d30v)
133 #  error
134 # endif
135 #elif #cpu(d30v) || #machine(d30v)
136 # error
137 #endif
138
139 #if defined __fr30__
140 # if !#cpu(fr30) || !#machine(fr30)
141 #  error
142 # endif
143 #elif #cpu(fr30) || #machine(fr30)
144 # error
145 #endif
146
147 #if defined __frv__
148 # if !#cpu(frv) || !#machine(frv)
149 #  error
150 # endif
151 #elif #cpu(frv) || #machine(frv)
152 # error
153 #endif
154
155 #if defined __h8300__ 
156 # if !#cpu(h8300) || !#machine(h8300) \
157   || (defined __H8300__ && (!#cpu(h8300) || !#machine(h8300))) \
158   || (defined __H8300H__ && (!#cpu(h8300h) || !#machine(h8300h))) \
159   || (!defined __H8300H__ && (#cpu(h8300h) || #machine(h8300h))) \
160   || (defined __H8300S__ && (!#cpu(h8300s) || !#machine(h8300s))) \
161   || (!defined __H8300S__ && (#cpu(h8300s) || #machine(h8300s)))
162 #  error
163 # endif
164 #elif #cpu(h8300) || #machine(h8300) || #cpu(h8300h) || #machine(h8300h) || \
165   #cpu(h8300s) || #machine(h8300s)
166 # error
167 #endif
168
169 #if defined __hppa__
170 # if !#cpu(hppa) || !#machine(hppa)
171 #  error
172 # endif
173 #elif #cpu(hppa) || #machine(hppa)
174 # error
175 #endif
176
177 #if defined __i370__
178 # if !#cpu(i370) || !#machine(i370)
179 #  error
180 # endif
181 #elif #cpu(i370) || #machine(i370)
182 # error
183 #endif
184
185 #if defined __x86_64__
186 # if !#cpu(x86_64) || !#machine(x86_64)
187 #  error
188 # endif
189 #elif #cpu(x86_64) || #machine(x86_64)
190 # error
191 #endif
192
193 #if defined __i386__
194 # if !#cpu(i386) || !#machine(i386)
195 #  error
196 # endif
197 #elif #cpu(i386) || #machine(i386)
198 # error
199 #endif
200
201 #if defined __i860__
202 # if !#cpu(i860) || !#machine(i860)
203 #  error
204 # endif
205 #elif #cpu(i860) || #machine(i860)
206 # error
207 #endif
208
209 #if defined __i960__
210 # if !#cpu(i960) || !#machine(i960)
211 #  error
212 # endif
213 #elif #cpu(i960) || #machine(i960)
214 # error
215 #endif
216
217 #if defined __ia64__
218 # if !#cpu(ia64) || !#machine(ia64)
219 #  error
220 # endif
221 #elif #cpu(ia64) || #machine(ia64)
222 # error
223 #endif
224
225 #if defined __iq2000__
226 # if !#cpu(iq2000) || !#machine(iq2000)
227 #  error
228 # endif
229 #elif #cpu(iq2000) || #machine(iq2000)
230 # error
231 #endif
232
233 #if defined __M32R__
234 # if !#cpu(m32r) || !#machine(m32r)
235 #  error
236 # endif
237 #elif #cpu(m32r) || #machine(m32r)
238 # error
239 #endif
240
241 #if defined __m68k__
242 # if !#cpu(m68k) || !#machine(m68k)
243 #  error
244 # endif
245 #elif #cpu(m68k) || #machine(m68k)
246 # error
247 #endif
248
249 #if defined __mcore__
250 # if !#cpu(mcore) || !#machine(mcore)
251 #  error
252 # endif
253 #elif #cpu(mcore) || #machine(mcore)
254 # error
255 #endif
256
257 #if defined __mips__
258 # if !#cpu(mips) || (defined __sgi__ && !#machine(sgi)) \
259   || (!defined __sgi__ && !#machine(mips))
260 #  error
261 # endif
262 #elif #cpu(mips) || #machine(sgi) || #machine(mips)
263 # error
264 #endif
265
266 #if defined __mmix__
267 # if !#cpu(mmix) || !#machine(mmix)
268 #  error
269 # endif
270 #elif #cpu(mmix) || #machine(mcore)
271 # error
272 #endif
273
274 #if defined __mn10300__
275 # if !#cpu(mn10300) || !#machine(mn10300)
276 #  error
277 # endif
278 #elif #cpu(mn10300) || #machine(mn10300)
279 # error
280 #endif
281
282 #if defined __ns32k__
283 # if !#cpu(ns32k) || !#machine(ns32k)
284 #  error
285 # endif
286 #elif #cpu(ns32k) || #machine(ns32k)
287 # error
288 #endif
289
290 #if defined __pdp11__
291 # if !#cpu(pdp11) || !#machine(pdp11)
292 #  error
293 # endif
294 #elif #cpu(pdp11) || #machine(pdp11)
295 # error
296 #endif
297
298 #if defined __powerpc__
299 # if !#cpu(powerpc) || !#machine(powerpc)
300 #  error
301 # endif
302 #elif #cpu(powerpc) || #machine(powerpc)
303 # error
304 #endif
305
306 #if defined __rs6000__
307 # if !#cpu(rs6000) || !#machine(rs6000)
308 #  error
309 # endif
310 #elif #cpu(rs6000) || #machine(rs6000)
311 # error
312 #endif
313
314 #if defined __s390__
315 # if !#cpu(s390) || !#machine(s390)
316 #  error
317 # endif
318 #elif #cpu(s390) || #machine(s390)
319 # error
320 #endif
321
322 #if defined __sh__
323 # if !#cpu(sh) || !#machine(sh)
324 #  error
325 # endif
326 #elif #cpu(sh) || #machine(sh)
327 # error
328 #endif
329
330 #if defined __sparc__
331 # if (defined __arch64__ \
332       && (!#cpu(sparc64) || !#machine(sparc64) || #cpu(sparc) || #machine(sparc)))
333   || (!defined __arch64__ \
334       && (#cpu(sparc64) || #machine(sparc64) || !#cpu(sparc) || !#machine(sparc)))
335 #  error
336 # endif
337 #elif #cpu(sparc64) || #machine(sparc64) || #cpu(sparc) || #machine(sparc)
338 # error
339 #endif
340
341 #if defined __xstormy16__
342 # if !#cpu(xstormy16) || !#machine(xstormy16)
343 #  error
344 # endif
345 #elif #cpu(xstormy16) || #machine(xstormy16)
346 # error
347 #endif
348
349 #if defined __v850__
350 # if !#cpu(v850) || !#machine(v850)
351 #  error
352 # endif
353 #elif #cpu(v850) || #machine(v850)
354 # error
355 #endif
356
357 #if defined __vax__
358 # if !#cpu(vax) || !#machine(vax)
359 #  error
360 # endif
361 #elif #cpu(vax) || #machine(vax)
362 # error
363 #endif
364
365 #if defined __XTENSA__
366 # if !#cpu(xtensa) || !#machine(xtensa)
367 #  error
368 # endif
369 #elif #cpu(xtensa) || #machine(xtensa)
370 # error
371 #endif
372