Debian Codegraph @

.cargo/vendor/cbindgen/tests/expectations/destructor_and_copy_ctor.both.compat.c

raw
1 #define NOINLINE __attribute__((noinline))
2 #define NODISCARD [[nodiscard]]
3
4
5 #include <stdarg.h>
6 #include <stdbool.h>
7 #include <stdint.h>
8 #include <stdlib.h>
9
10 enum FillRule
11 #ifdef __cplusplus
12 : uint8_t
13 #endif // __cplusplus
14 {
15 A,
16 B,
17 };
18 #ifndef __cplusplus
19 typedef uint8_t FillRule;
20 #endif // __cplusplus
21
22 /**
23 * This will have a destructor manually implemented via variant_body, and
24 * similarly a Drop impl in Rust.
25 */
26 typedef struct OwnedSlice_u32 {
27 uintptr_t len;
28 uint32_t *ptr;
29 } OwnedSlice_u32;
30
31 typedef struct Polygon_u32 {
32 FillRule fill;
33 struct OwnedSlice_u32 coordinates;
34 } Polygon_u32;
35
36 /**
37 * This will have a destructor manually implemented via variant_body, and
38 * similarly a Drop impl in Rust.
39 */
40 typedef struct OwnedSlice_i32 {
41 uintptr_t len;
42 int32_t *ptr;
43 } OwnedSlice_i32;
44
45 enum Foo_u32_Tag
46 #ifdef __cplusplus
47 : uint8_t
48 #endif // __cplusplus
49 {
50 Bar_u32,
51 Polygon1_u32,
52 Slice1_u32,
53 Slice2_u32,
54 Slice3_u32,
55 Slice4_u32,
56 };
57 #ifndef __cplusplus
58 typedef uint8_t Foo_u32_Tag;
59 #endif // __cplusplus
60
61 typedef struct Slice3_Body_u32 {
62 FillRule fill;
63 struct OwnedSlice_u32 coords;
64 } Slice3_Body_u32;
65
66 typedef struct Slice4_Body_u32 {
67 FillRule fill;
68 struct OwnedSlice_i32 coords;
69 } Slice4_Body_u32;
70
71 typedef struct Foo_u32 {
72 Foo_u32_Tag tag;
73 union {
74 struct {
75 struct Polygon_u32 polygon1;
76 };
77 struct {
78 struct OwnedSlice_u32 slice1;
79 };
80 struct {
81 struct OwnedSlice_i32 slice2;
82 };
83 Slice3_Body_u32 slice3;
84 Slice4_Body_u32 slice4;
85 };
86 } Foo_u32;
87
88 typedef struct Polygon_i32 {
89 FillRule fill;
90 struct OwnedSlice_i32 coordinates;
91 } Polygon_i32;
92
93 enum Baz_i32_Tag
94 #ifdef __cplusplus
95 : uint8_t
96 #endif // __cplusplus
97 {
98 Bar2_i32,
99 Polygon21_i32,
100 Slice21_i32,
101 Slice22_i32,
102 Slice23_i32,
103 Slice24_i32,
104 };
105 #ifndef __cplusplus
106 typedef uint8_t Baz_i32_Tag;
107 #endif // __cplusplus
108
109 typedef struct Slice23_Body_i32 {
110 Baz_i32_Tag tag;
111 FillRule fill;
112 struct OwnedSlice_i32 coords;
113 } Slice23_Body_i32;
114
115 typedef struct Slice24_Body_i32 {
116 Baz_i32_Tag tag;
117 FillRule fill;
118 struct OwnedSlice_i32 coords;
119 } Slice24_Body_i32;
120
121 typedef union Baz_i32 {
122 Baz_i32_Tag tag;
123 struct {
124 Baz_i32_Tag polygon21_tag;
125 struct Polygon_i32 polygon21;
126 };
127 struct {
128 Baz_i32_Tag slice21_tag;
129 struct OwnedSlice_i32 slice21;
130 };
131 struct {
132 Baz_i32_Tag slice22_tag;
133 struct OwnedSlice_i32 slice22;
134 };
135 Slice23_Body_i32 slice23;
136 Slice24_Body_i32 slice24;
137 } Baz_i32;
138
139 enum Taz_Tag
140 #ifdef __cplusplus
141 : uint8_t
142 #endif // __cplusplus
143 {
144 Bar3,
145 Taz1,
146 Taz3,
147 };
148 #ifndef __cplusplus
149 typedef uint8_t Taz_Tag;
150 #endif // __cplusplus
151
152 typedef union Taz {
153 Taz_Tag tag;
154 struct {
155 Taz_Tag taz1_tag;
156 int32_t taz1;
157 };
158 struct {
159 Taz_Tag taz3_tag;
160 struct OwnedSlice_i32 taz3;
161 };
162 } Taz;
163
164 enum Tazz_Tag
165 #ifdef __cplusplus
166 : uint8_t
167 #endif // __cplusplus
168 {
169 Bar4,
170 Taz2,
171 };
172 #ifndef __cplusplus
173 typedef uint8_t Tazz_Tag;
174 #endif // __cplusplus
175
176 typedef union Tazz {
177 Tazz_Tag tag;
178 struct {
179 Tazz_Tag taz2_tag;
180 int32_t taz2;
181 };
182 } Tazz;
183
184 enum Tazzz_Tag
185 #ifdef __cplusplus
186 : uint8_t
187 #endif // __cplusplus
188 {
189 Bar5,
190 Taz5,
191 };
192 #ifndef __cplusplus
193 typedef uint8_t Tazzz_Tag;
194 #endif // __cplusplus
195
196 typedef union Tazzz {
197 Tazzz_Tag tag;
198 struct {
199 Tazzz_Tag taz5_tag;
200 int32_t taz5;
201 };
202 } Tazzz;
203
204 enum Tazzzz_Tag
205 #ifdef __cplusplus
206 : uint8_t
207 #endif // __cplusplus
208 {
209 Taz6,
210 Taz7,
211 };
212 #ifndef __cplusplus
213 typedef uint8_t Tazzzz_Tag;
214 #endif // __cplusplus
215
216 typedef union Tazzzz {
217 Tazzzz_Tag tag;
218 struct {
219 Tazzzz_Tag taz6_tag;
220 int32_t taz6;
221 };
222 struct {
223 Tazzzz_Tag taz7_tag;
224 uint32_t taz7;
225 };
226 } Tazzzz;
227
228 enum Qux_Tag
229 #ifdef __cplusplus
230 : uint8_t
231 #endif // __cplusplus
232 {
233 Qux1,
234 Qux2,
235 };
236 #ifndef __cplusplus
237 typedef uint8_t Qux_Tag;
238 #endif // __cplusplus
239
240 typedef union Qux {
241 Qux_Tag tag;
242 struct {
243 Qux_Tag qux1_tag;
244 int32_t qux1;
245 };
246 struct {
247 Qux_Tag qux2_tag;
248 uint32_t qux2;
249 };
250 } Qux;
251
252 #ifdef __cplusplus
253 extern "C" {
254 #endif // __cplusplus
255
256 void root(const struct Foo_u32 *a,
257 const union Baz_i32 *b,
258 const union Taz *c,
259 union Tazz d,
260 const union Tazzz *e,
261 const union Tazzzz *f,
262 const union Qux *g);
263
264 #ifdef __cplusplus
265 } // extern "C"
266 #endif // __cplusplus