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