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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467
|
/* structs_struct_initializer_list_nested.c generated by valac, the Vala compiler
* generated from structs_struct_initializer_list_nested.vala, do not modify */
#include <glib-object.h>
#include <glib.h>
#include <string.h>
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif
#define TYPE_FOO (foo_get_type ())
typedef struct _Foo Foo;
#define TYPE_BAR (bar_get_type ())
typedef struct _Bar Bar;
#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
#define TYPE_MANAM (manam_get_type ())
typedef struct _Manam Manam;
#define TYPE_BAZ (baz_get_type ())
typedef struct _Baz Baz;
#define _bar_free0(var) ((var == NULL) ? NULL : (var = (bar_free (var), NULL)))
#define _manam_free0(var) ((var == NULL) ? NULL : (var = (manam_free (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
struct _Foo {
gint i;
gint j;
};
struct _Bar {
Foo a;
Foo* b;
};
struct _Manam {
Foo a;
Bar b;
};
struct _Baz {
Foo f;
};
VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
VALA_EXTERN Foo* foo_dup (const Foo* self);
VALA_EXTERN void foo_free (Foo* self);
VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
VALA_EXTERN Bar* bar_dup (const Bar* self);
VALA_EXTERN void bar_free (Bar* self);
VALA_EXTERN void bar_copy (const Bar* self,
Bar* dest);
VALA_EXTERN void bar_destroy (Bar* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Bar, bar_destroy)
VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
VALA_EXTERN Manam* manam_dup (const Manam* self);
VALA_EXTERN void manam_free (Manam* self);
VALA_EXTERN void manam_copy (const Manam* self,
Manam* dest);
VALA_EXTERN void manam_destroy (Manam* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (Manam, manam_destroy)
VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
VALA_EXTERN Baz* baz_dup (const Baz* self);
VALA_EXTERN void baz_free (Baz* self);
static void _vala_main (void);
const Baz BAZ = {{23, 42}};
const Baz BAZ_A[2] = {{{23, 42}}, {{47, 11}}};
Foo*
foo_dup (const Foo* self)
{
Foo* dup;
dup = g_new0 (Foo, 1);
memcpy (dup, self, sizeof (Foo));
return dup;
}
void
foo_free (Foo* self)
{
g_free (self);
}
static GType
foo_get_type_once (void)
{
GType foo_type_id;
foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) foo_free);
return foo_type_id;
}
GType
foo_get_type (void)
{
static volatile gsize foo_type_id__once = 0;
if (g_once_init_enter (&foo_type_id__once)) {
GType foo_type_id;
foo_type_id = foo_get_type_once ();
g_once_init_leave (&foo_type_id__once, foo_type_id);
}
return foo_type_id__once;
}
static gpointer
_foo_dup0 (gpointer self)
{
return self ? foo_dup (self) : NULL;
}
void
bar_copy (const Bar* self,
Bar* dest)
{
Foo _tmp0_;
Foo* _tmp1_;
Foo* _tmp2_;
_tmp0_ = (*self).a;
(*dest).a = _tmp0_;
_tmp1_ = (*self).b;
_tmp2_ = _foo_dup0 (_tmp1_);
_foo_free0 ((*dest).b);
(*dest).b = _tmp2_;
}
void
bar_destroy (Bar* self)
{
_foo_free0 ((*self).b);
}
Bar*
bar_dup (const Bar* self)
{
Bar* dup;
dup = g_new0 (Bar, 1);
bar_copy (self, dup);
return dup;
}
void
bar_free (Bar* self)
{
bar_destroy (self);
g_free (self);
}
static GType
bar_get_type_once (void)
{
GType bar_type_id;
bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) bar_free);
return bar_type_id;
}
GType
bar_get_type (void)
{
static volatile gsize bar_type_id__once = 0;
if (g_once_init_enter (&bar_type_id__once)) {
GType bar_type_id;
bar_type_id = bar_get_type_once ();
g_once_init_leave (&bar_type_id__once, bar_type_id);
}
return bar_type_id__once;
}
void
manam_copy (const Manam* self,
Manam* dest)
{
Foo _tmp0_;
Bar _tmp1_;
Bar _tmp2_;
Bar _tmp3_ = {0};
_tmp0_ = (*self).a;
(*dest).a = _tmp0_;
_tmp1_ = (*self).b;
_tmp2_ = _tmp1_;
bar_copy (&_tmp2_, &_tmp3_);
bar_destroy (&(*dest).b);
(*dest).b = _tmp3_;
}
void
manam_destroy (Manam* self)
{
bar_destroy (&(*self).b);
}
Manam*
manam_dup (const Manam* self)
{
Manam* dup;
dup = g_new0 (Manam, 1);
manam_copy (self, dup);
return dup;
}
void
manam_free (Manam* self)
{
manam_destroy (self);
g_free (self);
}
static GType
manam_get_type_once (void)
{
GType manam_type_id;
manam_type_id = g_boxed_type_register_static ("Manam", (GBoxedCopyFunc) manam_dup, (GBoxedFreeFunc) manam_free);
return manam_type_id;
}
GType
manam_get_type (void)
{
static volatile gsize manam_type_id__once = 0;
if (g_once_init_enter (&manam_type_id__once)) {
GType manam_type_id;
manam_type_id = manam_get_type_once ();
g_once_init_leave (&manam_type_id__once, manam_type_id);
}
return manam_type_id__once;
}
Baz*
baz_dup (const Baz* self)
{
Baz* dup;
dup = g_new0 (Baz, 1);
memcpy (dup, self, sizeof (Baz));
return dup;
}
void
baz_free (Baz* self)
{
g_free (self);
}
static GType
baz_get_type_once (void)
{
GType baz_type_id;
baz_type_id = g_boxed_type_register_static ("Baz", (GBoxedCopyFunc) baz_dup, (GBoxedFreeFunc) baz_free);
return baz_type_id;
}
GType
baz_get_type (void)
{
static volatile gsize baz_type_id__once = 0;
if (g_once_init_enter (&baz_type_id__once)) {
GType baz_type_id;
baz_type_id = baz_get_type_once ();
g_once_init_leave (&baz_type_id__once, baz_type_id);
}
return baz_type_id__once;
}
static gpointer
_bar_dup0 (gpointer self)
{
return self ? bar_dup (self) : NULL;
}
static gpointer
_manam_dup0 (gpointer self)
{
return self ? manam_dup (self) : NULL;
}
static void
_vala_main (void)
{
{
static const Baz LOCAL_BAZ = {{23, 42}};
}
{
static const Baz LOCAL_BAZ_A[2] = {{{23, 42}}, {{47, 11}}};
}
{
Bar bar = {0};
Foo _tmp0_;
Foo* _tmp1_;
Bar _tmp2_ = {0};
Bar _tmp3_;
Foo _tmp4_;
Bar _tmp5_;
Foo* _tmp6_;
_tmp0_ = (Foo) {42, 11};
_tmp1_ = _foo_dup0 (&_tmp0_);
_tmp2_.a = (Foo) {23, 47};
_foo_free0 (_tmp2_.b);
_tmp2_.b = _tmp1_;
bar = _tmp2_;
_tmp3_ = bar;
_tmp4_ = _tmp3_.a;
_vala_assert (_tmp4_.j == 47, "bar.a.j == 47");
_tmp5_ = bar;
_tmp6_ = _tmp5_.b;
_vala_assert ((*_tmp6_).i == 42, "bar.b.i == 42");
bar_destroy (&bar);
}
{
Bar* bar = NULL;
Foo _tmp7_;
Foo* _tmp8_;
Bar _tmp9_ = {0};
Bar _tmp10_;
Bar* _tmp11_;
Bar* _tmp12_;
Foo _tmp13_;
Foo* _tmp14_;
_tmp7_ = (Foo) {42, 11};
_tmp8_ = _foo_dup0 (&_tmp7_);
_tmp9_.a = (Foo) {23, 47};
_foo_free0 (_tmp9_.b);
_tmp9_.b = _tmp8_;
_tmp10_ = _tmp9_;
_tmp11_ = _bar_dup0 (&_tmp10_);
_tmp12_ = _tmp11_;
bar_destroy (&_tmp10_);
bar = _tmp12_;
_tmp13_ = (*bar).a;
_vala_assert (_tmp13_.i == 23, "bar.a.i == 23");
_tmp14_ = (*bar).b;
_vala_assert ((*_tmp14_).j == 11, "bar.b.j == 11");
_bar_free0 (bar);
}
{
Bar bar = {0};
Bar _tmp15_ = {0};
Foo _tmp16_;
Foo* _tmp17_;
Bar _tmp18_ = {0};
Bar _tmp19_;
Foo _tmp20_;
Bar _tmp21_;
Foo* _tmp22_;
bar = _tmp15_;
_tmp16_ = (Foo) {42, 11};
_tmp17_ = _foo_dup0 (&_tmp16_);
_tmp18_.a = (Foo) {23, 47};
_foo_free0 (_tmp18_.b);
_tmp18_.b = _tmp17_;
bar_destroy (&bar);
bar = _tmp18_;
_tmp19_ = bar;
_tmp20_ = _tmp19_.a;
_vala_assert (_tmp20_.j == 47, "bar.a.j == 47");
_tmp21_ = bar;
_tmp22_ = _tmp21_.b;
_vala_assert ((*_tmp22_).i == 42, "bar.b.i == 42");
bar_destroy (&bar);
}
{
Manam manam = {0};
Foo _tmp23_;
Foo* _tmp24_;
Manam _tmp25_ = {0};
Manam _tmp26_;
Foo _tmp27_;
Manam _tmp28_;
Bar _tmp29_;
Foo* _tmp30_;
_tmp23_ = (Foo) {42, 11};
_tmp24_ = _foo_dup0 (&_tmp23_);
_tmp25_.a = (Foo) {23, 42};
bar_destroy (&_tmp25_.b);
_tmp25_.b = (Bar) {(Foo) {23, 47}, _tmp24_};
manam = _tmp25_;
_tmp26_ = manam;
_tmp27_ = _tmp26_.a;
_vala_assert (_tmp27_.i == 23, "manam.a.i == 23");
_tmp28_ = manam;
_tmp29_ = _tmp28_.b;
_tmp30_ = _tmp29_.b;
_vala_assert ((*_tmp30_).j == 11, "manam.b.b.j == 11");
manam_destroy (&manam);
}
{
Manam manam = {0};
Manam _tmp31_ = {0};
Foo _tmp32_;
Foo* _tmp33_;
Manam _tmp34_ = {0};
Manam _tmp35_;
Foo _tmp36_;
Manam _tmp37_;
Bar _tmp38_;
Foo* _tmp39_;
manam = _tmp31_;
_tmp32_ = (Foo) {42, 11};
_tmp33_ = _foo_dup0 (&_tmp32_);
_tmp34_.a = (Foo) {23, 42};
bar_destroy (&_tmp34_.b);
_tmp34_.b = (Bar) {(Foo) {23, 47}, _tmp33_};
manam_destroy (&manam);
manam = _tmp34_;
_tmp35_ = manam;
_tmp36_ = _tmp35_.a;
_vala_assert (_tmp36_.i == 23, "manam.a.i == 23");
_tmp37_ = manam;
_tmp38_ = _tmp37_.b;
_tmp39_ = _tmp38_.b;
_vala_assert ((*_tmp39_).j == 11, "manam.b.b.j == 11");
manam_destroy (&manam);
}
{
Manam* manam = NULL;
Foo _tmp40_;
Foo* _tmp41_;
Manam _tmp42_ = {0};
Manam _tmp43_;
Manam* _tmp44_;
Manam* _tmp45_;
Foo _tmp46_;
Bar _tmp47_;
Foo _tmp48_;
_tmp40_ = (Foo) {42, 11};
_tmp41_ = _foo_dup0 (&_tmp40_);
_tmp42_.a = (Foo) {23, 42};
bar_destroy (&_tmp42_.b);
_tmp42_.b = (Bar) {(Foo) {23, 47}, _tmp41_};
_tmp43_ = _tmp42_;
_tmp44_ = _manam_dup0 (&_tmp43_);
_tmp45_ = _tmp44_;
manam_destroy (&_tmp43_);
manam = _tmp45_;
_tmp46_ = (*manam).a;
_vala_assert (_tmp46_.j == 42, "manam.a.j == 42");
_tmp47_ = (*manam).b;
_tmp48_ = _tmp47_.a;
_vala_assert (_tmp48_.i == 23, "manam.b.a.i == 23");
_manam_free0 (manam);
}
}
int
main (int argc,
char ** argv)
{
_vala_main ();
return 0;
}
|