Debian Codegraph @

.cargo/vendor/cbindgen/tests/expectations/body.both.c

raw
1 #include <stdarg.h>
2 #include <stdbool.h>
3 #include <stdint.h>
4 #include <stdlib.h>
5
6 typedef enum MyCLikeEnum {
7 Foo1,
8 Bar1,
9 Baz1,
10 } MyCLikeEnum;
11
12 typedef enum MyCLikeEnum_Prepended {
13 Foo1_Prepended,
14 Bar1_Prepended,
15 Baz1_Prepended,
16 } MyCLikeEnum_Prepended;
17
18 typedef struct MyFancyStruct {
19 int32_t i;
20 #ifdef __cplusplus
21 inline void foo();
22 #endif
23 } MyFancyStruct;
24
25 typedef enum MyFancyEnum_Tag {
26 Foo,
27 Bar,
28 Baz,
29 } MyFancyEnum_Tag;
30
31 typedef struct MyFancyEnum {
32 MyFancyEnum_Tag tag;
33 union {
34 struct {
35 int32_t bar;
36 };
37 struct {
38 int32_t baz;
39 };
40 };
41 #ifdef __cplusplus
42 inline void wohoo();
43 #endif
44 } MyFancyEnum;
45
46 typedef union MyUnion {
47 float f;
48 uint32_t u;
49 int32_t extra_member;
50 } MyUnion;
51
52 typedef struct MyFancyStruct_Prepended {
53 #ifdef __cplusplus
54 inline void prepended_wohoo();
55 #endif
56 int32_t i;
57 } MyFancyStruct_Prepended;
58
59 typedef enum MyFancyEnum_Prepended_Tag {
60 Foo_Prepended,
61 Bar_Prepended,
62 Baz_Prepended,
63 } MyFancyEnum_Prepended_Tag;
64
65 typedef struct MyFancyEnum_Prepended {
66 #ifdef __cplusplus
67 inline void wohoo();
68 #endif
69 MyFancyEnum_Prepended_Tag tag;
70 union {
71 struct {
72 int32_t bar_prepended;
73 };
74 struct {
75 int32_t baz_prepended;
76 };
77 };
78 } MyFancyEnum_Prepended;
79
80 typedef union MyUnion_Prepended {
81 int32_t extra_member;
82 float f;
83 uint32_t u;
84 } MyUnion_Prepended;
85
86 void root(struct MyFancyStruct s,
87 struct MyFancyEnum e,
88 enum MyCLikeEnum c,
89 union MyUnion u,
90 struct MyFancyStruct_Prepended sp,
91 struct MyFancyEnum_Prepended ep,
92 enum MyCLikeEnum_Prepended cp,
93 union MyUnion_Prepended up);