| ... | ... | @@ -98,8 +98,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 98 | 98 | ++ " " ++ default_enum_type ++ |
| 99 | 99 | \\; |
| 100 | 100 | \\pub const Bar = extern struct { |
| 101 | | \\ a: c_int, |
| 102 | | \\ b: c_int, |
| 101 | \\ a: c_int = @import("std").mem.zeroes(c_int), |
| 102 | \\ b: c_int = @import("std").mem.zeroes(c_int), |
| 103 | 103 | \\}; |
| 104 | 104 | }); |
| 105 | 105 | |
| ... | ... | @@ -149,11 +149,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 149 | 149 | \\#define PTR void * |
| 150 | 150 | , &[_][]const u8{ |
| 151 | 151 | \\pub const struct_Bar_1 = extern struct { |
| 152 | | \\ a: c_int, |
| 152 | \\ a: c_int = @import("std").mem.zeroes(c_int), |
| 153 | 153 | \\}; |
| 154 | 154 | \\pub const struct_Foo = extern struct { |
| 155 | | \\ a: c_int, |
| 156 | | \\ b: struct_Bar_1, |
| 155 | \\ a: c_int = @import("std").mem.zeroes(c_int), |
| 156 | \\ b: struct_Bar_1 = @import("std").mem.zeroes(struct_Bar_1), |
| 157 | 157 | \\}; |
| 158 | 158 | \\pub export var a: struct_Foo = struct_Foo{ |
| 159 | 159 | \\ .a = 0, |
| ... | ... | @@ -183,9 +183,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 183 | 183 | , &[_][]const u8{ |
| 184 | 184 | \\pub export fn foo() void { |
| 185 | 185 | \\ const struct_Foo = extern struct { |
| 186 | | \\ A: c_int, |
| 187 | | \\ B: c_int, |
| 188 | | \\ C: c_int, |
| 186 | \\ A: c_int = @import("std").mem.zeroes(c_int), |
| 187 | \\ B: c_int = @import("std").mem.zeroes(c_int), |
| 188 | \\ C: c_int = @import("std").mem.zeroes(c_int), |
| 189 | 189 | \\ }; |
| 190 | 190 | \\ var a: struct_Foo = struct_Foo{ |
| 191 | 191 | \\ .A = @as(c_int, 0), |
| ... | ... | @@ -195,9 +195,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 195 | 195 | \\ _ = @TypeOf(a); |
| 196 | 196 | \\ { |
| 197 | 197 | \\ const struct_Foo_1 = extern struct { |
| 198 | | \\ A: c_int, |
| 199 | | \\ B: c_int, |
| 200 | | \\ C: c_int, |
| 198 | \\ A: c_int = @import("std").mem.zeroes(c_int), |
| 199 | \\ B: c_int = @import("std").mem.zeroes(c_int), |
| 200 | \\ C: c_int = @import("std").mem.zeroes(c_int), |
| 201 | 201 | \\ }; |
| 202 | 202 | \\ var a_2: struct_Foo_1 = struct_Foo_1{ |
| 203 | 203 | \\ .A = @as(c_int, 0), |
| ... | ... | @@ -286,7 +286,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 286 | 286 | \\source.h:1:9: warning: struct demoted to opaque type - unable to translate type of field foo |
| 287 | 287 | \\pub const Foo = opaque {}; |
| 288 | 288 | \\pub const Bar = extern struct { |
| 289 | | \\ bar: ?*Foo, |
| 289 | \\ bar: ?*Foo = @import("std").mem.zeroes(?*Foo), |
| 290 | 290 | \\}; |
| 291 | 291 | }); |
| 292 | 292 | |
| ... | ... | @@ -375,10 +375,10 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 375 | 375 | \\#define B A(0.f) |
| 376 | 376 | , &[_][]const u8{ |
| 377 | 377 | \\pub const struct_Color = extern struct { |
| 378 | | \\ r: u8, |
| 379 | | \\ g: u8, |
| 380 | | \\ b: u8, |
| 381 | | \\ a: u8, |
| 378 | \\ r: u8 = @import("std").mem.zeroes(u8), |
| 379 | \\ g: u8 = @import("std").mem.zeroes(u8), |
| 380 | \\ b: u8 = @import("std").mem.zeroes(u8), |
| 381 | \\ a: u8 = @import("std").mem.zeroes(u8), |
| 382 | 382 | \\}; |
| 383 | 383 | \\pub const Color = struct_Color; |
| 384 | 384 | , |
| ... | ... | @@ -389,14 +389,14 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 389 | 389 | \\pub const LIGHTGRAY = @import("std").mem.zeroInit(CLITERAL(Color), .{ @as(c_int, 200), @as(c_int, 200), @as(c_int, 200), @as(c_int, 255) }); |
| 390 | 390 | , |
| 391 | 391 | \\pub const struct_boom_t = extern struct { |
| 392 | | \\ i1: c_int, |
| 392 | \\ i1: c_int = @import("std").mem.zeroes(c_int), |
| 393 | 393 | \\}; |
| 394 | 394 | \\pub const boom_t = struct_boom_t; |
| 395 | 395 | , |
| 396 | 396 | \\pub const FOO = @import("std").mem.zeroInit(boom_t, .{@as(c_int, 1)}); |
| 397 | 397 | , |
| 398 | 398 | \\pub const MyCStruct = extern struct { |
| 399 | | \\ x: f32, |
| 399 | \\ x: f32 = @import("std").mem.zeroes(f32), |
| 400 | 400 | \\}; |
| 401 | 401 | , |
| 402 | 402 | \\pub inline fn A(_x: anytype) MyCStruct { |
| ... | ... | @@ -452,7 +452,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 452 | 452 | \\}; |
| 453 | 453 | , &[_][]const u8{ |
| 454 | 454 | \\pub const struct_foo = extern struct { |
| 455 | | \\ bar: c_short align(1), |
| 455 | \\ bar: c_short align(1) = @import("std").mem.zeroes(c_short), |
| 456 | 456 | \\}; |
| 457 | 457 | }); |
| 458 | 458 | |
| ... | ... | @@ -461,7 +461,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 461 | 461 | \\struct bar { int x; int y[0]; }; |
| 462 | 462 | , &[_][]const u8{ |
| 463 | 463 | \\pub const struct_foo = extern struct { |
| 464 | | \\ x: c_int align(4), |
| 464 | \\ x: c_int align(4) = @import("std").mem.zeroes(c_int), |
| 465 | 465 | \\ pub fn y(self: anytype) @import("std").zig.c_translation.FlexibleArrayType(@TypeOf(self), c_int) { |
| 466 | 466 | \\ const Intermediate = @import("std").zig.c_translation.FlexibleArrayType(@TypeOf(self), u8); |
| 467 | 467 | \\ const ReturnType = @import("std").zig.c_translation.FlexibleArrayType(@TypeOf(self), c_int); |
| ... | ... | @@ -469,7 +469,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 469 | 469 | \\ } |
| 470 | 470 | \\}; |
| 471 | 471 | \\pub const struct_bar = extern struct { |
| 472 | | \\ x: c_int align(4), |
| 472 | \\ x: c_int align(4) = @import("std").mem.zeroes(c_int), |
| 473 | 473 | \\ pub fn y(self: anytype) @import("std").zig.c_translation.FlexibleArrayType(@TypeOf(self), c_int) { |
| 474 | 474 | \\ const Intermediate = @import("std").zig.c_translation.FlexibleArrayType(@TypeOf(self), u8); |
| 475 | 475 | \\ const ReturnType = @import("std").zig.c_translation.FlexibleArrayType(@TypeOf(self), c_int); |
| ... | ... | @@ -545,7 +545,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 545 | 545 | \\source.h:4:8: warning: struct demoted to opaque type - unable to translate type of field abufused |
| 546 | 546 | \\pub const struct_arcan_shmif_page = opaque {}; |
| 547 | 547 | \\pub const struct_arcan_shmif_cont = extern struct { |
| 548 | | \\ addr: ?*struct_arcan_shmif_page, |
| 548 | \\ addr: ?*struct_arcan_shmif_page = @import("std").mem.zeroes(?*struct_arcan_shmif_page), |
| 549 | 549 | \\}; |
| 550 | 550 | }); |
| 551 | 551 | |
| ... | ... | @@ -562,10 +562,10 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 562 | 562 | \\pub const fnptr_ty = ?*const fn () callconv(.C) void; |
| 563 | 563 | \\pub const fnptr_attr_ty = ?*const fn () callconv(.C) void; |
| 564 | 564 | \\pub const struct_foo = extern struct { |
| 565 | | \\ foo: ?*const fn () callconv(.C) void, |
| 566 | | \\ bar: ?*const fn () callconv(.C) void, |
| 567 | | \\ baz: fnptr_ty, |
| 568 | | \\ qux: fnptr_attr_ty, |
| 565 | \\ foo: ?*const fn () callconv(.C) void = @import("std").mem.zeroes(?*const fn () callconv(.C) void), |
| 566 | \\ bar: ?*const fn () callconv(.C) void = @import("std").mem.zeroes(?*const fn () callconv(.C) void), |
| 567 | \\ baz: fnptr_ty = @import("std").mem.zeroes(fnptr_ty), |
| 568 | \\ qux: fnptr_attr_ty = @import("std").mem.zeroes(fnptr_attr_ty), |
| 569 | 569 | \\}; |
| 570 | 570 | }); |
| 571 | 571 | |
| ... | ... | @@ -624,14 +624,14 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 624 | 624 | \\void foo(outer *x) { x->y = x->x; } |
| 625 | 625 | , &[_][]const u8{ |
| 626 | 626 | \\const struct_unnamed_2 = extern struct { |
| 627 | | \\ y: c_int, |
| 627 | \\ y: c_int = @import("std").mem.zeroes(c_int), |
| 628 | 628 | \\}; |
| 629 | 629 | \\const union_unnamed_1 = extern union { |
| 630 | 630 | \\ x: u8, |
| 631 | 631 | \\ unnamed_0: struct_unnamed_2, |
| 632 | 632 | \\}; |
| 633 | 633 | \\pub const outer = extern struct { |
| 634 | | \\ unnamed_0: union_unnamed_1, |
| 634 | \\ unnamed_0: union_unnamed_1 = @import("std").mem.zeroes(union_unnamed_1), |
| 635 | 635 | \\}; |
| 636 | 636 | \\pub export fn foo(arg_x: [*c]outer) void { |
| 637 | 637 | \\ var x = arg_x; |
| ... | ... | @@ -669,12 +669,12 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 669 | 669 | \\foo s3 = { 123 }; |
| 670 | 670 | , &[_][]const u8{ |
| 671 | 671 | \\pub const foo = extern struct { |
| 672 | | \\ x: c_int, |
| 672 | \\ x: c_int = @import("std").mem.zeroes(c_int), |
| 673 | 673 | \\}; |
| 674 | 674 | \\const struct_unnamed_1 = extern struct { |
| 675 | | \\ x: f64, |
| 676 | | \\ y: f64, |
| 677 | | \\ z: f64, |
| 675 | \\ x: f64 = @import("std").mem.zeroes(f64), |
| 676 | \\ y: f64 = @import("std").mem.zeroes(f64), |
| 677 | \\ z: f64 = @import("std").mem.zeroes(f64), |
| 678 | 678 | \\}; |
| 679 | 679 | \\pub export var s0: struct_unnamed_1 = struct_unnamed_1{ |
| 680 | 680 | \\ .x = 1.2, |
| ... | ... | @@ -682,12 +682,12 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 682 | 682 | \\ .z = 0, |
| 683 | 683 | \\}; |
| 684 | 684 | \\const struct_unnamed_2 = extern struct { |
| 685 | | \\ sec: c_int, |
| 686 | | \\ min: c_int, |
| 687 | | \\ hour: c_int, |
| 688 | | \\ day: c_int, |
| 689 | | \\ mon: c_int, |
| 690 | | \\ year: c_int, |
| 685 | \\ sec: c_int = @import("std").mem.zeroes(c_int), |
| 686 | \\ min: c_int = @import("std").mem.zeroes(c_int), |
| 687 | \\ hour: c_int = @import("std").mem.zeroes(c_int), |
| 688 | \\ day: c_int = @import("std").mem.zeroes(c_int), |
| 689 | \\ mon: c_int = @import("std").mem.zeroes(c_int), |
| 690 | \\ year: c_int = @import("std").mem.zeroes(c_int), |
| 691 | 691 | \\}; |
| 692 | 692 | \\pub export var s1: struct_unnamed_2 = struct_unnamed_2{ |
| 693 | 693 | \\ .sec = @as(c_int, 30), |
| ... | ... | @@ -698,8 +698,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 698 | 698 | \\ .year = @as(c_int, 2014), |
| 699 | 699 | \\}; |
| 700 | 700 | \\const struct_unnamed_3 = extern struct { |
| 701 | | \\ x: c_int, |
| 702 | | \\ y: c_int, |
| 701 | \\ x: c_int = @import("std").mem.zeroes(c_int), |
| 702 | \\ y: c_int = @import("std").mem.zeroes(c_int), |
| 703 | 703 | \\}; |
| 704 | 704 | \\pub export var s2: struct_unnamed_3 = struct_unnamed_3{ |
| 705 | 705 | \\ .x = @as(c_int, 1), |
| ... | ... | @@ -730,9 +730,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 730 | 730 | \\struct {int x,y,z;} __attribute__((packed)) s0 = {1, 2}; |
| 731 | 731 | , &[_][]const u8{ |
| 732 | 732 | \\const struct_unnamed_1 = extern struct { |
| 733 | | \\ x: c_int align(1), |
| 734 | | \\ y: c_int align(1), |
| 735 | | \\ z: c_int align(1), |
| 733 | \\ x: c_int align(1) = @import("std").mem.zeroes(c_int), |
| 734 | \\ y: c_int align(1) = @import("std").mem.zeroes(c_int), |
| 735 | \\ z: c_int align(1) = @import("std").mem.zeroes(c_int), |
| 736 | 736 | \\}; |
| 737 | 737 | \\pub export var s0: struct_unnamed_1 = struct_unnamed_1{ |
| 738 | 738 | \\ .x = @as(c_int, 1), |
| ... | ... | @@ -977,8 +977,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 977 | 977 | , &[_][]const u8{ |
| 978 | 978 | \\pub const lws_callback_function = fn () callconv(.C) void; |
| 979 | 979 | \\pub const struct_Foo = extern struct { |
| 980 | | \\ func: ?*const fn () callconv(.C) void, |
| 981 | | \\ callback_http: ?*const lws_callback_function, |
| 980 | \\ func: ?*const fn () callconv(.C) void = @import("std").mem.zeroes(?*const fn () callconv(.C) void), |
| 981 | \\ callback_http: ?*const lws_callback_function = @import("std").mem.zeroes(?*const lws_callback_function), |
| 982 | 982 | \\}; |
| 983 | 983 | }); |
| 984 | 984 | |
| ... | ... | @@ -993,7 +993,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 993 | 993 | \\pub const struct_Foo = opaque {}; |
| 994 | 994 | , |
| 995 | 995 | \\pub const struct_Bar = extern struct { |
| 996 | | \\ foo: ?*struct_Foo, |
| 996 | \\ foo: ?*struct_Foo = @import("std").mem.zeroes(?*struct_Foo), |
| 997 | 997 | \\}; |
| 998 | 998 | }); |
| 999 | 999 | |
| ... | ... | @@ -1025,13 +1025,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1025 | 1025 | \\}; |
| 1026 | 1026 | , &[_][]const u8{ |
| 1027 | 1027 | \\pub const struct_Foo = extern struct { |
| 1028 | | \\ a: [*c]Foo, |
| 1028 | \\ a: [*c]Foo = @import("std").mem.zeroes([*c]Foo), |
| 1029 | 1029 | \\}; |
| 1030 | 1030 | , |
| 1031 | 1031 | \\pub const Foo = struct_Foo; |
| 1032 | 1032 | , |
| 1033 | 1033 | \\pub const struct_Bar = extern struct { |
| 1034 | | \\ a: [*c]Foo, |
| 1034 | \\ a: [*c]Foo = @import("std").mem.zeroes([*c]Foo), |
| 1035 | 1035 | \\}; |
| 1036 | 1036 | , |
| 1037 | 1037 | \\pub const Bar = struct_Bar; |
| ... | ... | @@ -1044,8 +1044,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1044 | 1044 | \\}; |
| 1045 | 1045 | , &[_][]const u8{ |
| 1046 | 1046 | \\const struct_Foo = extern struct { |
| 1047 | | \\ x: c_int, |
| 1048 | | \\ y: [*c]u8, |
| 1047 | \\ x: c_int = @import("std").mem.zeroes(c_int), |
| 1048 | \\ y: [*c]u8 = @import("std").mem.zeroes([*c]u8), |
| 1049 | 1049 | \\}; |
| 1050 | 1050 | , |
| 1051 | 1051 | \\pub const Foo = struct_Foo; |
| ... | ... | @@ -1057,7 +1057,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1057 | 1057 | \\}; |
| 1058 | 1058 | , &[_][]const u8{ |
| 1059 | 1059 | \\pub const struct_Foo = extern struct { |
| 1060 | | \\ derp: ?*const fn ([*c]struct_Foo) callconv(.C) void, |
| 1060 | \\ derp: ?*const fn ([*c]struct_Foo) callconv(.C) void = @import("std").mem.zeroes(?*const fn ([*c]struct_Foo) callconv(.C) void), |
| 1061 | 1061 | \\}; |
| 1062 | 1062 | , |
| 1063 | 1063 | \\pub const Foo = struct_Foo; |
| ... | ... | @@ -1101,11 +1101,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1101 | 1101 | \\}; |
| 1102 | 1102 | , &[_][]const u8{ |
| 1103 | 1103 | \\pub const struct_Bar = extern struct { |
| 1104 | | \\ next: [*c]struct_Foo, |
| 1104 | \\ next: [*c]struct_Foo = @import("std").mem.zeroes([*c]struct_Foo), |
| 1105 | 1105 | \\}; |
| 1106 | 1106 | , |
| 1107 | 1107 | \\pub const struct_Foo = extern struct { |
| 1108 | | \\ next: [*c]struct_Bar, |
| 1108 | \\ next: [*c]struct_Bar = @import("std").mem.zeroes([*c]struct_Bar), |
| 1109 | 1109 | \\}; |
| 1110 | 1110 | }); |
| 1111 | 1111 | |
| ... | ... | @@ -1121,7 +1121,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1121 | 1121 | \\}; |
| 1122 | 1122 | , &[_][]const u8{ |
| 1123 | 1123 | \\pub const struct_comptime = extern struct { |
| 1124 | | \\ @"defer": c_int, |
| 1124 | \\ @"defer": c_int = @import("std").mem.zeroes(c_int), |
| 1125 | 1125 | \\}; |
| 1126 | 1126 | , |
| 1127 | 1127 | \\pub const @"comptime" = struct_comptime; |
| ... | ... | @@ -1421,8 +1421,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1421 | 1421 | // even though the parent struct is |
| 1422 | 1422 | // this is consistent with GCC docs |
| 1423 | 1423 | \\const struct_unnamed_1 = extern struct { |
| 1424 | | \\ a: u8, |
| 1425 | | \\ b: c_int, |
| 1424 | \\ a: u8 = @import("std").mem.zeroes(u8), |
| 1425 | \\ b: c_int = @import("std").mem.zeroes(c_int), |
| 1426 | 1426 | \\}; |
| 1427 | 1427 | , |
| 1428 | 1428 | \\pub const union_Foo = extern union { |
| ... | ... | @@ -1448,8 +1448,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1448 | 1448 | // have an independent packed declaration on |
| 1449 | 1449 | // the nested type (see GCC docs for details) |
| 1450 | 1450 | \\const struct_unnamed_1 = extern struct { |
| 1451 | | \\ a: u8 align(1), |
| 1452 | | \\ b: c_int align(1), |
| 1451 | \\ a: u8 align(1) = @import("std").mem.zeroes(u8), |
| 1452 | \\ b: c_int align(1) = @import("std").mem.zeroes(c_int), |
| 1453 | 1453 | \\}; |
| 1454 | 1454 | , |
| 1455 | 1455 | \\pub const union_Foo = extern union { |
| ... | ... | @@ -1905,8 +1905,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1905 | 1905 | ++ " " ++ default_enum_type ++ |
| 1906 | 1906 | \\; |
| 1907 | 1907 | \\pub const struct_Baz = extern struct { |
| 1908 | | \\ l: enum_unnamed_2, |
| 1909 | | \\ m: d, |
| 1908 | \\ l: enum_unnamed_2 = @import("std").mem.zeroes(enum_unnamed_2), |
| 1909 | \\ m: d = @import("std").mem.zeroes(d), |
| 1910 | 1910 | \\}; |
| 1911 | 1911 | \\pub const n: c_int = 0; |
| 1912 | 1912 | \\pub const o: c_int = 1; |
| ... | ... | @@ -2010,7 +2010,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2010 | 2010 | \\pub const PFNGLCLEARPROC = ?*const fn (GLbitfield) callconv(.C) void; |
| 2011 | 2011 | \\pub const OpenGLProc = ?*const fn () callconv(.C) void; |
| 2012 | 2012 | \\const struct_unnamed_1 = extern struct { |
| 2013 | | \\ Clear: PFNGLCLEARPROC, |
| 2013 | \\ Clear: PFNGLCLEARPROC = @import("std").mem.zeroes(PFNGLCLEARPROC), |
| 2014 | 2014 | \\}; |
| 2015 | 2015 | \\pub const union_OpenGLProcs = extern union { |
| 2016 | 2016 | \\ ptr: [1]OpenGLProc, |
| ... | ... | @@ -2362,10 +2362,10 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2362 | 2362 | \\}; |
| 2363 | 2363 | , &[_][]const u8{ |
| 2364 | 2364 | \\pub const struct_Bar_1 = extern struct { |
| 2365 | | \\ b: c_int, |
| 2365 | \\ b: c_int = @import("std").mem.zeroes(c_int), |
| 2366 | 2366 | \\}; |
| 2367 | 2367 | \\pub const struct_Foo = extern struct { |
| 2368 | | \\ c: struct_Bar_1, |
| 2368 | \\ c: struct_Bar_1 = @import("std").mem.zeroes(struct_Bar_1), |
| 2369 | 2369 | \\}; |
| 2370 | 2370 | }); |
| 2371 | 2371 | } |
| ... | ... | @@ -2576,8 +2576,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2576 | 2576 | \\void func(struct Foo *a, enum Bar **b); |
| 2577 | 2577 | , &[_][]const u8{ |
| 2578 | 2578 | \\pub const struct_Foo = extern struct { |
| 2579 | | \\ x: c_int, |
| 2580 | | \\ y: c_int, |
| 2579 | \\ x: c_int = @import("std").mem.zeroes(c_int), |
| 2580 | \\ y: c_int = @import("std").mem.zeroes(c_int), |
| 2581 | 2581 | \\}; |
| 2582 | 2582 | \\pub const BarA: c_int = 0; |
| 2583 | 2583 | \\pub const BarB: c_int = 1; |
| ... | ... | @@ -2694,7 +2694,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2694 | 2694 | \\} |
| 2695 | 2695 | , &[_][]const u8{ |
| 2696 | 2696 | \\pub const struct_Foo = extern struct { |
| 2697 | | \\ b: c_int, |
| 2697 | \\ b: c_int = @import("std").mem.zeroes(c_int), |
| 2698 | 2698 | \\}; |
| 2699 | 2699 | \\pub extern var a: struct_Foo; |
| 2700 | 2700 | \\pub export var b: f32 = 2.0; |
| ... | ... | @@ -3604,12 +3604,12 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3604 | 3604 | \\} ONENAMEWITHSTRUCT; |
| 3605 | 3605 | , &[_][]const u8{ |
| 3606 | 3606 | \\pub const struct_NAMED = extern struct { |
| 3607 | | \\ name: c_long, |
| 3607 | \\ name: c_long = @import("std").mem.zeroes(c_long), |
| 3608 | 3608 | \\}; |
| 3609 | 3609 | \\pub const NAMED = struct_NAMED; |
| 3610 | 3610 | \\pub const struct_ONENAMEWITHSTRUCT = extern struct { |
| 3611 | | \\ unnamed_0: struct_NAMED, |
| 3612 | | \\ b: c_long, |
| 3611 | \\ unnamed_0: struct_NAMED = = @import("std").mem.zeroes(struct_NAMED), |
| 3612 | \\ b: c_long = @import("std").mem.zeroes(c_long), |
| 3613 | 3613 | \\}; |
| 3614 | 3614 | }); |
| 3615 | 3615 | } else { |
| ... | ... | @@ -3626,11 +3626,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3626 | 3626 | \\} ONENAMEWITHSTRUCT; |
| 3627 | 3627 | , &[_][]const u8{ |
| 3628 | 3628 | \\pub const struct_NAMED = extern struct { |
| 3629 | | \\ name: c_long, |
| 3629 | \\ name: c_long = @import("std").mem.zeroes(c_long), |
| 3630 | 3630 | \\}; |
| 3631 | 3631 | \\pub const NAMED = struct_NAMED; |
| 3632 | 3632 | \\pub const struct_ONENAMEWITHSTRUCT = extern struct { |
| 3633 | | \\ b: c_long, |
| 3633 | \\ b: c_long = @import("std").mem.zeroes(c_long), |
| 3634 | 3634 | \\}; |
| 3635 | 3635 | }); |
| 3636 | 3636 | } |
| ... | ... | @@ -3645,11 +3645,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3645 | 3645 | , &[_][]const u8{ |
| 3646 | 3646 | \\const struct_unnamed_1 = extern struct {}; |
| 3647 | 3647 | \\pub const struct_a = extern struct { |
| 3648 | | \\ unnamed_0: struct_unnamed_1, |
| 3648 | \\ unnamed_0: struct_unnamed_1 = @import("std").mem.zeroes(struct_unnamed_1), |
| 3649 | 3649 | \\}; |
| 3650 | 3650 | \\const struct_unnamed_2 = extern struct {}; |
| 3651 | 3651 | \\pub const struct_b = extern struct { |
| 3652 | | \\ unnamed_0: struct_unnamed_2, |
| 3652 | \\ unnamed_0: struct_unnamed_2 = @import("std").mem.zeroes(struct_unnamed_2), |
| 3653 | 3653 | \\}; |
| 3654 | 3654 | }); |
| 3655 | 3655 | |
| ... | ... | @@ -3783,8 +3783,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3783 | 3783 | \\pub const struct_inner = opaque {}; |
| 3784 | 3784 | , |
| 3785 | 3785 | \\pub const struct_outer = extern struct { |
| 3786 | | \\ thing: c_int, |
| 3787 | | \\ sub_struct: struct_inner, |
| 3786 | \\ thing: c_int = @import("std").mem.zeroes(c_int), |
| 3787 | \\ sub_struct: struct_inner = @import("std").mem.zeroes(struct_inner), |
| 3788 | 3788 | \\}; |
| 3789 | 3789 | , |
| 3790 | 3790 | \\warning: unable to translate function, demoted to extern |
| ... | ... | @@ -3812,8 +3812,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3812 | 3812 | \\} |
| 3813 | 3813 | , &[_][]const u8{ |
| 3814 | 3814 | \\pub const struct_FOO = extern struct { |
| 3815 | | \\ x: c_int, |
| 3816 | | \\ y: c_int, |
| 3815 | \\ x: c_int = @import("std").mem.zeroes(c_int), |
| 3816 | \\ y: c_int = @import("std").mem.zeroes(c_int), |
| 3817 | 3817 | \\}; |
| 3818 | 3818 | \\pub export fn bar() c_int { |
| 3819 | 3819 | \\ const foo = struct { |
| ... | ... | @@ -4143,7 +4143,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 4143 | 4143 | \\const char *struct_foo = "hello world"; |
| 4144 | 4144 | , &[_][]const u8{ |
| 4145 | 4145 | \\pub const struct_foo_1 = extern struct { |
| 4146 | | \\ x: c_int, |
| 4146 | \\ x: c_int = @import("std").mem.zeroes(c_int), |
| 4147 | 4147 | \\}; |
| 4148 | 4148 | , |
| 4149 | 4149 | \\pub const foo = struct_foo_1; |