authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2023-11-14 08:11:37+00:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2023-11-19 09:57:04+00:00
logd82d327de22db3cd2ed4412f395dd5276a3b6a06
treee54151d8152b514b8a4af9524ab4e7eec533b9c8
parent9c16b2370d30e74a63a84a835d840266021424fd
signature Commit is signed but in an unrecognized format.

test: update remaining code to fix 'var is never mutated' errors


11 files changed, 49 insertions(+), 50 deletions(-)

test/c_abi/main.zig+32-31
...@@ -278,7 +278,7 @@ test "C ABI big struct" {...@@ -278,7 +278,7 @@ test "C ABI big struct" {
278 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;278 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
279 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;279 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
280280
281 var s = BigStruct{281 const s = BigStruct{
282 .a = 1,282 .a = 1,
283 .b = 2,283 .b = 2,
284 .c = 3,284 .c = 3,
...@@ -304,7 +304,7 @@ extern fn c_big_union(BigUnion) void;...@@ -304,7 +304,7 @@ extern fn c_big_union(BigUnion) void;
304test "C ABI big union" {304test "C ABI big union" {
305 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;305 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
306306
307 var x = BigUnion{307 const x = BigUnion{
308 .a = BigStruct{308 .a = BigStruct{
309 .a = 1,309 .a = 1,
310 .b = 2,310 .b = 2,
...@@ -339,13 +339,13 @@ test "C ABI medium struct of ints and floats" {...@@ -339,13 +339,13 @@ test "C ABI medium struct of ints and floats" {
339 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;339 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
340 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;340 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
341341
342 var s = MedStructMixed{342 const s = MedStructMixed{
343 .a = 1234,343 .a = 1234,
344 .b = 100.0,344 .b = 100.0,
345 .c = 1337.0,345 .c = 1337.0,
346 };346 };
347 c_med_struct_mixed(s);347 c_med_struct_mixed(s);
348 var s2 = c_ret_med_struct_mixed();348 const s2 = c_ret_med_struct_mixed();
349 try expect(s2.a == 1234);349 try expect(s2.a == 1234);
350 try expect(s2.b == 100.0);350 try expect(s2.b == 100.0);
351 try expect(s2.c == 1337.0);351 try expect(s2.c == 1337.0);
...@@ -372,14 +372,14 @@ test "C ABI small struct of ints" {...@@ -372,14 +372,14 @@ test "C ABI small struct of ints" {
372 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;372 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
373 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;373 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
374374
375 var s = SmallStructInts{375 const s = SmallStructInts{
376 .a = 1,376 .a = 1,
377 .b = 2,377 .b = 2,
378 .c = 3,378 .c = 3,
379 .d = 4,379 .d = 4,
380 };380 };
381 c_small_struct_ints(s);381 c_small_struct_ints(s);
382 var s2 = c_ret_small_struct_ints();382 const s2 = c_ret_small_struct_ints();
383 try expect(s2.a == 1);383 try expect(s2.a == 1);
384 try expect(s2.b == 2);384 try expect(s2.b == 2);
385 try expect(s2.c == 3);385 try expect(s2.c == 3);
...@@ -407,13 +407,13 @@ test "C ABI medium struct of ints" {...@@ -407,13 +407,13 @@ test "C ABI medium struct of ints" {
407 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;407 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
408 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;408 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
409409
410 var s = MedStructInts{410 const s = MedStructInts{
411 .x = 1,411 .x = 1,
412 .y = 2,412 .y = 2,
413 .z = 3,413 .z = 3,
414 };414 };
415 c_med_struct_ints(s);415 c_med_struct_ints(s);
416 var s2 = c_ret_med_struct_ints();416 const s2 = c_ret_med_struct_ints();
417 try expect(s2.x == 1);417 try expect(s2.x == 1);
418 try expect(s2.y == 2);418 try expect(s2.y == 2);
419 try expect(s2.z == 3);419 try expect(s2.z == 3);
...@@ -442,9 +442,9 @@ export fn zig_small_packed_struct(x: SmallPackedStruct) void {...@@ -442,9 +442,9 @@ export fn zig_small_packed_struct(x: SmallPackedStruct) void {
442}442}
443443
444test "C ABI small packed struct" {444test "C ABI small packed struct" {
445 var s = SmallPackedStruct{ .a = 0, .b = 1, .c = 2, .d = 3 };445 const s = SmallPackedStruct{ .a = 0, .b = 1, .c = 2, .d = 3 };
446 c_small_packed_struct(s);446 c_small_packed_struct(s);
447 var s2 = c_ret_small_packed_struct();447 const s2 = c_ret_small_packed_struct();
448 try expect(s2.a == 0);448 try expect(s2.a == 0);
449 try expect(s2.b == 1);449 try expect(s2.b == 1);
450 try expect(s2.c == 2);450 try expect(s2.c == 2);
...@@ -466,9 +466,9 @@ export fn zig_big_packed_struct(x: BigPackedStruct) void {...@@ -466,9 +466,9 @@ export fn zig_big_packed_struct(x: BigPackedStruct) void {
466test "C ABI big packed struct" {466test "C ABI big packed struct" {
467 if (!has_i128) return error.SkipZigTest;467 if (!has_i128) return error.SkipZigTest;
468468
469 var s = BigPackedStruct{ .a = 1, .b = 2 };469 const s = BigPackedStruct{ .a = 1, .b = 2 };
470 c_big_packed_struct(s);470 c_big_packed_struct(s);
471 var s2 = c_ret_big_packed_struct();471 const s2 = c_ret_big_packed_struct();
472 try expect(s2.a == 1);472 try expect(s2.a == 1);
473 try expect(s2.b == 2);473 try expect(s2.b == 2);
474}474}
...@@ -486,7 +486,7 @@ test "C ABI split struct of ints" {...@@ -486,7 +486,7 @@ test "C ABI split struct of ints" {
486 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;486 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
487 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;487 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
488488
489 var s = SplitStructInt{489 const s = SplitStructInt{
490 .a = 1234,490 .a = 1234,
491 .b = 100,491 .b = 100,
492 .c = 1337,492 .c = 1337,
...@@ -514,13 +514,13 @@ test "C ABI split struct of ints and floats" {...@@ -514,13 +514,13 @@ test "C ABI split struct of ints and floats" {
514 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;514 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
515 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;515 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
516516
517 var s = SplitStructMixed{517 const s = SplitStructMixed{
518 .a = 1234,518 .a = 1234,
519 .b = 100,519 .b = 100,
520 .c = 1337.0,520 .c = 1337.0,
521 };521 };
522 c_split_struct_mixed(s);522 c_split_struct_mixed(s);
523 var s2 = c_ret_split_struct_mixed();523 const s2 = c_ret_split_struct_mixed();
524 try expect(s2.a == 1234);524 try expect(s2.a == 1234);
525 try expect(s2.b == 100);525 try expect(s2.b == 100);
526 try expect(s2.c == 1337.0);526 try expect(s2.c == 1337.0);
...@@ -541,14 +541,14 @@ test "C ABI sret and byval together" {...@@ -541,14 +541,14 @@ test "C ABI sret and byval together" {
541 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;541 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
542 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;542 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
543543
544 var s = BigStruct{544 const s = BigStruct{
545 .a = 1,545 .a = 1,
546 .b = 2,546 .b = 2,
547 .c = 3,547 .c = 3,
548 .d = 4,548 .d = 4,
549 .e = 5,549 .e = 5,
550 };550 };
551 var y = c_big_struct_both(s);551 const y = c_big_struct_both(s);
552 try expect(y.a == 10);552 try expect(y.a == 10);
553 try expect(y.b == 11);553 try expect(y.b == 11);
554 try expect(y.c == 12);554 try expect(y.c == 12);
...@@ -562,7 +562,7 @@ export fn zig_big_struct_both(x: BigStruct) BigStruct {...@@ -562,7 +562,7 @@ export fn zig_big_struct_both(x: BigStruct) BigStruct {
562 expect(x.c == 32) catch @panic("test failure");562 expect(x.c == 32) catch @panic("test failure");
563 expect(x.d == 33) catch @panic("test failure");563 expect(x.d == 33) catch @panic("test failure");
564 expect(x.e == 34) catch @panic("test failure");564 expect(x.e == 34) catch @panic("test failure");
565 var s = BigStruct{565 const s = BigStruct{
566 .a = 20,566 .a = 20,
567 .b = 21,567 .b = 21,
568 .c = 22,568 .c = 22,
...@@ -594,7 +594,7 @@ test "C ABI structs of floats as parameter" {...@@ -594,7 +594,7 @@ test "C ABI structs of floats as parameter" {
594 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;594 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
595 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;595 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
596596
597 var v3 = Vector3{597 const v3 = Vector3{
598 .x = 3.0,598 .x = 3.0,
599 .y = 6.0,599 .y = 6.0,
600 .z = 12.0,600 .z = 12.0,
...@@ -602,7 +602,7 @@ test "C ABI structs of floats as parameter" {...@@ -602,7 +602,7 @@ test "C ABI structs of floats as parameter" {
602 c_small_struct_floats(v3);602 c_small_struct_floats(v3);
603 c_small_struct_floats_extra(v3, "hello");603 c_small_struct_floats_extra(v3, "hello");
604604
605 var v5 = Vector5{605 const v5 = Vector5{
606 .x = 76.0,606 .x = 76.0,
607 .y = -1.0,607 .y = -1.0,
608 .z = -12.0,608 .z = -12.0,
...@@ -634,13 +634,13 @@ test "C ABI structs of ints as multiple parameters" {...@@ -634,13 +634,13 @@ test "C ABI structs of ints as multiple parameters" {
634 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;634 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
635 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;635 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
636636
637 var r1 = Rect{637 const r1 = Rect{
638 .left = 1,638 .left = 1,
639 .right = 21,639 .right = 21,
640 .top = 16,640 .top = 16,
641 .bottom = 4,641 .bottom = 4,
642 };642 };
643 var r2 = Rect{643 const r2 = Rect{
644 .left = 178,644 .left = 178,
645 .right = 189,645 .right = 189,
646 .top = 21,646 .top = 21,
...@@ -671,13 +671,13 @@ test "C ABI structs of floats as multiple parameters" {...@@ -671,13 +671,13 @@ test "C ABI structs of floats as multiple parameters" {
671 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;671 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
672 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;672 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
673673
674 var r1 = FloatRect{674 const r1 = FloatRect{
675 .left = 1,675 .left = 1,
676 .right = 21,676 .right = 21,
677 .top = 16,677 .top = 16,
678 .bottom = 4,678 .bottom = 4,
679 };679 };
680 var r2 = FloatRect{680 const r2 = FloatRect{
681 .left = 178,681 .left = 178,
682 .right = 189,682 .right = 189,
683 .top = 21,683 .top = 21,
...@@ -787,7 +787,7 @@ test "Struct with array as padding." {...@@ -787,7 +787,7 @@ test "Struct with array as padding." {
787787
788 c_struct_with_array(.{ .a = 1, .padding = undefined, .b = 2 });788 c_struct_with_array(.{ .a = 1, .padding = undefined, .b = 2 });
789789
790 var x = c_ret_struct_with_array();790 const x = c_ret_struct_with_array();
791 try expect(x.a == 4);791 try expect(x.a == 4);
792 try expect(x.b == 155);792 try expect(x.b == 155);
793}793}
...@@ -822,7 +822,7 @@ test "Float array like struct" {...@@ -822,7 +822,7 @@ test "Float array like struct" {
822 },822 },
823 });823 });
824824
825 var x = c_ret_float_array_struct();825 const x = c_ret_float_array_struct();
826 try expect(x.origin.x == 1);826 try expect(x.origin.x == 1);
827 try expect(x.origin.y == 2);827 try expect(x.origin.y == 2);
828 try expect(x.size.width == 3);828 try expect(x.size.width == 3);
...@@ -840,7 +840,7 @@ test "small simd vector" {...@@ -840,7 +840,7 @@ test "small simd vector" {
840840
841 c_small_vec(.{ 1, 2 });841 c_small_vec(.{ 1, 2 });
842842
843 var x = c_ret_small_vec();843 const x = c_ret_small_vec();
844 try expect(x[0] == 3);844 try expect(x[0] == 3);
845 try expect(x[1] == 4);845 try expect(x[1] == 4);
846}846}
...@@ -858,7 +858,7 @@ test "medium simd vector" {...@@ -858,7 +858,7 @@ test "medium simd vector" {
858858
859 c_medium_vec(.{ 1, 2, 3, 4 });859 c_medium_vec(.{ 1, 2, 3, 4 });
860860
861 var x = c_ret_medium_vec();861 const x = c_ret_medium_vec();
862 try expect(x[0] == 5);862 try expect(x[0] == 5);
863 try expect(x[1] == 6);863 try expect(x[1] == 6);
864 try expect(x[2] == 7);864 try expect(x[2] == 7);
...@@ -879,7 +879,7 @@ test "big simd vector" {...@@ -879,7 +879,7 @@ test "big simd vector" {
879879
880 c_big_vec(.{ 1, 2, 3, 4, 5, 6, 7, 8 });880 c_big_vec(.{ 1, 2, 3, 4, 5, 6, 7, 8 });
881881
882 var x = c_ret_big_vec();882 const x = c_ret_big_vec();
883 try expect(x[0] == 9);883 try expect(x[0] == 9);
884 try expect(x[1] == 10);884 try expect(x[1] == 10);
885 try expect(x[2] == 11);885 try expect(x[2] == 11);
...@@ -903,7 +903,7 @@ test "C ABI pointer sized float struct" {...@@ -903,7 +903,7 @@ test "C ABI pointer sized float struct" {
903903
904 c_ptr_size_float_struct(.{ .x = 1, .y = 2 });904 c_ptr_size_float_struct(.{ .x = 1, .y = 2 });
905905
906 var x = c_ret_ptr_size_float_struct();906 const x = c_ret_ptr_size_float_struct();
907 try expect(x.x == 3);907 try expect(x.x == 3);
908 try expect(x.y == 4);908 try expect(x.y == 4);
909}909}
...@@ -1102,6 +1102,7 @@ test "C function that takes byval struct called via function pointer" {...@@ -1102,6 +1102,7 @@ test "C function that takes byval struct called via function pointer" {
1102 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;1102 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
11031103
1104 var fn_ptr = &c_func_ptr_byval;1104 var fn_ptr = &c_func_ptr_byval;
1105 _ = &fn_ptr;
1105 fn_ptr(1106 fn_ptr(
1106 @as(*anyopaque, @ptrFromInt(1)),1107 @as(*anyopaque, @ptrFromInt(1)),
1107 @as(*anyopaque, @ptrFromInt(2)),1108 @as(*anyopaque, @ptrFromInt(2)),
...@@ -1224,7 +1225,7 @@ extern fn stdcall_big_union(BigUnion) callconv(stdcall_callconv) void;...@@ -1224,7 +1225,7 @@ extern fn stdcall_big_union(BigUnion) callconv(stdcall_callconv) void;
1224test "Stdcall ABI big union" {1225test "Stdcall ABI big union" {
1225 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;1226 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
12261227
1227 var x = BigUnion{1228 const x = BigUnion{
1228 .a = BigStruct{1229 .a = BigStruct{
1229 .a = 1,1230 .a = 1,
1230 .b = 2,1231 .b = 2,
test/compare_output.zig+2-2
...@@ -165,7 +165,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -165,7 +165,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
165 \\const y : u16 = 5678;165 \\const y : u16 = 5678;
166 \\pub fn main() void {166 \\pub fn main() void {
167 \\ var x_local : i32 = print_ok(x);167 \\ var x_local : i32 = print_ok(x);
168 \\ _ = x_local;168 \\ _ = &x_local;
169 \\}169 \\}
170 \\fn print_ok(val: @TypeOf(x)) @TypeOf(foo) {170 \\fn print_ok(val: @TypeOf(x)) @TypeOf(foo) {
171 \\ _ = val;171 \\ _ = val;
...@@ -504,7 +504,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -504,7 +504,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
504 \\504 \\
505 \\pub fn main() !void {505 \\pub fn main() !void {
506 \\ var allocator_buf: [10]u8 = undefined;506 \\ var allocator_buf: [10]u8 = undefined;
507 \\ var fba = std.heap.FixedBufferAllocator.init(&allocator_buf);507 \\ const fba = std.heap.FixedBufferAllocator.init(&allocator_buf);
508 \\ var fba_wrapped = std.mem.validationWrap(fba);508 \\ var fba_wrapped = std.mem.validationWrap(fba);
509 \\ var logging_allocator = std.heap.loggingAllocator(fba_wrapped.allocator());509 \\ var logging_allocator = std.heap.loggingAllocator(fba_wrapped.allocator());
510 \\ const allocator = logging_allocator.allocator();510 \\ const allocator = logging_allocator.allocator();
test/link/wasm/archive/main.zig+2-1
...@@ -1,6 +1,7 @@...@@ -1,6 +1,7 @@
1export fn foo() void {1export fn foo() void {
2 var a: f16 = 2.2;2 var a: f16 = 2.2;
3 _ = &a;
3 // this will pull-in compiler-rt4 // this will pull-in compiler-rt
4 var b = @trunc(a);5 const b = @trunc(a);
5 _ = b;6 _ = b;
6}7}
test/src/Cases.zig+2-5
...@@ -1161,10 +1161,7 @@ const TestManifest = struct {...@@ -1161,10 +1161,7 @@ const TestManifest = struct {
1161 fn getDefaultParser(comptime T: type) ParseFn(T) {1161 fn getDefaultParser(comptime T: type) ParseFn(T) {
1162 if (T == CrossTarget) return struct {1162 if (T == CrossTarget) return struct {
1163 fn parse(str: []const u8) anyerror!T {1163 fn parse(str: []const u8) anyerror!T {
1164 var opts = CrossTarget.ParseOptions{1164 return CrossTarget.parse(.{ .arch_os_abi = str });
1165 .arch_os_abi = str,
1166 };
1167 return try CrossTarget.parse(opts);
1168 }1165 }
1169 }.parse;1166 }.parse;
11701167
...@@ -1691,7 +1688,7 @@ fn runOneCase(...@@ -1691,7 +1688,7 @@ fn runOneCase(
1691 var argv = std.ArrayList([]const u8).init(allocator);1688 var argv = std.ArrayList([]const u8).init(allocator);
1692 defer argv.deinit();1689 defer argv.deinit();
16931690
1694 var exec_result = x: {1691 const exec_result = x: {
1695 var exec_node = update_node.start("execute", 0);1692 var exec_node = update_node.start("execute", 0);
1696 exec_node.activate();1693 exec_node.activate();
1697 defer exec_node.end();1694 defer exec_node.end();
test/standalone/extern/main.zig+2-2
...@@ -6,8 +6,8 @@ const getHidden = @extern(*const fn () callconv(.C) u32, .{ .name = "getHidden"...@@ -6,8 +6,8 @@ const getHidden = @extern(*const fn () callconv(.C) u32, .{ .name = "getHidden"
6const T = extern struct { x: u32 };6const T = extern struct { x: u32 };
77
8test {8test {
9 var mut_val_ptr = @extern(*f64, .{ .name = "mut_val" });9 const mut_val_ptr = @extern(*f64, .{ .name = "mut_val" });
10 var const_val_ptr = @extern(*const T, .{ .name = "const_val" });10 const const_val_ptr = @extern(*const T, .{ .name = "const_val" });
1111
12 assert(getHidden() == 0);12 assert(getHidden() == 0);
13 updateHidden(123);13 updateHidden(123);
test/standalone/main_return_error/error_u8_non_zero.zig+1-2
...@@ -1,8 +1,7 @@...@@ -1,8 +1,7 @@
1const Err = error{Foo};1const Err = error{Foo};
22
3fn foo() u8 {3fn foo() u8 {
4 var x = @as(u8, @intCast(9));4 return @intCast(9);
5 return x;
6}5}
76
8pub fn main() !u8 {7pub fn main() !u8 {
test/standalone/stack_iterator/shared_lib_unwind.zig+1-1
...@@ -9,7 +9,7 @@ noinline fn frame4(expected: *[5]usize, unwound: *[5]usize) void {...@@ -9,7 +9,7 @@ noinline fn frame4(expected: *[5]usize, unwound: *[5]usize) void {
9 var context: debug.ThreadContext = undefined;9 var context: debug.ThreadContext = undefined;
10 testing.expect(debug.getContext(&context)) catch @panic("failed to getContext");10 testing.expect(debug.getContext(&context)) catch @panic("failed to getContext");
1111
12 var debug_info = debug.getSelfDebugInfo() catch @panic("failed to openSelfDebugInfo");12 const debug_info = debug.getSelfDebugInfo() catch @panic("failed to openSelfDebugInfo");
13 var it = debug.StackIterator.initWithContext(expected[0], debug_info, &context) catch @panic("failed to initWithContext");13 var it = debug.StackIterator.initWithContext(expected[0], debug_info, &context) catch @panic("failed to initWithContext");
14 defer it.deinit();14 defer it.deinit();
1515
test/standalone/stack_iterator/unwind.zig+2-2
...@@ -9,7 +9,7 @@ noinline fn frame3(expected: *[4]usize, unwound: *[4]usize) void {...@@ -9,7 +9,7 @@ noinline fn frame3(expected: *[4]usize, unwound: *[4]usize) void {
9 var context: debug.ThreadContext = undefined;9 var context: debug.ThreadContext = undefined;
10 testing.expect(debug.getContext(&context)) catch @panic("failed to getContext");10 testing.expect(debug.getContext(&context)) catch @panic("failed to getContext");
1111
12 var debug_info = debug.getSelfDebugInfo() catch @panic("failed to openSelfDebugInfo");12 const debug_info = debug.getSelfDebugInfo() catch @panic("failed to openSelfDebugInfo");
13 var it = debug.StackIterator.initWithContext(expected[0], debug_info, &context) catch @panic("failed to initWithContext");13 var it = debug.StackIterator.initWithContext(expected[0], debug_info, &context) catch @panic("failed to initWithContext");
14 defer it.deinit();14 defer it.deinit();
1515
...@@ -76,7 +76,7 @@ noinline fn frame1(expected: *[4]usize, unwound: *[4]usize) void {...@@ -76,7 +76,7 @@ noinline fn frame1(expected: *[4]usize, unwound: *[4]usize) void {
76 // Use a stack frame that is too big to encode in __unwind_info's stack-immediate encoding76 // Use a stack frame that is too big to encode in __unwind_info's stack-immediate encoding
77 // to exercise the stack-indirect encoding path77 // to exercise the stack-indirect encoding path
78 var pad: [std.math.maxInt(u8) * @sizeOf(usize) + 1]u8 = undefined;78 var pad: [std.math.maxInt(u8) * @sizeOf(usize) + 1]u8 = undefined;
79 _ = pad;79 _ = std.mem.doNotOptimizeAway(&pad);
8080
81 frame2(expected, unwound);81 frame2(expected, unwound);
82}82}
test/standalone/use_alias/main.zig+1
...@@ -6,5 +6,6 @@ test "symbol exists" {...@@ -6,5 +6,6 @@ test "symbol exists" {
6 .a = 1,6 .a = 1,
7 .b = 1,7 .b = 1,
8 };8 };
9 _ = &foo;
9 try expect(foo.a + foo.b == 2);10 try expect(foo.a + foo.b == 2);
10}11}
test/standalone/windows_spawn/main.zig+1-1
...@@ -158,7 +158,7 @@ fn testExec(allocator: std.mem.Allocator, command: []const u8, expected_stdout:...@@ -158,7 +158,7 @@ fn testExec(allocator: std.mem.Allocator, command: []const u8, expected_stdout:
158}158}
159159
160fn testExecWithCwd(allocator: std.mem.Allocator, command: []const u8, cwd: ?[]const u8, expected_stdout: []const u8) !void {160fn testExecWithCwd(allocator: std.mem.Allocator, command: []const u8, cwd: ?[]const u8, expected_stdout: []const u8) !void {
161 var result = try std.ChildProcess.run(.{161 const result = try std.ChildProcess.run(.{
162 .allocator = allocator,162 .allocator = allocator,
163 .argv = &[_][]const u8{command},163 .argv = &[_][]const u8{command},
164 .cwd = cwd,164 .cwd = cwd,
test/standalone/zerolength_check/src/main.zig+3-3
...@@ -1,14 +1,14 @@...@@ -1,14 +1,14 @@
1const std = @import("std");1const std = @import("std");
22
3test {3test {
4 var dest = foo();4 const dest = foo();
5 var source = foo();5 const source = foo();
66
7 @memcpy(dest, source);7 @memcpy(dest, source);
8 @memset(dest, 4);8 @memset(dest, 4);
9 @memset(dest, undefined);9 @memset(dest, undefined);
1010
11 var dest2 = foo2();11 const dest2 = foo2();
12 @memset(dest2, 0);12 @memset(dest2, 0);
13}13}
1414