/
asserted_cast_tag.compat.c
104 lines (89 loc) · 1.29 KB
/
asserted_cast_tag.compat.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#define MY_ASSERT(...) do { } while (0)
#define MY_ATTRS __attribute((noinline))
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
struct I;
enum H_Tag
#ifdef __cplusplus
: uint8_t
#endif // __cplusplus
{
H_Foo,
H_Bar,
H_Baz,
};
#ifndef __cplusplus
typedef uint8_t H_Tag;
#endif // __cplusplus
struct H_Bar_Body {
uint8_t x;
int16_t y;
};
struct H {
H_Tag tag;
union {
struct {
int16_t foo;
};
struct H_Bar_Body bar;
};
};
enum J_Tag
#ifdef __cplusplus
: uint8_t
#endif // __cplusplus
{
J_Foo,
J_Bar,
J_Baz,
};
#ifndef __cplusplus
typedef uint8_t J_Tag;
#endif // __cplusplus
struct J_Bar_Body {
uint8_t x;
int16_t y;
};
struct J {
J_Tag tag;
union {
struct {
int16_t foo;
};
struct J_Bar_Body bar;
};
};
enum K_Tag
#ifdef __cplusplus
: uint8_t
#endif // __cplusplus
{
K_Foo,
K_Bar,
K_Baz,
};
#ifndef __cplusplus
typedef uint8_t K_Tag;
#endif // __cplusplus
struct K_Bar_Body {
K_Tag tag;
uint8_t x;
int16_t y;
};
union K {
K_Tag tag;
struct {
K_Tag foo_tag;
int16_t foo;
};
struct K_Bar_Body bar;
};
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void foo(struct H h, struct I i, struct J j, union K k);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus