This source file includes following definitions.
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) \
23 || (__clang_major__ >= 4)
24
25 # pragma GCC diagnostic ignored "-Waddress"
26 # define ADDRESS_CHECK_OKAY
27 #elif defined __GNUC__ || defined __clang__
28
29 #else
30
31 # define ADDRESS_CHECK_OKAY
32 #endif
33
34 #include <config.h>
35
36 #include <stdbool.h>
37
38 #ifndef bool
39 "error: bool is not defined"
40 #endif
41 #ifndef false
42 "error: false is not defined"
43 #endif
44 #if false
45 "error: false is not 0"
46 #endif
47 #ifndef true
48 "error: true is not defined"
49 #endif
50 #if true != 1
51 "error: true is not 1"
52 #endif
53 #ifndef __bool_true_false_are_defined
54 "error: __bool_true_false_are_defined is not defined"
55 #endif
56
57
58
59 #if HAVE_STDBOOL_H || 3 <= __GNUC__ || 4 <= __clang_major__
60 struct s { _Bool s: 1; _Bool t; } s;
61 #endif
62
63 char a[true == 1 ? 1 : -1];
64 char b[false == 0 ? 1 : -1];
65 char c[__bool_true_false_are_defined == 1 ? 1 : -1];
66 #if HAVE_STDBOOL_H || 3 <= __GNUC__ || 4 <= __clang_major__
67 char d[(bool) 0.5 == true ? 1 : -1];
68 # ifdef ADDRESS_CHECK_OKAY
69
70
71
72 # if defined __GNUC__ || defined __clang__
73 bool e = &s;
74 # endif
75 # endif
76 char f[(_Bool) 0.0 == false ? 1 : -1];
77 #endif
78 char g[true];
79 char h[sizeof (_Bool)];
80 #if HAVE_STDBOOL_H || 3 <= __GNUC__ || 4 <= __clang_major__
81 char i[sizeof s.t];
82 #endif
83 enum { j = false, k = true, l = false * true, m = true * 256 };
84 _Bool n[m];
85 char o[sizeof n == m * sizeof n[0] ? 1 : -1];
86 char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
87
88
89
90
91 _Bool q = true;
92 _Bool *pq = &q;
93
94 int
95 main ()
96 {
97 int error = 0;
98
99 #if HAVE_STDBOOL_H || 3 <= __GNUC_ || 4 <= __clang_major___
100 # ifdef ADDRESS_CHECK_OKAY
101
102 {
103 bool e1 = &s;
104 if (!e1)
105 error = 1;
106 }
107 # endif
108 #endif
109
110
111
112
113
114
115 {
116 char digs[] = "0123456789";
117 if (&(digs + 5)[-2 + (bool) 1] != &digs[4])
118 error = 1;
119 }
120
121 return error;
122 }