c++: Implement for namespace statics CWG 2867 - Order of initialization for structure...
[official-gcc.git] / gcc / testsuite / gcc.dg / c99-bool-4.c
blob5cae18ad0cecebb609d48e3390de1dfe0a684d7a
1 /* Test macro expansions in <stdbool.h> in C99. */
2 /* { dg-do run } */
3 /* { dg-options "-std=c99 -pedantic-errors" } */
5 #include <stdbool.h>
7 #define str(x) xstr(x)
8 #define xstr(x) #x
10 extern void abort (void);
11 extern void exit (int);
12 extern int strcmp (const char *, const char *);
14 #if false - 1 >= 0
15 #error "false unsigned in #if"
16 #endif
18 #if false != 0
19 #error "false not 0 in #if"
20 #endif
22 #if true - 2 >= 0
23 #error "true unsigned in #if"
24 #endif
26 #if true != 1
27 #error "true not 1 in #if"
28 #endif
30 int
31 main (void)
33 if (strcmp (str (bool), "_Bool") != 0)
34 abort ();
35 if (true != 1)
36 abort ();
37 if (strcmp (str (true), "1") != 0)
38 abort ();
39 if (false != 0)
40 abort ();
41 if (strcmp (str (false), "0") != 0)
42 abort ();
43 if (strcmp (str (__bool_true_false_are_defined), "1") != 0)
44 abort ();
45 exit (0);