OSDN Git Service

gcc/testsuite
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / cpp / assert1.c
1 /* Basic tests of the #assert preprocessor extension. */
2 /* { dg-do compile } */
3 /* { dg-options "" } */
4
5 #define def unused expansion
6 #define fail  int fail
7
8 #assert abc (def)
9 #assert abc (ghi)
10 #assert abc (jkl)
11 #assert space ( s p a c e )
12
13 /* Basic: */
14 #if !#abc (def) || !#abc (ghi) || !#abc (jkl)
15 fail
16 #endif
17
18 /* any answer for #abc */
19 #if !#abc
20 fail
21 #endif
22
23 /* internal whitespace is collapsed,
24    external whitespace is deleted  */
25 #if !#space (s p  a  c e) || !#space (  s p a c e  ) || #space (space)
26 fail
27 #endif
28
29 /* removing assertions */
30 #unassert abc (jkl)
31 #if !#abc || !#abc (def) || !#abc (ghi) || #abc (jkl)
32 fail
33 #endif
34
35 #unassert abc
36 #if #abc || #abc (def) || #abc (ghi) || #abc (jkl)
37 fail
38 #endif
39
40 int gobble
41
42 /* make sure it can succeed too.
43    also check space before open paren isn't significant */
44 #if #space(s p a c e)
45 ;
46 #endif