| ... | @@ -37,6 +37,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -37,6 +37,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 37 | , &[_][]const u8{ | 37 | , &[_][]const u8{ |
| 38 | \\pub export fn foo(arg_a: c_int) void { | 38 | \\pub export fn foo(arg_a: c_int) void { |
| 39 | \\ var a = arg_a; | 39 | \\ var a = arg_a; |
| | 40 | \\ _ = &a; |
| 40 | \\ while (true) { | 41 | \\ while (true) { |
| 41 | \\ if (a != 0) break; | 42 | \\ if (a != 0) break; |
| 42 | \\ } | 43 | \\ } |
| ... | @@ -81,9 +82,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -81,9 +82,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 81 | , &[_][]const u8{ | 82 | , &[_][]const u8{ |
| 82 | \\pub export fn foo(arg_x: c_ulong) c_ulong { | 83 | \\pub export fn foo(arg_x: c_ulong) c_ulong { |
| 83 | \\ var x = arg_x; | 84 | \\ var x = arg_x; |
| | 85 | \\ _ = &x; |
| 84 | \\ const union_unnamed_1 = extern union { | 86 | \\ const union_unnamed_1 = extern union { |
| 85 | \\ _x: c_ulong, | 87 | \\ _x: c_ulong, |
| 86 | \\ }; | 88 | \\ }; |
| | 89 | \\ _ = &union_unnamed_1; |
| 87 | \\ return (union_unnamed_1{ | 90 | \\ return (union_unnamed_1{ |
| 88 | \\ ._x = x, | 91 | \\ ._x = x, |
| 89 | \\ })._x; | 92 | \\ })._x; |
| ... | @@ -142,6 +145,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -142,6 +145,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 142 | \\pub extern fn bar(...) c_int; | 145 | \\pub extern fn bar(...) c_int; |
| 143 | \\pub export fn foo() void { | 146 | \\pub export fn foo() void { |
| 144 | \\ var a: c_int = undefined; | 147 | \\ var a: c_int = undefined; |
| | 148 | \\ _ = &a; |
| 145 | \\ if (a != 0) a = 2 else _ = bar(); | 149 | \\ if (a != 0) a = 2 else _ = bar(); |
| 146 | \\} | 150 | \\} |
| 147 | }); | 151 | }); |
| ... | @@ -194,6 +198,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -194,6 +198,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 194 | \\ B: c_int = @import("std").mem.zeroes(c_int), | 198 | \\ B: c_int = @import("std").mem.zeroes(c_int), |
| 195 | \\ C: c_int = @import("std").mem.zeroes(c_int), | 199 | \\ C: c_int = @import("std").mem.zeroes(c_int), |
| 196 | \\ }; | 200 | \\ }; |
| | 201 | \\ _ = &struct_Foo; |
| 197 | \\ var a: struct_Foo = struct_Foo{ | 202 | \\ var a: struct_Foo = struct_Foo{ |
| 198 | \\ .A = @as(c_int, 0), | 203 | \\ .A = @as(c_int, 0), |
| 199 | \\ .B = 0, | 204 | \\ .B = 0, |
| ... | @@ -206,6 +211,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -206,6 +211,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 206 | \\ B: c_int = @import("std").mem.zeroes(c_int), | 211 | \\ B: c_int = @import("std").mem.zeroes(c_int), |
| 207 | \\ C: c_int = @import("std").mem.zeroes(c_int), | 212 | \\ C: c_int = @import("std").mem.zeroes(c_int), |
| 208 | \\ }; | 213 | \\ }; |
| | 214 | \\ _ = &struct_Foo_1; |
| 209 | \\ var a_2: struct_Foo_1 = struct_Foo_1{ | 215 | \\ var a_2: struct_Foo_1 = struct_Foo_1{ |
| 210 | \\ .A = @as(c_int, 0), | 216 | \\ .A = @as(c_int, 0), |
| 211 | \\ .B = 0, | 217 | \\ .B = 0, |
| ... | @@ -242,6 +248,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -242,6 +248,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 242 | \\ }; | 248 | \\ }; |
| 243 | \\ _ = &union_unnamed_1; | 249 | \\ _ = &union_unnamed_1; |
| 244 | \\ const Foo = union_unnamed_1; | 250 | \\ const Foo = union_unnamed_1; |
| | 251 | \\ _ = &Foo; |
| 245 | \\ var a: Foo = Foo{ | 252 | \\ var a: Foo = Foo{ |
| 246 | \\ .A = @as(c_int, 0), | 253 | \\ .A = @as(c_int, 0), |
| 247 | \\ }; | 254 | \\ }; |
| ... | @@ -254,6 +261,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -254,6 +261,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 254 | \\ }; | 261 | \\ }; |
| 255 | \\ _ = &union_unnamed_2; | 262 | \\ _ = &union_unnamed_2; |
| 256 | \\ const Foo_1 = union_unnamed_2; | 263 | \\ const Foo_1 = union_unnamed_2; |
| | 264 | \\ _ = &Foo_1; |
| 257 | \\ var a_2: Foo_1 = Foo_1{ | 265 | \\ var a_2: Foo_1 = Foo_1{ |
| 258 | \\ .A = @as(c_int, 0), | 266 | \\ .A = @as(c_int, 0), |
| 259 | \\ }; | 267 | \\ }; |
| ... | @@ -268,6 +276,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -268,6 +276,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 268 | \\#define MEM_PHYSICAL_TO_K0(x) (void*)((uint32_t)(x) + SYS_BASE_CACHED) | 276 | \\#define MEM_PHYSICAL_TO_K0(x) (void*)((uint32_t)(x) + SYS_BASE_CACHED) |
| 269 | , &[_][]const u8{ | 277 | , &[_][]const u8{ |
| 270 | \\pub inline fn MEM_PHYSICAL_TO_K0(x: anytype) ?*anyopaque { | 278 | \\pub inline fn MEM_PHYSICAL_TO_K0(x: anytype) ?*anyopaque { |
| | 279 | \\ _ = &x; |
| 271 | \\ return @import("std").zig.c_translation.cast(?*anyopaque, @import("std").zig.c_translation.cast(u32, x) + SYS_BASE_CACHED); | 280 | \\ return @import("std").zig.c_translation.cast(?*anyopaque, @import("std").zig.c_translation.cast(u32, x) + SYS_BASE_CACHED); |
| 272 | \\} | 281 | \\} |
| 273 | }); | 282 | }); |
| ... | @@ -310,6 +319,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -310,6 +319,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 310 | \\pub const VALUE = ((((@as(c_int, 1) + (@as(c_int, 2) * @as(c_int, 3))) + (@as(c_int, 4) * @as(c_int, 5))) + @as(c_int, 6)) << @as(c_int, 7)) | @intFromBool(@as(c_int, 8) == @as(c_int, 9)); | 319 | \\pub const VALUE = ((((@as(c_int, 1) + (@as(c_int, 2) * @as(c_int, 3))) + (@as(c_int, 4) * @as(c_int, 5))) + @as(c_int, 6)) << @as(c_int, 7)) | @intFromBool(@as(c_int, 8) == @as(c_int, 9)); |
| 311 | , | 320 | , |
| 312 | \\pub inline fn _AL_READ3BYTES(p: anytype) @TypeOf((@import("std").zig.c_translation.cast([*c]u8, p).* | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 1)).* << @as(c_int, 8))) | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 2)).* << @as(c_int, 16))) { | 321 | \\pub inline fn _AL_READ3BYTES(p: anytype) @TypeOf((@import("std").zig.c_translation.cast([*c]u8, p).* | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 1)).* << @as(c_int, 8))) | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 2)).* << @as(c_int, 16))) { |
| | 322 | \\ _ = &p; |
| 313 | \\ return (@import("std").zig.c_translation.cast([*c]u8, p).* | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 1)).* << @as(c_int, 8))) | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 2)).* << @as(c_int, 16)); | 323 | \\ return (@import("std").zig.c_translation.cast([*c]u8, p).* | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 1)).* << @as(c_int, 8))) | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 2)).* << @as(c_int, 16)); |
| 314 | \\} | 324 | \\} |
| 315 | }); | 325 | }); |
| ... | @@ -390,6 +400,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -390,6 +400,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 390 | \\pub const Color = struct_Color; | 400 | \\pub const Color = struct_Color; |
| 391 | , | 401 | , |
| 392 | \\pub inline fn CLITERAL(@"type": anytype) @TypeOf(@"type") { | 402 | \\pub inline fn CLITERAL(@"type": anytype) @TypeOf(@"type") { |
| | 403 | \\ _ = &@"type"; |
| 393 | \\ return @"type"; | 404 | \\ return @"type"; |
| 394 | \\} | 405 | \\} |
| 395 | , | 406 | , |
| ... | @@ -407,6 +418,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -407,6 +418,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 407 | \\}; | 418 | \\}; |
| 408 | , | 419 | , |
| 409 | \\pub inline fn A(_x: anytype) MyCStruct { | 420 | \\pub inline fn A(_x: anytype) MyCStruct { |
| | 421 | \\ _ = &_x; |
| 410 | \\ return @import("std").mem.zeroInit(MyCStruct, .{ | 422 | \\ return @import("std").mem.zeroInit(MyCStruct, .{ |
| 411 | \\ .x = _x, | 423 | \\ .x = _x, |
| 412 | \\ }); | 424 | \\ }); |
| ... | @@ -438,6 +450,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -438,6 +450,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 438 | \\#define __ferror_unlocked_body(_fp) (((_fp)->_flags & _IO_ERR_SEEN) != 0) | 450 | \\#define __ferror_unlocked_body(_fp) (((_fp)->_flags & _IO_ERR_SEEN) != 0) |
| 439 | , &[_][]const u8{ | 451 | , &[_][]const u8{ |
| 440 | \\pub inline fn __ferror_unlocked_body(_fp: anytype) @TypeOf((_fp.*._flags & _IO_ERR_SEEN) != @as(c_int, 0)) { | 452 | \\pub inline fn __ferror_unlocked_body(_fp: anytype) @TypeOf((_fp.*._flags & _IO_ERR_SEEN) != @as(c_int, 0)) { |
| | 453 | \\ _ = &_fp; |
| 441 | \\ return (_fp.*._flags & _IO_ERR_SEEN) != @as(c_int, 0); | 454 | \\ return (_fp.*._flags & _IO_ERR_SEEN) != @as(c_int, 0); |
| 442 | \\} | 455 | \\} |
| 443 | }); | 456 | }); |
| ... | @@ -447,6 +460,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -447,6 +460,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 447 | \\#define BAR 1 && 2 > 4 | 460 | \\#define BAR 1 && 2 > 4 |
| 448 | , &[_][]const u8{ | 461 | , &[_][]const u8{ |
| 449 | \\pub inline fn FOO(x: anytype) @TypeOf(@intFromBool(x >= @as(c_int, 0)) + @intFromBool(x >= @as(c_int, 0))) { | 462 | \\pub inline fn FOO(x: anytype) @TypeOf(@intFromBool(x >= @as(c_int, 0)) + @intFromBool(x >= @as(c_int, 0))) { |
| | 463 | \\ _ = &x; |
| 450 | \\ return @intFromBool(x >= @as(c_int, 0)) + @intFromBool(x >= @as(c_int, 0)); | 464 | \\ return @intFromBool(x >= @as(c_int, 0)) + @intFromBool(x >= @as(c_int, 0)); |
| 451 | \\} | 465 | \\} |
| 452 | , | 466 | , |
| ... | @@ -512,6 +526,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -512,6 +526,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 512 | \\}; | 526 | \\}; |
| 513 | , | 527 | , |
| 514 | \\pub inline fn bar(x: anytype) @TypeOf(baz(@as(c_int, 1), @as(c_int, 2))) { | 528 | \\pub inline fn bar(x: anytype) @TypeOf(baz(@as(c_int, 1), @as(c_int, 2))) { |
| | 529 | \\ _ = &x; |
| 515 | \\ return blk_1: { | 530 | \\ return blk_1: { |
| 516 | \\ _ = &x; | 531 | \\ _ = &x; |
| 517 | \\ _ = @as(c_int, 3); | 532 | \\ _ = @as(c_int, 3); |
| ... | @@ -642,6 +657,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -642,6 +657,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 642 | \\}; | 657 | \\}; |
| 643 | \\pub export fn foo(arg_x: [*c]outer) void { | 658 | \\pub export fn foo(arg_x: [*c]outer) void { |
| 644 | \\ var x = arg_x; | 659 | \\ var x = arg_x; |
| | 660 | \\ _ = &x; |
| 645 | \\ x.*.unnamed_0.unnamed_0.y = @as(c_int, @bitCast(@as(c_uint, x.*.unnamed_0.x))); | 661 | \\ x.*.unnamed_0.unnamed_0.y = @as(c_int, @bitCast(@as(c_uint, x.*.unnamed_0.x))); |
| 646 | \\} | 662 | \\} |
| 647 | }); | 663 | }); |
| ... | @@ -728,6 +744,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -728,6 +744,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 728 | \\pub const struct_opaque_2 = opaque {}; | 744 | \\pub const struct_opaque_2 = opaque {}; |
| 729 | \\pub export fn function(arg_opaque_1: ?*struct_opaque) void { | 745 | \\pub export fn function(arg_opaque_1: ?*struct_opaque) void { |
| 730 | \\ var opaque_1 = arg_opaque_1; | 746 | \\ var opaque_1 = arg_opaque_1; |
| | 747 | \\ _ = &opaque_1; |
| 731 | \\ var cast: ?*struct_opaque_2 = @as(?*struct_opaque_2, @ptrCast(opaque_1)); | 748 | \\ var cast: ?*struct_opaque_2 = @as(?*struct_opaque_2, @ptrCast(opaque_1)); |
| 732 | \\ _ = &cast; | 749 | \\ _ = &cast; |
| 733 | \\} | 750 | \\} |
| ... | @@ -827,6 +844,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -827,6 +844,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 827 | , &[_][]const u8{ | 844 | , &[_][]const u8{ |
| 828 | \\pub export fn foo() void { | 845 | \\pub export fn foo() void { |
| 829 | \\ var a: c_int = undefined; | 846 | \\ var a: c_int = undefined; |
| | 847 | \\ _ = &a; |
| 830 | \\ _ = @as(c_int, 1); | 848 | \\ _ = @as(c_int, 1); |
| 831 | \\ _ = "hey"; | 849 | \\ _ = "hey"; |
| 832 | \\ _ = @as(c_int, 1) + @as(c_int, 1); | 850 | \\ _ = @as(c_int, 1) + @as(c_int, 1); |
| ... | @@ -912,6 +930,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -912,6 +930,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 912 | \\pub extern fn foo() void; | 930 | \\pub extern fn foo() void; |
| 913 | \\pub export fn bar() void { | 931 | \\pub export fn bar() void { |
| 914 | \\ var func_ptr: ?*anyopaque = @as(?*anyopaque, @ptrCast(&foo)); | 932 | \\ var func_ptr: ?*anyopaque = @as(?*anyopaque, @ptrCast(&foo)); |
| | 933 | \\ _ = &func_ptr; |
| 915 | \\ var typed_func_ptr: ?*const fn () callconv(.C) void = @as(?*const fn () callconv(.C) void, @ptrFromInt(@as(c_ulong, @intCast(@intFromPtr(func_ptr))))); | 934 | \\ var typed_func_ptr: ?*const fn () callconv(.C) void = @as(?*const fn () callconv(.C) void, @ptrFromInt(@as(c_ulong, @intCast(@intFromPtr(func_ptr))))); |
| 916 | \\ _ = &typed_func_ptr; | 935 | \\ _ = &typed_func_ptr; |
| 917 | \\} | 936 | \\} |
| ... | @@ -953,8 +972,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -953,8 +972,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 953 | , &[_][]const u8{ | 972 | , &[_][]const u8{ |
| 954 | \\pub export fn s() c_int { | 973 | \\pub export fn s() c_int { |
| 955 | \\ var a: c_int = undefined; | 974 | \\ var a: c_int = undefined; |
| | 975 | \\ _ = &a; |
| 956 | \\ var b: c_int = undefined; | 976 | \\ var b: c_int = undefined; |
| | 977 | \\ _ = &b; |
| 957 | \\ var c: c_int = undefined; | 978 | \\ var c: c_int = undefined; |
| | 979 | \\ _ = &c; |
| 958 | \\ c = a + b; | 980 | \\ c = a + b; |
| 959 | \\ c = a - b; | 981 | \\ c = a - b; |
| 960 | \\ c = a * b; | 982 | \\ c = a * b; |
| ... | @@ -964,8 +986,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -964,8 +986,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 964 | \\} | 986 | \\} |
| 965 | \\pub export fn u() c_uint { | 987 | \\pub export fn u() c_uint { |
| 966 | \\ var a: c_uint = undefined; | 988 | \\ var a: c_uint = undefined; |
| | 989 | \\ _ = &a; |
| 967 | \\ var b: c_uint = undefined; | 990 | \\ var b: c_uint = undefined; |
| | 991 | \\ _ = &b; |
| 968 | \\ var c: c_uint = undefined; | 992 | \\ var c: c_uint = undefined; |
| | 993 | \\ _ = &c; |
| 969 | \\ c = a +% b; | 994 | \\ c = a +% b; |
| 970 | \\ c = a -% b; | 995 | \\ c = a -% b; |
| 971 | \\ c = a *% b; | 996 | \\ c = a *% b; |
| ... | @@ -1361,6 +1386,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1361,6 +1386,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1361 | \\pub export fn foo() void { | 1386 | \\pub export fn foo() void { |
| 1362 | \\ var a: c_int = undefined; | 1387 | \\ var a: c_int = undefined; |
| 1363 | \\ _ = &a; | 1388 | \\ _ = &a; |
| | 1389 | \\ _ = &a; |
| 1364 | \\} | 1390 | \\} |
| 1365 | }); | 1391 | }); |
| 1366 | | 1392 | |
| ... | @@ -1372,6 +1398,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1372,6 +1398,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1372 | , &[_][]const u8{ | 1398 | , &[_][]const u8{ |
| 1373 | \\pub export fn foo() ?*anyopaque { | 1399 | \\pub export fn foo() ?*anyopaque { |
| 1374 | \\ var x: [*c]c_ushort = undefined; | 1400 | \\ var x: [*c]c_ushort = undefined; |
| | 1401 | \\ _ = &x; |
| 1375 | \\ return @as(?*anyopaque, @ptrCast(x)); | 1402 | \\ return @as(?*anyopaque, @ptrCast(x)); |
| 1376 | \\} | 1403 | \\} |
| 1377 | }); | 1404 | }); |
| ... | @@ -1496,6 +1523,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1496,6 +1523,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1496 | \\pub export fn foo() void { | 1523 | \\pub export fn foo() void { |
| 1497 | \\ { | 1524 | \\ { |
| 1498 | \\ var i: c_int = 0; | 1525 | \\ var i: c_int = 0; |
| | 1526 | \\ _ = &i; |
| 1499 | \\ while (i != 0) : (i += 1) {} | 1527 | \\ while (i != 0) : (i += 1) {} |
| 1500 | \\ } | 1528 | \\ } |
| 1501 | \\} | 1529 | \\} |
| ... | @@ -1519,6 +1547,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1519,6 +1547,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1519 | , &[_][]const u8{ | 1547 | , &[_][]const u8{ |
| 1520 | \\pub export fn foo() void { | 1548 | \\pub export fn foo() void { |
| 1521 | \\ var i: c_int = undefined; | 1549 | \\ var i: c_int = undefined; |
| | 1550 | \\ _ = &i; |
| 1522 | \\ { | 1551 | \\ { |
| 1523 | \\ i = 3; | 1552 | \\ i = 3; |
| 1524 | \\ while (i != 0) : (i -= 1) {} | 1553 | \\ while (i != 0) : (i -= 1) {} |
| ... | @@ -1562,6 +1591,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1562,6 +1591,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1562 | , &[_][]const u8{ | 1591 | , &[_][]const u8{ |
| 1563 | \\pub export fn ptrcast() [*c]f32 { | 1592 | \\pub export fn ptrcast() [*c]f32 { |
| 1564 | \\ var a: [*c]c_int = undefined; | 1593 | \\ var a: [*c]c_int = undefined; |
| | 1594 | \\ _ = &a; |
| 1565 | \\ return @as([*c]f32, @ptrCast(@alignCast(a))); | 1595 | \\ return @as([*c]f32, @ptrCast(@alignCast(a))); |
| 1566 | \\} | 1596 | \\} |
| 1567 | }); | 1597 | }); |
| ... | @@ -1574,6 +1604,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1574,6 +1604,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1574 | , &[_][]const u8{ | 1604 | , &[_][]const u8{ |
| 1575 | \\pub export fn ptrptrcast() [*c][*c]f32 { | 1605 | \\pub export fn ptrptrcast() [*c][*c]f32 { |
| 1576 | \\ var a: [*c][*c]c_int = undefined; | 1606 | \\ var a: [*c][*c]c_int = undefined; |
| | 1607 | \\ _ = &a; |
| 1577 | \\ return @as([*c][*c]f32, @ptrCast(@alignCast(a))); | 1608 | \\ return @as([*c][*c]f32, @ptrCast(@alignCast(a))); |
| 1578 | \\} | 1609 | \\} |
| 1579 | }); | 1610 | }); |
| ... | @@ -1597,6 +1628,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1597,6 +1628,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1597 | , &[_][]const u8{ | 1628 | , &[_][]const u8{ |
| 1598 | \\pub export fn test_ptr_cast() void { | 1629 | \\pub export fn test_ptr_cast() void { |
| 1599 | \\ var p: ?*anyopaque = undefined; | 1630 | \\ var p: ?*anyopaque = undefined; |
| | 1631 | \\ _ = &p; |
| 1600 | \\ { | 1632 | \\ { |
| 1601 | \\ var to_char: [*c]u8 = @as([*c]u8, @ptrCast(@alignCast(p))); | 1633 | \\ var to_char: [*c]u8 = @as([*c]u8, @ptrCast(@alignCast(p))); |
| 1602 | \\ _ = &to_char; | 1634 | \\ _ = &to_char; |
| ... | @@ -1633,8 +1665,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1633,8 +1665,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1633 | , &[_][]const u8{ | 1665 | , &[_][]const u8{ |
| 1634 | \\pub export fn while_none_bool() c_int { | 1666 | \\pub export fn while_none_bool() c_int { |
| 1635 | \\ var a: c_int = undefined; | 1667 | \\ var a: c_int = undefined; |
| | 1668 | \\ _ = &a; |
| 1636 | \\ var b: f32 = undefined; | 1669 | \\ var b: f32 = undefined; |
| | 1670 | \\ _ = &b; |
| 1637 | \\ var c: ?*anyopaque = undefined; | 1671 | \\ var c: ?*anyopaque = undefined; |
| | 1672 | \\ _ = &c; |
| 1638 | \\ while (a != 0) return 0; | 1673 | \\ while (a != 0) return 0; |
| 1639 | \\ while (b != 0) return 1; | 1674 | \\ while (b != 0) return 1; |
| 1640 | \\ while (c != null) return 2; | 1675 | \\ while (c != null) return 2; |
| ... | @@ -1655,8 +1690,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1655,8 +1690,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1655 | , &[_][]const u8{ | 1690 | , &[_][]const u8{ |
| 1656 | \\pub export fn for_none_bool() c_int { | 1691 | \\pub export fn for_none_bool() c_int { |
| 1657 | \\ var a: c_int = undefined; | 1692 | \\ var a: c_int = undefined; |
| | 1693 | \\ _ = &a; |
| 1658 | \\ var b: f32 = undefined; | 1694 | \\ var b: f32 = undefined; |
| | 1695 | \\ _ = &b; |
| 1659 | \\ var c: ?*anyopaque = undefined; | 1696 | \\ var c: ?*anyopaque = undefined; |
| | 1697 | \\ _ = &c; |
| 1660 | \\ while (a != 0) return 0; | 1698 | \\ while (a != 0) return 0; |
| 1661 | \\ while (b != 0) return 1; | 1699 | \\ while (b != 0) return 1; |
| 1662 | \\ while (c != null) return 2; | 1700 | \\ while (c != null) return 2; |
| ... | @@ -1693,6 +1731,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1693,6 +1731,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1693 | , &[_][]const u8{ | 1731 | , &[_][]const u8{ |
| 1694 | \\pub export fn foo() void { | 1732 | \\pub export fn foo() void { |
| 1695 | \\ var x: [*c]c_int = undefined; | 1733 | \\ var x: [*c]c_int = undefined; |
| | 1734 | \\ _ = &x; |
| 1696 | \\ x.* = 1; | 1735 | \\ x.* = 1; |
| 1697 | \\} | 1736 | \\} |
| 1698 | }); | 1737 | }); |
| ... | @@ -1706,7 +1745,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1706,7 +1745,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1706 | , &[_][]const u8{ | 1745 | , &[_][]const u8{ |
| 1707 | \\pub export fn foo() c_int { | 1746 | \\pub export fn foo() c_int { |
| 1708 | \\ var x: c_int = 1234; | 1747 | \\ var x: c_int = 1234; |
| | 1748 | \\ _ = &x; |
| 1709 | \\ var ptr: [*c]c_int = &x; | 1749 | \\ var ptr: [*c]c_int = &x; |
| | 1750 | \\ _ = &ptr; |
| 1710 | \\ return ptr.*; | 1751 | \\ return ptr.*; |
| 1711 | \\} | 1752 | \\} |
| 1712 | }); | 1753 | }); |
| ... | @@ -1719,6 +1760,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1719,6 +1760,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1719 | , &[_][]const u8{ | 1760 | , &[_][]const u8{ |
| 1720 | \\pub export fn foo() c_int { | 1761 | \\pub export fn foo() c_int { |
| 1721 | \\ var x: c_int = undefined; | 1762 | \\ var x: c_int = undefined; |
| | 1763 | \\ _ = &x; |
| 1722 | \\ return ~x; | 1764 | \\ return ~x; |
| 1723 | \\} | 1765 | \\} |
| 1724 | }); | 1766 | }); |
| ... | @@ -1736,8 +1778,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1736,8 +1778,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1736 | , &[_][]const u8{ | 1778 | , &[_][]const u8{ |
| 1737 | \\pub export fn foo() c_int { | 1779 | \\pub export fn foo() c_int { |
| 1738 | \\ var a: c_int = undefined; | 1780 | \\ var a: c_int = undefined; |
| | 1781 | \\ _ = &a; |
| 1739 | \\ var b: f32 = undefined; | 1782 | \\ var b: f32 = undefined; |
| | 1783 | \\ _ = &b; |
| 1740 | \\ var c: ?*anyopaque = undefined; | 1784 | \\ var c: ?*anyopaque = undefined; |
| | 1785 | \\ _ = &c; |
| 1741 | \\ return @intFromBool(!(a == @as(c_int, 0))); | 1786 | \\ return @intFromBool(!(a == @as(c_int, 0))); |
| 1742 | \\ return @intFromBool(!(a != 0)); | 1787 | \\ return @intFromBool(!(a != 0)); |
| 1743 | \\ return @intFromBool(!(b != 0)); | 1788 | \\ return @intFromBool(!(b != 0)); |
| ... | @@ -2051,10 +2096,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2051,10 +2096,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2051 | \\pub extern var c: c_int; | 2096 | \\pub extern var c: c_int; |
| 2052 | , | 2097 | , |
| 2053 | \\pub inline fn BASIC(c_1: anytype) @TypeOf(c_1 * @as(c_int, 2)) { | 2098 | \\pub inline fn BASIC(c_1: anytype) @TypeOf(c_1 * @as(c_int, 2)) { |
| | 2099 | \\ _ = &c_1; |
| 2054 | \\ return c_1 * @as(c_int, 2); | 2100 | \\ return c_1 * @as(c_int, 2); |
| 2055 | \\} | 2101 | \\} |
| 2056 | , | 2102 | , |
| 2057 | \\pub inline fn FOO(L: anytype, b: anytype) @TypeOf(L + b) { | 2103 | \\pub inline fn FOO(L: anytype, b: anytype) @TypeOf(L + b) { |
| | 2104 | \\ _ = &L; |
| | 2105 | \\ _ = &b; |
| 2058 | \\ return L + b; | 2106 | \\ return L + b; |
| 2059 | \\} | 2107 | \\} |
| 2060 | , | 2108 | , |
| ... | @@ -2109,7 +2157,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2109,7 +2157,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2109 | \\ var c_1 = arg_c_1; | 2157 | \\ var c_1 = arg_c_1; |
| 2110 | \\ _ = &c_1; | 2158 | \\ _ = &c_1; |
| 2111 | \\ var a_2: c_int = undefined; | 2159 | \\ var a_2: c_int = undefined; |
| | 2160 | \\ _ = &a_2; |
| 2112 | \\ var b_3: u8 = 123; | 2161 | \\ var b_3: u8 = 123; |
| | 2162 | \\ _ = &b_3; |
| 2113 | \\ b_3 = @as(u8, @bitCast(@as(i8, @truncate(a_2)))); | 2163 | \\ b_3 = @as(u8, @bitCast(@as(i8, @truncate(a_2)))); |
| 2114 | \\ { | 2164 | \\ { |
| 2115 | \\ var d: c_int = 5; | 2165 | \\ var d: c_int = 5; |
| ... | @@ -2150,7 +2200,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2150,7 +2200,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2150 | , &[_][]const u8{ | 2200 | , &[_][]const u8{ |
| 2151 | \\pub export fn foo() void { | 2201 | \\pub export fn foo() void { |
| 2152 | \\ var a: c_int = undefined; | 2202 | \\ var a: c_int = undefined; |
| | 2203 | \\ _ = &a; |
| 2153 | \\ var b: c_int = undefined; | 2204 | \\ var b: c_int = undefined; |
| | 2205 | \\ _ = &b; |
| 2154 | \\ a = blk: { | 2206 | \\ a = blk: { |
| 2155 | \\ const tmp = @as(c_int, 2); | 2207 | \\ const tmp = @as(c_int, 2); |
| 2156 | \\ b = tmp; | 2208 | \\ b = tmp; |
| ... | @@ -2180,11 +2232,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2180,11 +2232,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2180 | , &[_][]const u8{ | 2232 | , &[_][]const u8{ |
| 2181 | \\pub export fn foo() c_int { | 2233 | \\pub export fn foo() c_int { |
| 2182 | \\ var a: c_int = 5; | 2234 | \\ var a: c_int = 5; |
| | 2235 | \\ _ = &a; |
| 2183 | \\ while (true) { | 2236 | \\ while (true) { |
| 2184 | \\ a = 2; | 2237 | \\ a = 2; |
| 2185 | \\ } | 2238 | \\ } |
| 2186 | \\ while (true) { | 2239 | \\ while (true) { |
| 2187 | \\ var a_1: c_int = 4; | 2240 | \\ var a_1: c_int = 4; |
| | 2241 | \\ _ = &a_1; |
| 2188 | \\ a_1 = 9; | 2242 | \\ a_1 = 9; |
| 2189 | \\ return blk: { | 2243 | \\ return blk: { |
| 2190 | \\ _ = @as(c_int, 6); | 2244 | \\ _ = @as(c_int, 6); |
| ... | @@ -2193,6 +2247,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2193,6 +2247,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2193 | \\ } | 2247 | \\ } |
| 2194 | \\ while (true) { | 2248 | \\ while (true) { |
| 2195 | \\ var a_1: c_int = 2; | 2249 | \\ var a_1: c_int = 2; |
| | 2250 | \\ _ = &a_1; |
| 2196 | \\ a_1 = 12; | 2251 | \\ a_1 = 12; |
| 2197 | \\ } | 2252 | \\ } |
| 2198 | \\ while (true) { | 2253 | \\ while (true) { |
| ... | @@ -2214,10 +2269,12 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2214,10 +2269,12 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2214 | \\pub export fn foo() void { | 2269 | \\pub export fn foo() void { |
| 2215 | \\ { | 2270 | \\ { |
| 2216 | \\ var i: c_int = 2; | 2271 | \\ var i: c_int = 2; |
| | 2272 | \\ _ = &i; |
| 2217 | \\ var b: c_int = 4; | 2273 | \\ var b: c_int = 4; |
| 2218 | \\ _ = &b; | 2274 | \\ _ = &b; |
| 2219 | \\ while ((i + @as(c_int, 2)) != 0) : (i = 2) { | 2275 | \\ while ((i + @as(c_int, 2)) != 0) : (i = 2) { |
| 2220 | \\ var a: c_int = 2; | 2276 | \\ var a: c_int = 2; |
| | 2277 | \\ _ = &a; |
| 2221 | \\ _ = blk: { | 2278 | \\ _ = blk: { |
| 2222 | \\ _ = blk_1: { | 2279 | \\ _ = blk_1: { |
| 2223 | \\ a = 6; | 2280 | \\ a = 6; |
| ... | @@ -2309,7 +2366,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2309,7 +2366,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2309 | , &[_][]const u8{ | 2366 | , &[_][]const u8{ |
| 2310 | \\pub export fn switch_fn(arg_i: c_int) void { | 2367 | \\pub export fn switch_fn(arg_i: c_int) void { |
| 2311 | \\ var i = arg_i; | 2368 | \\ var i = arg_i; |
| | 2369 | \\ _ = &i; |
| 2312 | \\ var res: c_int = 0; | 2370 | \\ var res: c_int = 0; |
| | 2371 | \\ _ = &res; |
| 2313 | \\ while (true) { | 2372 | \\ while (true) { |
| 2314 | \\ switch (i) { | 2373 | \\ switch (i) { |
| 2315 | \\ @as(c_int, 0) => { | 2374 | \\ @as(c_int, 0) => { |
| ... | @@ -2398,7 +2457,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2398,7 +2457,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2398 | , &[_][]const u8{ | 2457 | , &[_][]const u8{ |
| 2399 | \\pub export fn max(arg_a: c_int) void { | 2458 | \\pub export fn max(arg_a: c_int) void { |
| 2400 | \\ var a = arg_a; | 2459 | \\ var a = arg_a; |
| | 2460 | \\ _ = &a; |
| 2401 | \\ var tmp: c_int = undefined; | 2461 | \\ var tmp: c_int = undefined; |
| | 2462 | \\ _ = &tmp; |
| 2402 | \\ tmp = a; | 2463 | \\ tmp = a; |
| 2403 | \\ a = tmp; | 2464 | \\ a = tmp; |
| 2404 | \\} | 2465 | \\} |
| ... | @@ -2412,8 +2473,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2412,8 +2473,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2412 | , &[_][]const u8{ | 2473 | , &[_][]const u8{ |
| 2413 | \\pub export fn max(arg_a: c_int) void { | 2474 | \\pub export fn max(arg_a: c_int) void { |
| 2414 | \\ var a = arg_a; | 2475 | \\ var a = arg_a; |
| | 2476 | \\ _ = &a; |
| 2415 | \\ var b: c_int = undefined; | 2477 | \\ var b: c_int = undefined; |
| | 2478 | \\ _ = &b; |
| 2416 | \\ var c: c_int = undefined; | 2479 | \\ var c: c_int = undefined; |
| | 2480 | \\ _ = &c; |
| 2417 | \\ c = blk: { | 2481 | \\ c = blk: { |
| 2418 | \\ const tmp = a; | 2482 | \\ const tmp = a; |
| 2419 | \\ b = tmp; | 2483 | \\ b = tmp; |
| ... | @@ -2442,6 +2506,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2442,6 +2506,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2442 | , &[_][]const u8{ | 2506 | , &[_][]const u8{ |
| 2443 | \\pub export fn int_from_float(arg_a: f32) c_int { | 2507 | \\pub export fn int_from_float(arg_a: f32) c_int { |
| 2444 | \\ var a = arg_a; | 2508 | \\ var a = arg_a; |
| | 2509 | \\ _ = &a; |
| 2445 | \\ return @as(c_int, @intFromFloat(a)); | 2510 | \\ return @as(c_int, @intFromFloat(a)); |
| 2446 | \\} | 2511 | \\} |
| 2447 | }); | 2512 | }); |
| ... | @@ -2505,11 +2570,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2505,11 +2570,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2505 | , &[_][]const u8{ | 2570 | , &[_][]const u8{ |
| 2506 | \\pub export fn foo() void { | 2571 | \\pub export fn foo() void { |
| 2507 | \\ var a: c_int = 2; | 2572 | \\ var a: c_int = 2; |
| | 2573 | \\ _ = &a; |
| 2508 | \\ while (true) { | 2574 | \\ while (true) { |
| 2509 | \\ a = a - @as(c_int, 1); | 2575 | \\ a = a - @as(c_int, 1); |
| 2510 | \\ if (!(a != 0)) break; | 2576 | \\ if (!(a != 0)) break; |
| 2511 | \\ } | 2577 | \\ } |
| 2512 | \\ var b: c_int = 2; | 2578 | \\ var b: c_int = 2; |
| | 2579 | \\ _ = &b; |
| 2513 | \\ while (true) { | 2580 | \\ while (true) { |
| 2514 | \\ b = b - @as(c_int, 1); | 2581 | \\ b = b - @as(c_int, 1); |
| 2515 | \\ if (!(b != 0)) break; | 2582 | \\ if (!(b != 0)) break; |
| ... | @@ -2550,21 +2617,37 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2550,21 +2617,37 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2550 | \\pub const SomeTypedef = c_int; | 2617 | \\pub const SomeTypedef = c_int; |
| 2551 | \\pub export fn and_or_non_bool(arg_a: c_int, arg_b: f32, arg_c: ?*anyopaque) c_int { | 2618 | \\pub export fn and_or_non_bool(arg_a: c_int, arg_b: f32, arg_c: ?*anyopaque) c_int { |
| 2552 | \\ var a = arg_a; | 2619 | \\ var a = arg_a; |
| | 2620 | \\ _ = &a; |
| 2553 | \\ var b = arg_b; | 2621 | \\ var b = arg_b; |
| | 2622 | \\ _ = &b; |
| 2554 | \\ var c = arg_c; | 2623 | \\ var c = arg_c; |
| | 2624 | \\ _ = &c; |
| 2555 | \\ var d: enum_Foo = @as(c_uint, @bitCast(FooA)); | 2625 | \\ var d: enum_Foo = @as(c_uint, @bitCast(FooA)); |
| | 2626 | \\ _ = &d; |
| 2556 | \\ var e: c_int = @intFromBool((a != 0) and (b != 0)); | 2627 | \\ var e: c_int = @intFromBool((a != 0) and (b != 0)); |
| | 2628 | \\ _ = &e; |
| 2557 | \\ var f: c_int = @intFromBool((b != 0) and (c != null)); | 2629 | \\ var f: c_int = @intFromBool((b != 0) and (c != null)); |
| | 2630 | \\ _ = &f; |
| 2558 | \\ var g: c_int = @intFromBool((a != 0) and (c != null)); | 2631 | \\ var g: c_int = @intFromBool((a != 0) and (c != null)); |
| | 2632 | \\ _ = &g; |
| 2559 | \\ var h: c_int = @intFromBool((a != 0) or (b != 0)); | 2633 | \\ var h: c_int = @intFromBool((a != 0) or (b != 0)); |
| | 2634 | \\ _ = &h; |
| 2560 | \\ var i: c_int = @intFromBool((b != 0) or (c != null)); | 2635 | \\ var i: c_int = @intFromBool((b != 0) or (c != null)); |
| | 2636 | \\ _ = &i; |
| 2561 | \\ var j: c_int = @intFromBool((a != 0) or (c != null)); | 2637 | \\ var j: c_int = @intFromBool((a != 0) or (c != null)); |
| | 2638 | \\ _ = &j; |
| 2562 | \\ var k: c_int = @intFromBool((a != 0) or (@as(c_int, @bitCast(d)) != 0)); | 2639 | \\ var k: c_int = @intFromBool((a != 0) or (@as(c_int, @bitCast(d)) != 0)); |
| | 2640 | \\ _ = &k; |
| 2563 | \\ var l: c_int = @intFromBool((@as(c_int, @bitCast(d)) != 0) and (b != 0)); | 2641 | \\ var l: c_int = @intFromBool((@as(c_int, @bitCast(d)) != 0) and (b != 0)); |
| | 2642 | \\ _ = &l; |
| 2564 | \\ var m: c_int = @intFromBool((c != null) or (d != 0)); | 2643 | \\ var m: c_int = @intFromBool((c != null) or (d != 0)); |
| | 2644 | \\ _ = &m; |
| 2565 | \\ var td: SomeTypedef = 44; | 2645 | \\ var td: SomeTypedef = 44; |
| | 2646 | \\ _ = &td; |
| 2566 | \\ var o: c_int = @intFromBool((td != 0) or (b != 0)); | 2647 | \\ var o: c_int = @intFromBool((td != 0) or (b != 0)); |
| | 2648 | \\ _ = &o; |
| 2567 | \\ var p: c_int = @intFromBool((c != null) and (td != 0)); | 2649 | \\ var p: c_int = @intFromBool((c != null) and (td != 0)); |
| | 2650 | \\ _ = &p; |
| 2568 | \\ return (((((((((e + f) + g) + h) + i) + j) + k) + l) + m) + o) + p; | 2651 | \\ return (((((((((e + f) + g) + h) + i) + j) + k) + l) + m) + o) + p; |
| 2569 | \\} | 2652 | \\} |
| 2570 | , | 2653 | , |
| ... | @@ -2604,7 +2687,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2604,7 +2687,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2604 | , &[_][]const u8{ | 2687 | , &[_][]const u8{ |
| 2605 | \\pub export fn max(arg_a: c_int, arg_b: c_int) c_int { | 2688 | \\pub export fn max(arg_a: c_int, arg_b: c_int) c_int { |
| 2606 | \\ var a = arg_a; | 2689 | \\ var a = arg_a; |
| | 2690 | \\ _ = &a; |
| 2607 | \\ var b = arg_b; | 2691 | \\ var b = arg_b; |
| | 2692 | \\ _ = &b; |
| 2608 | \\ return (a & b) ^ (a | b); | 2693 | \\ return (a & b) ^ (a | b); |
| 2609 | \\} | 2694 | \\} |
| 2610 | }); | 2695 | }); |
| ... | @@ -2623,14 +2708,23 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2623,14 +2708,23 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2623 | , &[_][]const u8{ | 2708 | , &[_][]const u8{ |
| 2624 | \\pub export fn test_comparisons(arg_a: c_int, arg_b: c_int) c_int { | 2709 | \\pub export fn test_comparisons(arg_a: c_int, arg_b: c_int) c_int { |
| 2625 | \\ var a = arg_a; | 2710 | \\ var a = arg_a; |
| | 2711 | \\ _ = &a; |
| 2626 | \\ var b = arg_b; | 2712 | \\ var b = arg_b; |
| | 2713 | \\ _ = &b; |
| 2627 | \\ var c: c_int = @intFromBool(a < b); | 2714 | \\ var c: c_int = @intFromBool(a < b); |
| | 2715 | \\ _ = &c; |
| 2628 | \\ var d: c_int = @intFromBool(a > b); | 2716 | \\ var d: c_int = @intFromBool(a > b); |
| | 2717 | \\ _ = &d; |
| 2629 | \\ var e: c_int = @intFromBool(a <= b); | 2718 | \\ var e: c_int = @intFromBool(a <= b); |
| | 2719 | \\ _ = &e; |
| 2630 | \\ var f: c_int = @intFromBool(a >= b); | 2720 | \\ var f: c_int = @intFromBool(a >= b); |
| | 2721 | \\ _ = &f; |
| 2631 | \\ var g: c_int = @intFromBool(c < d); | 2722 | \\ var g: c_int = @intFromBool(c < d); |
| | 2723 | \\ _ = &g; |
| 2632 | \\ var h: c_int = @intFromBool(e < f); | 2724 | \\ var h: c_int = @intFromBool(e < f); |
| | 2725 | \\ _ = &h; |
| 2633 | \\ var i: c_int = @intFromBool(g < h); | 2726 | \\ var i: c_int = @intFromBool(g < h); |
| | 2727 | \\ _ = &i; |
| 2634 | \\ return i; | 2728 | \\ return i; |
| 2635 | \\} | 2729 | \\} |
| 2636 | }); | 2730 | }); |
| ... | @@ -2646,7 +2740,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2646,7 +2740,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2646 | , &[_][]const u8{ | 2740 | , &[_][]const u8{ |
| 2647 | \\pub export fn max(arg_a: c_int, arg_b: c_int) c_int { | 2741 | \\pub export fn max(arg_a: c_int, arg_b: c_int) c_int { |
| 2648 | \\ var a = arg_a; | 2742 | \\ var a = arg_a; |
| | 2743 | \\ _ = &a; |
| 2649 | \\ var b = arg_b; | 2744 | \\ var b = arg_b; |
| | 2745 | \\ _ = &b; |
| 2650 | \\ if (a == b) return a; | 2746 | \\ if (a == b) return a; |
| 2651 | \\ if (a != b) return b; | 2747 | \\ if (a != b) return b; |
| 2652 | \\ return a; | 2748 | \\ return a; |
| ... | @@ -2663,6 +2759,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2663,6 +2759,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2663 | \\pub const yes = [*c]u8; | 2759 | \\pub const yes = [*c]u8; |
| 2664 | \\pub export fn foo() void { | 2760 | \\pub export fn foo() void { |
| 2665 | \\ var a: yes = undefined; | 2761 | \\ var a: yes = undefined; |
| | 2762 | \\ _ = &a; |
| 2666 | \\ if (a != null) { | 2763 | \\ if (a != null) { |
| 2667 | \\ _ = @as(c_int, 2); | 2764 | \\ _ = @as(c_int, 2); |
| 2668 | \\ } | 2765 | \\ } |
| ... | @@ -2682,6 +2779,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2682,6 +2779,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2682 | \\ return blk: { | 2779 | \\ return blk: { |
| 2683 | \\ var a: c_int = 1; | 2780 | \\ var a: c_int = 1; |
| 2684 | \\ _ = &a; | 2781 | \\ _ = &a; |
| | 2782 | \\ _ = &a; |
| 2685 | \\ break :blk a; | 2783 | \\ break :blk a; |
| 2686 | \\ }; | 2784 | \\ }; |
| 2687 | \\} | 2785 | \\} |
| ... | @@ -2707,6 +2805,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2707,6 +2805,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2707 | \\pub export var b: f32 = 2.0; | 2805 | \\pub export var b: f32 = 2.0; |
| 2708 | \\pub export fn foo() void { | 2806 | \\pub export fn foo() void { |
| 2709 | \\ var c: [*c]struct_Foo = undefined; | 2807 | \\ var c: [*c]struct_Foo = undefined; |
| | 2808 | \\ _ = &c; |
| 2710 | \\ _ = a.b; | 2809 | \\ _ = a.b; |
| 2711 | \\ _ = c.*.b; | 2810 | \\ _ = c.*.b; |
| 2712 | \\} | 2811 | \\} |
| ... | @@ -2726,6 +2825,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2726,6 +2825,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2726 | \\pub export var array: [100]c_int = [1]c_int{0} ** 100; | 2825 | \\pub export var array: [100]c_int = [1]c_int{0} ** 100; |
| 2727 | \\pub export fn foo(arg_index: c_int) c_int { | 2826 | \\pub export fn foo(arg_index: c_int) c_int { |
| 2728 | \\ var index = arg_index; | 2827 | \\ var index = arg_index; |
| | 2828 | \\ _ = &index; |
| 2729 | \\ return array[@as(c_uint, @intCast(index))]; | 2829 | \\ return array[@as(c_uint, @intCast(index))]; |
| 2730 | \\} | 2830 | \\} |
| 2731 | , | 2831 | , |
| ... | @@ -2740,7 +2840,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2740,7 +2840,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2740 | , &[_][]const u8{ | 2840 | , &[_][]const u8{ |
| 2741 | \\pub export fn foo() void { | 2841 | \\pub export fn foo() void { |
| 2742 | \\ var a: [10]c_int = undefined; | 2842 | \\ var a: [10]c_int = undefined; |
| | 2843 | \\ _ = &a; |
| 2743 | \\ var i: c_int = 0; | 2844 | \\ var i: c_int = 0; |
| | 2845 | \\ _ = &i; |
| 2744 | \\ a[@as(c_uint, @intCast(i))] = 0; | 2846 | \\ a[@as(c_uint, @intCast(i))] = 0; |
| 2745 | \\} | 2847 | \\} |
| 2746 | }); | 2848 | }); |
| ... | @@ -2753,7 +2855,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2753,7 +2855,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2753 | , &[_][]const u8{ | 2855 | , &[_][]const u8{ |
| 2754 | \\pub export fn foo() void { | 2856 | \\pub export fn foo() void { |
| 2755 | \\ var a: [10]c_longlong = undefined; | 2857 | \\ var a: [10]c_longlong = undefined; |
| | 2858 | \\ _ = &a; |
| 2756 | \\ var i: c_longlong = 0; | 2859 | \\ var i: c_longlong = 0; |
| | 2860 | \\ _ = &i; |
| 2757 | \\ a[@as(usize, @intCast(i))] = 0; | 2861 | \\ a[@as(usize, @intCast(i))] = 0; |
| 2758 | \\} | 2862 | \\} |
| 2759 | }); | 2863 | }); |
| ... | @@ -2766,7 +2870,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2766,7 +2870,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2766 | , &[_][]const u8{ | 2870 | , &[_][]const u8{ |
| 2767 | \\pub export fn foo() void { | 2871 | \\pub export fn foo() void { |
| 2768 | \\ var a: [10]c_uint = undefined; | 2872 | \\ var a: [10]c_uint = undefined; |
| | 2873 | \\ _ = &a; |
| 2769 | \\ var i: c_uint = 0; | 2874 | \\ var i: c_uint = 0; |
| | 2875 | \\ _ = &i; |
| 2770 | \\ a[i] = 0; | 2876 | \\ a[i] = 0; |
| 2771 | \\} | 2877 | \\} |
| 2772 | }); | 2878 | }); |
| ... | @@ -2776,6 +2882,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2776,6 +2882,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2776 | \\int bar(int x) { return x; } | 2882 | \\int bar(int x) { return x; } |
| 2777 | , &[_][]const u8{ | 2883 | , &[_][]const u8{ |
| 2778 | \\pub inline fn CALL(arg: anytype) @TypeOf(bar(arg)) { | 2884 | \\pub inline fn CALL(arg: anytype) @TypeOf(bar(arg)) { |
| | 2885 | \\ _ = &arg; |
| 2779 | \\ return bar(arg); | 2886 | \\ return bar(arg); |
| 2780 | \\} | 2887 | \\} |
| 2781 | }); | 2888 | }); |
| ... | @@ -2801,7 +2908,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2801,7 +2908,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2801 | , &[_][]const u8{ | 2908 | , &[_][]const u8{ |
| 2802 | \\pub export fn max(arg_a: c_int, arg_b: c_int) c_int { | 2909 | \\pub export fn max(arg_a: c_int, arg_b: c_int) c_int { |
| 2803 | \\ var a = arg_a; | 2910 | \\ var a = arg_a; |
| | 2911 | \\ _ = &a; |
| 2804 | \\ var b = arg_b; | 2912 | \\ var b = arg_b; |
| | 2913 | \\ _ = &b; |
| 2805 | \\ if ((a < b) or (a == b)) return b; | 2914 | \\ if ((a < b) or (a == b)) return b; |
| 2806 | \\ if ((a >= b) and (a == b)) return a; | 2915 | \\ if ((a >= b) and (a == b)) return a; |
| 2807 | \\ return a; | 2916 | \\ return a; |
| ... | @@ -2823,7 +2932,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2823,7 +2932,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2823 | , &[_][]const u8{ | 2932 | , &[_][]const u8{ |
| 2824 | \\pub export fn max(arg_a: c_int, arg_b: c_int) c_int { | 2933 | \\pub export fn max(arg_a: c_int, arg_b: c_int) c_int { |
| 2825 | \\ var a = arg_a; | 2934 | \\ var a = arg_a; |
| | 2935 | \\ _ = &a; |
| 2826 | \\ var b = arg_b; | 2936 | \\ var b = arg_b; |
| | 2937 | \\ _ = &b; |
| 2827 | \\ if (a < b) return b; | 2938 | \\ if (a < b) return b; |
| 2828 | \\ if (a < b) return b else return a; | 2939 | \\ if (a < b) return b else return a; |
| 2829 | \\ if (a < b) {} else {} | 2940 | \\ if (a < b) {} else {} |
| ... | @@ -2874,9 +2985,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2874,9 +2985,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2874 | \\; | 2985 | \\; |
| 2875 | \\pub export fn if_none_bool(arg_a: c_int, arg_b: f32, arg_c: ?*anyopaque, arg_d: enum_SomeEnum) c_int { | 2986 | \\pub export fn if_none_bool(arg_a: c_int, arg_b: f32, arg_c: ?*anyopaque, arg_d: enum_SomeEnum) c_int { |
| 2876 | \\ var a = arg_a; | 2987 | \\ var a = arg_a; |
| | 2988 | \\ _ = &a; |
| 2877 | \\ var b = arg_b; | 2989 | \\ var b = arg_b; |
| | 2990 | \\ _ = &b; |
| 2878 | \\ var c = arg_c; | 2991 | \\ var c = arg_c; |
| | 2992 | \\ _ = &c; |
| 2879 | \\ var d = arg_d; | 2993 | \\ var d = arg_d; |
| | 2994 | \\ _ = &d; |
| 2880 | \\ if (a != 0) return 0; | 2995 | \\ if (a != 0) return 0; |
| 2881 | \\ if (b != 0) return 1; | 2996 | \\ if (b != 0) return 1; |
| 2882 | \\ if (c != null) return 2; | 2997 | \\ if (c != null) return 2; |
| ... | @@ -2904,6 +3019,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2904,6 +3019,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2904 | , &[_][]const u8{ | 3019 | , &[_][]const u8{ |
| 2905 | \\pub export fn abs(arg_a: c_int) c_int { | 3020 | \\pub export fn abs(arg_a: c_int) c_int { |
| 2906 | \\ var a = arg_a; | 3021 | \\ var a = arg_a; |
| | 3022 | \\ _ = &a; |
| 2907 | \\ return if (a < @as(c_int, 0)) -a else a; | 3023 | \\ return if (a < @as(c_int, 0)) -a else a; |
| 2908 | \\} | 3024 | \\} |
| 2909 | }); | 3025 | }); |
| ... | @@ -2924,16 +3040,19 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2924,16 +3040,19 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2924 | , &[_][]const u8{ | 3040 | , &[_][]const u8{ |
| 2925 | \\pub export fn foo1(arg_a: c_uint) c_uint { | 3041 | \\pub export fn foo1(arg_a: c_uint) c_uint { |
| 2926 | \\ var a = arg_a; | 3042 | \\ var a = arg_a; |
| | 3043 | \\ _ = &a; |
| 2927 | \\ a +%= 1; | 3044 | \\ a +%= 1; |
| 2928 | \\ return a; | 3045 | \\ return a; |
| 2929 | \\} | 3046 | \\} |
| 2930 | \\pub export fn foo2(arg_a: c_int) c_int { | 3047 | \\pub export fn foo2(arg_a: c_int) c_int { |
| 2931 | \\ var a = arg_a; | 3048 | \\ var a = arg_a; |
| | 3049 | \\ _ = &a; |
| 2932 | \\ a += 1; | 3050 | \\ a += 1; |
| 2933 | \\ return a; | 3051 | \\ return a; |
| 2934 | \\} | 3052 | \\} |
| 2935 | \\pub export fn foo3(arg_a: [*c]c_int) [*c]c_int { | 3053 | \\pub export fn foo3(arg_a: [*c]c_int) [*c]c_int { |
| 2936 | \\ var a = arg_a; | 3054 | \\ var a = arg_a; |
| | 3055 | \\ _ = &a; |
| 2937 | \\ a += 1; | 3056 | \\ a += 1; |
| 2938 | \\ return a; | 3057 | \\ return a; |
| 2939 | \\} | 3058 | \\} |
| ... | @@ -2959,7 +3078,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2959,7 +3078,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2959 | \\} | 3078 | \\} |
| 2960 | \\pub export fn bar() void { | 3079 | \\pub export fn bar() void { |
| 2961 | \\ var f: ?*const fn () callconv(.C) void = &foo; | 3080 | \\ var f: ?*const fn () callconv(.C) void = &foo; |
| | 3081 | \\ _ = &f; |
| 2962 | \\ var b: ?*const fn () callconv(.C) c_int = &baz; | 3082 | \\ var b: ?*const fn () callconv(.C) c_int = &baz; |
| | 3083 | \\ _ = &b; |
| 2963 | \\ f.?(); | 3084 | \\ f.?(); |
| 2964 | \\ f.?(); | 3085 | \\ f.?(); |
| 2965 | \\ foo(); | 3086 | \\ foo(); |
| ... | @@ -2985,7 +3106,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2985,7 +3106,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2985 | , &[_][]const u8{ | 3106 | , &[_][]const u8{ |
| 2986 | \\pub export fn foo() void { | 3107 | \\pub export fn foo() void { |
| 2987 | \\ var i: c_int = 0; | 3108 | \\ var i: c_int = 0; |
| | 3109 | \\ _ = &i; |
| 2988 | \\ var u: c_uint = 0; | 3110 | \\ var u: c_uint = 0; |
| | 3111 | \\ _ = &u; |
| 2989 | \\ i += 1; | 3112 | \\ i += 1; |
| 2990 | \\ i -= 1; | 3113 | \\ i -= 1; |
| 2991 | \\ u +%= 1; | 3114 | \\ u +%= 1; |
| ... | @@ -3024,7 +3147,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3024,7 +3147,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3024 | , &[_][]const u8{ | 3147 | , &[_][]const u8{ |
| 3025 | \\pub export fn log2(arg_a: c_uint) c_int { | 3148 | \\pub export fn log2(arg_a: c_uint) c_int { |
| 3026 | \\ var a = arg_a; | 3149 | \\ var a = arg_a; |
| | 3150 | \\ _ = &a; |
| 3027 | \\ var i: c_int = 0; | 3151 | \\ var i: c_int = 0; |
| | 3152 | \\ _ = &i; |
| 3028 | \\ while (a > @as(c_uint, @bitCast(@as(c_int, 0)))) { | 3153 | \\ while (a > @as(c_uint, @bitCast(@as(c_int, 0)))) { |
| 3029 | \\ a >>= @intCast(@as(c_int, 1)); | 3154 | \\ a >>= @intCast(@as(c_int, 1)); |
| 3030 | \\ } | 3155 | \\ } |
| ... | @@ -3044,7 +3169,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3044,7 +3169,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3044 | , &[_][]const u8{ | 3169 | , &[_][]const u8{ |
| 3045 | \\pub export fn log2(arg_a: u32) c_int { | 3170 | \\pub export fn log2(arg_a: u32) c_int { |
| 3046 | \\ var a = arg_a; | 3171 | \\ var a = arg_a; |
| | 3172 | \\ _ = &a; |
| 3047 | \\ var i: c_int = 0; | 3173 | \\ var i: c_int = 0; |
| | 3174 | \\ _ = &i; |
| 3048 | \\ while (a > @as(u32, @bitCast(@as(c_int, 0)))) { | 3175 | \\ while (a > @as(u32, @bitCast(@as(c_int, 0)))) { |
| 3049 | \\ a >>= @intCast(@as(c_int, 1)); | 3176 | \\ a >>= @intCast(@as(c_int, 1)); |
| 3050 | \\ } | 3177 | \\ } |
| ... | @@ -3072,7 +3199,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3072,7 +3199,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3072 | , &[_][]const u8{ | 3199 | , &[_][]const u8{ |
| 3073 | \\pub export fn foo() void { | 3200 | \\pub export fn foo() void { |
| 3074 | \\ var a: c_int = 0; | 3201 | \\ var a: c_int = 0; |
| | 3202 | \\ _ = &a; |
| 3075 | \\ var b: c_uint = 0; | 3203 | \\ var b: c_uint = 0; |
| | 3204 | \\ _ = &b; |
| 3076 | \\ a += blk: { | 3205 | \\ a += blk: { |
| 3077 | \\ const ref = &a; | 3206 | \\ const ref = &a; |
| 3078 | \\ ref.* += @as(c_int, 1); | 3207 | \\ ref.* += @as(c_int, 1); |
| ... | @@ -3151,6 +3280,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3151,6 +3280,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3151 | , &[_][]const u8{ | 3280 | , &[_][]const u8{ |
| 3152 | \\pub export fn foo() void { | 3281 | \\pub export fn foo() void { |
| 3153 | \\ var a: c_uint = 0; | 3282 | \\ var a: c_uint = 0; |
| | 3283 | \\ _ = &a; |
| 3154 | \\ a +%= blk: { | 3284 | \\ a +%= blk: { |
| 3155 | \\ const ref = &a; | 3285 | \\ const ref = &a; |
| 3156 | \\ ref.* +%= @as(c_uint, @bitCast(@as(c_int, 1))); | 3286 | \\ ref.* +%= @as(c_uint, @bitCast(@as(c_int, 1))); |
| ... | @@ -3210,7 +3340,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3210,7 +3340,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3210 | , &[_][]const u8{ | 3340 | , &[_][]const u8{ |
| 3211 | \\pub export fn foo() void { | 3341 | \\pub export fn foo() void { |
| 3212 | \\ var i: c_int = 0; | 3342 | \\ var i: c_int = 0; |
| | 3343 | \\ _ = &i; |
| 3213 | \\ var u: c_uint = 0; | 3344 | \\ var u: c_uint = 0; |
| | 3345 | \\ _ = &u; |
| 3214 | \\ i += 1; | 3346 | \\ i += 1; |
| 3215 | \\ i -= 1; | 3347 | \\ i -= 1; |
| 3216 | \\ u +%= 1; | 3348 | \\ u +%= 1; |
| ... | @@ -3305,6 +3437,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3305,6 +3437,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3305 | \\pub fn bar() callconv(.C) void {} | 3437 | \\pub fn bar() callconv(.C) void {} |
| 3306 | \\pub export fn foo(arg_baz: ?*const fn () callconv(.C) [*c]c_int) void { | 3438 | \\pub export fn foo(arg_baz: ?*const fn () callconv(.C) [*c]c_int) void { |
| 3307 | \\ var baz = arg_baz; | 3439 | \\ var baz = arg_baz; |
| | 3440 | \\ _ = &baz; |
| 3308 | \\ bar(); | 3441 | \\ bar(); |
| 3309 | \\ _ = baz.?(); | 3442 | \\ _ = baz.?(); |
| 3310 | \\} | 3443 | \\} |
| ... | @@ -3375,10 +3508,14 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3375,10 +3508,14 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3375 | \\#define MAX(a, b) ((b) > (a) ? (b) : (a)) | 3508 | \\#define MAX(a, b) ((b) > (a) ? (b) : (a)) |
| 3376 | , &[_][]const u8{ | 3509 | , &[_][]const u8{ |
| 3377 | \\pub inline fn MIN(a: anytype, b: anytype) @TypeOf(if (b < a) b else a) { | 3510 | \\pub inline fn MIN(a: anytype, b: anytype) @TypeOf(if (b < a) b else a) { |
| | 3511 | \\ _ = &a; |
| | 3512 | \\ _ = &b; |
| 3378 | \\ return if (b < a) b else a; | 3513 | \\ return if (b < a) b else a; |
| 3379 | \\} | 3514 | \\} |
| 3380 | , | 3515 | , |
| 3381 | \\pub inline fn MAX(a: anytype, b: anytype) @TypeOf(if (b > a) b else a) { | 3516 | \\pub inline fn MAX(a: anytype, b: anytype) @TypeOf(if (b > a) b else a) { |
| | 3517 | \\ _ = &a; |
| | 3518 | \\ _ = &b; |
| 3382 | \\ return if (b > a) b else a; | 3519 | \\ return if (b > a) b else a; |
| 3383 | \\} | 3520 | \\} |
| 3384 | }); | 3521 | }); |
| ... | @@ -3390,7 +3527,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3390,7 +3527,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3390 | , &[_][]const u8{ | 3527 | , &[_][]const u8{ |
| 3391 | \\pub export fn foo(arg_p: [*c]c_int, arg_x: c_int) c_int { | 3528 | \\pub export fn foo(arg_p: [*c]c_int, arg_x: c_int) c_int { |
| 3392 | \\ var p = arg_p; | 3529 | \\ var p = arg_p; |
| | 3530 | \\ _ = &p; |
| 3393 | \\ var x = arg_x; | 3531 | \\ var x = arg_x; |
| | 3532 | \\ _ = &x; |
| 3394 | \\ return blk: { | 3533 | \\ return blk: { |
| 3395 | \\ const tmp = x; | 3534 | \\ const tmp = x; |
| 3396 | \\ (blk_1: { | 3535 | \\ (blk_1: { |
| ... | @@ -3417,6 +3556,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3417,6 +3556,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3417 | \\} | 3556 | \\} |
| 3418 | \\pub export fn bar(arg_x: c_long) c_ushort { | 3557 | \\pub export fn bar(arg_x: c_long) c_ushort { |
| 3419 | \\ var x = arg_x; | 3558 | \\ var x = arg_x; |
| | 3559 | \\ _ = &x; |
| 3420 | \\ return @as(c_ushort, @bitCast(@as(c_short, @truncate(x)))); | 3560 | \\ return @as(c_ushort, @bitCast(@as(c_short, @truncate(x)))); |
| 3421 | \\} | 3561 | \\} |
| 3422 | }); | 3562 | }); |
| ... | @@ -3429,6 +3569,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3429,6 +3569,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3429 | , &[_][]const u8{ | 3569 | , &[_][]const u8{ |
| 3430 | \\pub export fn foo(arg_bar_1: c_int) void { | 3570 | \\pub export fn foo(arg_bar_1: c_int) void { |
| 3431 | \\ var bar_1 = arg_bar_1; | 3571 | \\ var bar_1 = arg_bar_1; |
| | 3572 | \\ _ = &bar_1; |
| 3432 | \\ bar_1 = 2; | 3573 | \\ bar_1 = 2; |
| 3433 | \\} | 3574 | \\} |
| 3434 | \\pub export var bar: c_int = 4; | 3575 | \\pub export var bar: c_int = 4; |
| ... | @@ -3442,6 +3583,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3442,6 +3583,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3442 | , &[_][]const u8{ | 3583 | , &[_][]const u8{ |
| 3443 | \\pub export fn foo(arg_bar_1: c_int) void { | 3584 | \\pub export fn foo(arg_bar_1: c_int) void { |
| 3444 | \\ var bar_1 = arg_bar_1; | 3585 | \\ var bar_1 = arg_bar_1; |
| | 3586 | \\ _ = &bar_1; |
| 3445 | \\ bar_1 = 2; | 3587 | \\ bar_1 = 2; |
| 3446 | \\} | 3588 | \\} |
| 3447 | , | 3589 | , |
| ... | @@ -3475,10 +3617,12 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3475,10 +3617,12 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3475 | \\} | 3617 | \\} |
| 3476 | \\pub export fn bar(arg_a: [*c]const c_int) void { | 3618 | \\pub export fn bar(arg_a: [*c]const c_int) void { |
| 3477 | \\ var a = arg_a; | 3619 | \\ var a = arg_a; |
| | 3620 | \\ _ = &a; |
| 3478 | \\ foo(@as([*c]c_int, @ptrCast(@volatileCast(@constCast(a))))); | 3621 | \\ foo(@as([*c]c_int, @ptrCast(@volatileCast(@constCast(a))))); |
| 3479 | \\} | 3622 | \\} |
| 3480 | \\pub export fn baz(arg_a: [*c]volatile c_int) void { | 3623 | \\pub export fn baz(arg_a: [*c]volatile c_int) void { |
| 3481 | \\ var a = arg_a; | 3624 | \\ var a = arg_a; |
| | 3625 | \\ _ = &a; |
| 3482 | \\ foo(@as([*c]c_int, @ptrCast(@volatileCast(@constCast(a))))); | 3626 | \\ foo(@as([*c]c_int, @ptrCast(@volatileCast(@constCast(a))))); |
| 3483 | \\} | 3627 | \\} |
| 3484 | }); | 3628 | }); |
| ... | @@ -3493,9 +3637,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3493,9 +3637,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3493 | , &[_][]const u8{ | 3637 | , &[_][]const u8{ |
| 3494 | \\pub export fn foo(arg_x: bool) bool { | 3638 | \\pub export fn foo(arg_x: bool) bool { |
| 3495 | \\ var x = arg_x; | 3639 | \\ var x = arg_x; |
| | 3640 | \\ _ = &x; |
| 3496 | \\ var a: bool = @as(c_int, @intFromBool(x)) != @as(c_int, 1); | 3641 | \\ var a: bool = @as(c_int, @intFromBool(x)) != @as(c_int, 1); |
| | 3642 | \\ _ = &a; |
| 3497 | \\ var b: bool = @as(c_int, @intFromBool(a)) != @as(c_int, 0); | 3643 | \\ var b: bool = @as(c_int, @intFromBool(a)) != @as(c_int, 0); |
| | 3644 | \\ _ = &b; |
| 3498 | \\ var c: bool = @intFromPtr(&foo) != 0; | 3645 | \\ var c: bool = @intFromPtr(&foo) != 0; |
| | 3646 | \\ _ = &c; |
| 3499 | \\ return foo(@as(c_int, @intFromBool(c)) != @as(c_int, @intFromBool(b))); | 3647 | \\ return foo(@as(c_int, @intFromBool(c)) != @as(c_int, @intFromBool(b))); |
| 3500 | \\} | 3648 | \\} |
| 3501 | }); | 3649 | }); |
| ... | @@ -3506,7 +3654,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3506,7 +3654,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3506 | \\} | 3654 | \\} |
| 3507 | , &[_][]const u8{ | 3655 | , &[_][]const u8{ |
| 3508 | \\pub export fn max(x: c_int, arg_y: c_int) c_int { | 3656 | \\pub export fn max(x: c_int, arg_y: c_int) c_int { |
| | 3657 | \\ _ = &x; |
| 3509 | \\ var y = arg_y; | 3658 | \\ var y = arg_y; |
| | 3659 | \\ _ = &y; |
| 3510 | \\ return if (x > y) x else y; | 3660 | \\ return if (x > y) x else y; |
| 3511 | \\} | 3661 | \\} |
| 3512 | }); | 3662 | }); |
| ... | @@ -3567,6 +3717,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3567,6 +3717,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3567 | \\ | 3717 | \\ |
| 3568 | , &[_][]const u8{ | 3718 | , &[_][]const u8{ |
| 3569 | \\pub inline fn DefaultScreen(dpy: anytype) @TypeOf(@import("std").zig.c_translation.cast(_XPrivDisplay, dpy).*.default_screen) { | 3719 | \\pub inline fn DefaultScreen(dpy: anytype) @TypeOf(@import("std").zig.c_translation.cast(_XPrivDisplay, dpy).*.default_screen) { |
| | 3720 | \\ _ = &dpy; |
| 3570 | \\ return @import("std").zig.c_translation.cast(_XPrivDisplay, dpy).*.default_screen; | 3721 | \\ return @import("std").zig.c_translation.cast(_XPrivDisplay, dpy).*.default_screen; |
| 3571 | \\} | 3722 | \\} |
| 3572 | }); | 3723 | }); |
| ... | @@ -3809,6 +3960,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3809,6 +3960,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3809 | \\ const foo = struct { | 3960 | \\ const foo = struct { |
| 3810 | \\ var static: struct_FOO = @import("std").mem.zeroes(struct_FOO); | 3961 | \\ var static: struct_FOO = @import("std").mem.zeroes(struct_FOO); |
| 3811 | \\ }; | 3962 | \\ }; |
| | 3963 | \\ _ = &foo; |
| 3812 | \\ return foo.static.x; | 3964 | \\ return foo.static.x; |
| 3813 | \\} | 3965 | \\} |
| 3814 | }); | 3966 | }); |
| ... | @@ -3830,12 +3982,14 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3830,12 +3982,14 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3830 | , &[_][]const u8{ | 3982 | , &[_][]const u8{ |
| 3831 | \\pub export fn bar(arg_x: c_int, arg_y: c_int) c_int { | 3983 | \\pub export fn bar(arg_x: c_int, arg_y: c_int) c_int { |
| 3832 | \\ var x = arg_x; | 3984 | \\ var x = arg_x; |
| | 3985 | \\ _ = &x; |
| 3833 | \\ var y = arg_y; | 3986 | \\ var y = arg_y; |
| 3834 | \\ _ = &y; | 3987 | \\ _ = &y; |
| 3835 | \\ return x; | 3988 | \\ return x; |
| 3836 | \\} | 3989 | \\} |
| 3837 | , | 3990 | , |
| 3838 | \\pub inline fn FOO(A: anytype, B: anytype) @TypeOf(A) { | 3991 | \\pub inline fn FOO(A: anytype, B: anytype) @TypeOf(A) { |
| | 3992 | \\ _ = &A; |
| 3839 | \\ _ = &B; | 3993 | \\ _ = &B; |
| 3840 | \\ return A; | 3994 | \\ return A; |
| 3841 | \\} | 3995 | \\} |
| ... | @@ -3911,6 +4065,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3911,6 +4065,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3911 | , &[_][]const u8{ | 4065 | , &[_][]const u8{ |
| 3912 | \\pub export fn foo() void { | 4066 | \\pub export fn foo() void { |
| 3913 | \\ var a: c_int = undefined; | 4067 | \\ var a: c_int = undefined; |
| | 4068 | \\ _ = &a; |
| 3914 | \\ if ((blk: { | 4069 | \\ if ((blk: { |
| 3915 | \\ const tmp = @intFromBool(@as(c_int, 1) > @as(c_int, 0)); | 4070 | \\ const tmp = @intFromBool(@as(c_int, 1) > @as(c_int, 0)); |
| 3916 | \\ a = tmp; | 4071 | \\ a = tmp; |
| ... | @@ -3929,7 +4084,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3929,7 +4084,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3929 | , &[_][]const u8{ | 4084 | , &[_][]const u8{ |
| 3930 | \\pub export fn foo() void { | 4085 | \\pub export fn foo() void { |
| 3931 | \\ var a: S = undefined; | 4086 | \\ var a: S = undefined; |
| | 4087 | \\ _ = &a; |
| 3932 | \\ var b: S = undefined; | 4088 | \\ var b: S = undefined; |
| | 4089 | \\ _ = &b; |
| 3933 | \\ var c: c_longlong = @divExact(@as(c_longlong, @bitCast(@intFromPtr(a) -% @intFromPtr(b))), @sizeOf(u8)); | 4090 | \\ var c: c_longlong = @divExact(@as(c_longlong, @bitCast(@intFromPtr(a) -% @intFromPtr(b))), @sizeOf(u8)); |
| 3934 | \\ _ = &c; | 4091 | \\ _ = &c; |
| 3935 | \\} | 4092 | \\} |
| ... | @@ -3944,7 +4101,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3944,7 +4101,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3944 | , &[_][]const u8{ | 4101 | , &[_][]const u8{ |
| 3945 | \\pub export fn foo() void { | 4102 | \\pub export fn foo() void { |
| 3946 | \\ var a: S = undefined; | 4103 | \\ var a: S = undefined; |
| | 4104 | \\ _ = &a; |
| 3947 | \\ var b: S = undefined; | 4105 | \\ var b: S = undefined; |
| | 4106 | \\ _ = &b; |
| 3948 | \\ var c: c_long = @divExact(@as(c_long, @bitCast(@intFromPtr(a) -% @intFromPtr(b))), @sizeOf(u8)); | 4107 | \\ var c: c_long = @divExact(@as(c_long, @bitCast(@intFromPtr(a) -% @intFromPtr(b))), @sizeOf(u8)); |
| 3949 | \\ _ = &c; | 4108 | \\ _ = &c; |
| 3950 | \\} | 4109 | \\} |
| ... | @@ -3973,7 +4132,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3973,7 +4132,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3973 | , &[_][]const u8{ | 4132 | , &[_][]const u8{ |
| 3974 | \\pub export fn foo() void { | 4133 | \\pub export fn foo() void { |
| 3975 | \\ var n: c_int = undefined; | 4134 | \\ var n: c_int = undefined; |
| | 4135 | \\ _ = &n; |
| 3976 | \\ var tmp: c_int = 1; | 4136 | \\ var tmp: c_int = 1; |
| | 4137 | \\ _ = &tmp; |
| 3977 | \\ if ((blk: { | 4138 | \\ if ((blk: { |
| 3978 | \\ const tmp_1 = tmp; | 4139 | \\ const tmp_1 = tmp; |
| 3979 | \\ n = tmp_1; | 4140 | \\ n = tmp_1; |
| ... | @@ -3990,7 +4151,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3990,7 +4151,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3990 | , &[_][]const u8{ | 4151 | , &[_][]const u8{ |
| 3991 | \\pub export fn foo() void { | 4152 | \\pub export fn foo() void { |
| 3992 | \\ var tmp: c_int = undefined; | 4153 | \\ var tmp: c_int = undefined; |
| | 4154 | \\ _ = &tmp; |
| 3993 | \\ var n: c_int = 1; | 4155 | \\ var n: c_int = 1; |
| | 4156 | \\ _ = &n; |
| 3994 | \\ if ((blk: { | 4157 | \\ if ((blk: { |
| 3995 | \\ const tmp_1 = n; | 4158 | \\ const tmp_1 = n; |
| 3996 | \\ tmp = tmp_1; | 4159 | \\ tmp = tmp_1; |
| ... | @@ -4007,7 +4170,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -4007,7 +4170,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 4007 | , &[_][]const u8{ | 4170 | , &[_][]const u8{ |
| 4008 | \\pub export fn foo() void { | 4171 | \\pub export fn foo() void { |
| 4009 | \\ var n: c_int = undefined; | 4172 | \\ var n: c_int = undefined; |
| | 4173 | \\ _ = &n; |
| 4010 | \\ var ref: c_int = 1; | 4174 | \\ var ref: c_int = 1; |
| | 4175 | \\ _ = &ref; |
| 4011 | \\ if ((blk: { | 4176 | \\ if ((blk: { |
| 4012 | \\ const tmp = blk_1: { | 4177 | \\ const tmp = blk_1: { |
| 4013 | \\ const ref_2 = &ref; | 4178 | \\ const ref_2 = &ref; |
| ... | @@ -4028,7 +4193,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -4028,7 +4193,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 4028 | , &[_][]const u8{ | 4193 | , &[_][]const u8{ |
| 4029 | \\pub export fn foo() void { | 4194 | \\pub export fn foo() void { |
| 4030 | \\ var n: c_int = undefined; | 4195 | \\ var n: c_int = undefined; |
| | 4196 | \\ _ = &n; |
| 4031 | \\ var ref: c_int = 1; | 4197 | \\ var ref: c_int = 1; |
| | 4198 | \\ _ = &ref; |
| 4032 | \\ if ((blk: { | 4199 | \\ if ((blk: { |
| 4033 | \\ const tmp = blk_1: { | 4200 | \\ const tmp = blk_1: { |
| 4034 | \\ const ref_2 = &ref; | 4201 | \\ const ref_2 = &ref; |
| ... | @@ -4050,7 +4217,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -4050,7 +4217,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 4050 | , &[_][]const u8{ | 4217 | , &[_][]const u8{ |
| 4051 | \\pub export fn foo() void { | 4218 | \\pub export fn foo() void { |
| 4052 | \\ var n: c_int = undefined; | 4219 | \\ var n: c_int = undefined; |
| | 4220 | \\ _ = &n; |
| 4053 | \\ var ref: c_int = 1; | 4221 | \\ var ref: c_int = 1; |
| | 4222 | \\ _ = &ref; |
| 4054 | \\ if ((blk: { | 4223 | \\ if ((blk: { |
| 4055 | \\ const ref_1 = &n; | 4224 | \\ const ref_1 = &n; |
| 4056 | \\ ref_1.* += ref; | 4225 | \\ ref_1.* += ref; |
| ... | @@ -4067,7 +4236,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -4067,7 +4236,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 4067 | , &[_][]const u8{ | 4236 | , &[_][]const u8{ |
| 4068 | \\pub export fn foo() void { | 4237 | \\pub export fn foo() void { |
| 4069 | \\ var ref: c_int = undefined; | 4238 | \\ var ref: c_int = undefined; |
| | 4239 | \\ _ = &ref; |
| 4070 | \\ var n: c_int = 1; | 4240 | \\ var n: c_int = 1; |
| | 4241 | \\ _ = &n; |
| 4071 | \\ if ((blk: { | 4242 | \\ if ((blk: { |
| 4072 | \\ const ref_1 = &ref; | 4243 | \\ const ref_1 = &ref; |
| 4073 | \\ ref_1.* += n; | 4244 | \\ ref_1.* += n; |
| ... | @@ -4085,8 +4256,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -4085,8 +4256,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 4085 | , &[_][]const u8{ | 4256 | , &[_][]const u8{ |
| 4086 | \\pub export fn foo() void { | 4257 | \\pub export fn foo() void { |
| 4087 | \\ var f: c_int = 1; | 4258 | \\ var f: c_int = 1; |
| | 4259 | \\ _ = &f; |
| 4088 | \\ var n: c_int = undefined; | 4260 | \\ var n: c_int = undefined; |
| | 4261 | \\ _ = &n; |
| 4089 | \\ var cond_temp: c_int = 1; | 4262 | \\ var cond_temp: c_int = 1; |
| | 4263 | \\ _ = &cond_temp; |
| 4090 | \\ if ((blk: { | 4264 | \\ if ((blk: { |
| 4091 | \\ const tmp = blk_1: { | 4265 | \\ const tmp = blk_1: { |
| 4092 | \\ const cond_temp_2 = cond_temp; | 4266 | \\ const cond_temp_2 = cond_temp; |
| ... | @@ -4107,8 +4281,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -4107,8 +4281,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 4107 | , &[_][]const u8{ | 4281 | , &[_][]const u8{ |
| 4108 | \\pub export fn foo() void { | 4282 | \\pub export fn foo() void { |
| 4109 | \\ var cond_temp: c_int = 1; | 4283 | \\ var cond_temp: c_int = 1; |
| | 4284 | \\ _ = &cond_temp; |
| 4110 | \\ var n: c_int = undefined; | 4285 | \\ var n: c_int = undefined; |
| | 4286 | \\ _ = &n; |
| 4111 | \\ var f: c_int = 1; | 4287 | \\ var f: c_int = 1; |
| | 4288 | \\ _ = &f; |
| 4112 | \\ if ((blk: { | 4289 | \\ if ((blk: { |
| 4113 | \\ const tmp = blk_1: { | 4290 | \\ const tmp = blk_1: { |
| 4114 | \\ const cond_temp_2 = f; | 4291 | \\ const cond_temp_2 = f; |
| ... | @@ -4149,6 +4326,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -4149,6 +4326,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 4149 | , &[_][]const u8{ | 4326 | , &[_][]const u8{ |
| 4150 | \\pub export fn somefunc() void { | 4327 | \\pub export fn somefunc() void { |
| 4151 | \\ var y: c_int = undefined; | 4328 | \\ var y: c_int = undefined; |
| | 4329 | \\ _ = &y; |
| 4152 | \\ _ = blk: { | 4330 | \\ _ = blk: { |
| 4153 | \\ y = 1; | 4331 | \\ y = 1; |
| 4154 | \\ }; | 4332 | \\ }; |