| 1 |
#include <cstdarg> |
| 2 |
#include <cstdint> |
| 3 |
#include <cstdlib> |
| 4 |
#include <ostream> |
| 5 |
#include <new> |
| 6 |
|
| 7 |
enum class C : uint32_t { |
| 8 |
X = 2, |
| 9 |
Y, |
| 10 |
}; |
| 11 |
|
| 12 |
inline std::ostream& operator<<(std::ostream& stream, const C& instance) { |
| 13 |
switch (instance) { |
| 14 |
case C::X: stream << "X"; break; |
| 15 |
case C::Y: stream << "Y"; break; |
| 16 |
} |
| 17 |
return stream; |
| 18 |
} |
| 19 |
|
| 20 |
struct A { |
| 21 |
int32_t _0; |
| 22 |
|
| 23 |
friend std::ostream& operator<<(std::ostream& stream, const A& instance) { |
| 24 |
return stream << "{ " << "_0=" << instance._0 << " }"; |
| 25 |
} |
| 26 |
}; |
| 27 |
|
| 28 |
struct B { |
| 29 |
int32_t x; |
| 30 |
float y; |
| 31 |
|
| 32 |
friend std::ostream& operator<<(std::ostream& stream, const B& instance) { |
| 33 |
return stream << "{ " << "x=" << instance.x << ", " |
| 34 |
<< "y=" << instance.y << " }"; |
| 35 |
} |
| 36 |
}; |
| 37 |
|
| 38 |
struct D { |
| 39 |
uint8_t List; |
| 40 |
uintptr_t Of; |
| 41 |
B Things; |
| 42 |
|
| 43 |
friend std::ostream& operator<<(std::ostream& stream, const D& instance) { |
| 44 |
return stream << "{ " << "List=" << instance.List << ", " |
| 45 |
<< "Of=" << instance.Of << ", " |
| 46 |
<< "Things=" << instance.Things << " }"; |
| 47 |
} |
| 48 |
}; |
| 49 |
|
| 50 |
union F { |
| 51 |
enum class Tag : uint8_t { |
| 52 |
Foo, |
| 53 |
Bar, |
| 54 |
Baz, |
| 55 |
}; |
| 56 |
|
| 57 |
friend std::ostream& operator<<(std::ostream& stream, const Tag& instance) { |
| 58 |
using Tag = F::Tag; |
| 59 |
switch (instance) { |
| 60 |
case Tag::Foo: stream << "Foo"; break; |
| 61 |
case Tag::Bar: stream << "Bar"; break; |
| 62 |
case Tag::Baz: stream << "Baz"; break; |
| 63 |
} |
| 64 |
return stream; |
| 65 |
} |
| 66 |
|
| 67 |
friend std::ostream& operator<<(std::ostream& stream, const F& instance) { |
| 68 |
using Tag = F::Tag; |
| 69 |
switch (instance.tag) { |
| 70 |
case Tag::Foo: stream << instance.foo; break; |
| 71 |
case Tag::Bar: stream << instance.bar; break; |
| 72 |
case Tag::Baz: stream << "Baz"; break; |
| 73 |
} |
| 74 |
return stream; |
| 75 |
} |
| 76 |
|
| 77 |
struct Foo_Body { |
| 78 |
Tag tag; |
| 79 |
int16_t _0; |
| 80 |
|
| 81 |
friend std::ostream& operator<<(std::ostream& stream, const Foo_Body& instance) { |
| 82 |
return stream << "{ " << "tag=" << instance.tag << ", " |
| 83 |
<< "_0=" << instance._0 << " }"; |
| 84 |
} |
| 85 |
}; |
| 86 |
|
| 87 |
struct Bar_Body { |
| 88 |
Tag tag; |
| 89 |
uint8_t x; |
| 90 |
int16_t y; |
| 91 |
|
| 92 |
friend std::ostream& operator<<(std::ostream& stream, const Bar_Body& instance) { |
| 93 |
return stream << "{ " << "tag=" << instance.tag << ", " |
| 94 |
<< "x=" << instance.x << ", " |
| 95 |
<< "y=" << instance.y << " }"; |
| 96 |
} |
| 97 |
}; |
| 98 |
|
| 99 |
struct { |
| 100 |
Tag tag; |
| 101 |
}; |
| 102 |
Foo_Body foo; |
| 103 |
Bar_Body bar; |
| 104 |
}; |
| 105 |
|
| 106 |
struct H { |
| 107 |
enum class Tag : uint8_t { |
| 108 |
Hello, |
| 109 |
There, |
| 110 |
Everyone, |
| 111 |
}; |
| 112 |
|
| 113 |
friend std::ostream& operator<<(std::ostream& stream, const Tag& instance) { |
| 114 |
using Tag = H::Tag; |
| 115 |
switch (instance) { |
| 116 |
case Tag::Hello: stream << "Hello"; break; |
| 117 |
case Tag::There: stream << "There"; break; |
| 118 |
case Tag::Everyone: stream << "Everyone"; break; |
| 119 |
} |
| 120 |
return stream; |
| 121 |
} |
| 122 |
|
| 123 |
friend std::ostream& operator<<(std::ostream& stream, const H& instance) { |
| 124 |
using Tag = H::Tag; |
| 125 |
switch (instance.tag) { |
| 126 |
case Tag::Hello: stream << "Hello" << instance.hello; break; |
| 127 |
case Tag::There: stream << "There" << instance.there; break; |
| 128 |
case Tag::Everyone: stream << "Everyone"; break; |
| 129 |
} |
| 130 |
return stream; |
| 131 |
} |
| 132 |
|
| 133 |
struct Hello_Body { |
| 134 |
int16_t _0; |
| 135 |
|
| 136 |
friend std::ostream& operator<<(std::ostream& stream, const Hello_Body& instance) { |
| 137 |
return stream << "{ " << "_0=" << instance._0 << " }"; |
| 138 |
} |
| 139 |
}; |
| 140 |
|
| 141 |
struct There_Body { |
| 142 |
uint8_t x; |
| 143 |
int16_t y; |
| 144 |
|
| 145 |
friend std::ostream& operator<<(std::ostream& stream, const There_Body& instance) { |
| 146 |
return stream << "{ " << "x=" << instance.x << ", " |
| 147 |
<< "y=" << instance.y << " }"; |
| 148 |
} |
| 149 |
}; |
| 150 |
|
| 151 |
Tag tag; |
| 152 |
union { |
| 153 |
Hello_Body hello; |
| 154 |
There_Body there; |
| 155 |
}; |
| 156 |
}; |
| 157 |
|
| 158 |
struct I { |
| 159 |
enum class Tag : uint8_t { |
| 160 |
ThereAgain, |
| 161 |
SomethingElse, |
| 162 |
}; |
| 163 |
|
| 164 |
struct ThereAgain_Body { |
| 165 |
uint8_t x; |
| 166 |
int16_t y; |
| 167 |
|
| 168 |
friend std::ostream& operator<<(std::ostream& stream, const ThereAgain_Body& instance) { |
| 169 |
return stream << "{ " << "x=" << instance.x << ", " |
| 170 |
<< "y=" << instance.y << " }"; |
| 171 |
} |
| 172 |
}; |
| 173 |
|
| 174 |
Tag tag; |
| 175 |
union { |
| 176 |
ThereAgain_Body there_again; |
| 177 |
}; |
| 178 |
}; |
| 179 |
|
| 180 |
extern "C" { |
| 181 |
|
| 182 |
void root(A a, B b, C c, D d, F f, H h, I i); |
| 183 |
|
| 184 |
} // extern "C" |