authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-10-26 02:11:54-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-10-26 21:45:58-04:00
log98cd3782087d198425cfa19906f43d53b8106837
treeb4527ce34088a73402bc9f269346abc3ab50c988
parent3faa4ea9594f058da7522808ffc9587b77ac94a6

x86_64: fix behavior of `getValue`

Old behavior renamed to `getValueIfFree`.

16 files changed, 334 insertions(+), 62 deletions(-)

lib/std/Build/Step/Options.zig-2
...@@ -295,8 +295,6 @@ const Arg = struct {...@@ -295,8 +295,6 @@ const Arg = struct {
295test Options {295test Options {
296 if (builtin.os.tag == .wasi) return error.SkipZigTest;296 if (builtin.os.tag == .wasi) return error.SkipZigTest;
297297
298 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
299
300 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);298 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
301 defer arena.deinit();299 defer arena.deinit();
302300
lib/std/array_hash_map.zig-2
...@@ -2294,8 +2294,6 @@ test "popOrNull" {...@@ -2294,8 +2294,6 @@ test "popOrNull" {
2294}2294}
22952295
2296test "reIndex" {2296test "reIndex" {
2297 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2298
2299 var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator);2297 var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator);
2300 defer map.deinit();2298 defer map.deinit();
23012299
lib/std/json/JSONTestSuite_test.zig-6
...@@ -764,8 +764,6 @@ test "y_number_simple_real.json" {...@@ -764,8 +764,6 @@ test "y_number_simple_real.json" {
764 try ok("[123.456789]");764 try ok("[123.456789]");
765}765}
766test "y_object.json" {766test "y_object.json" {
767 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
768
769 try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}");767 try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}");
770}768}
771test "y_object_basic.json" {769test "y_object_basic.json" {
...@@ -787,13 +785,9 @@ test "y_object_escaped_null_in_key.json" {...@@ -787,13 +785,9 @@ test "y_object_escaped_null_in_key.json" {
787 try ok("{\"foo\\u0000bar\": 42}");785 try ok("{\"foo\\u0000bar\": 42}");
788}786}
789test "y_object_extreme_numbers.json" {787test "y_object_extreme_numbers.json" {
790 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
791
792 try ok("{ \"min\": -1.0e+28, \"max\": 1.0e+28 }");788 try ok("{ \"min\": -1.0e+28, \"max\": 1.0e+28 }");
793}789}
794test "y_object_long_strings.json" {790test "y_object_long_strings.json" {
795 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
796
797 try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}");791 try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}");
798}792}
799test "y_object_simple.json" {793test "y_object_simple.json" {
lib/std/json/dynamic_test.zig-13
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const mem = std.mem;2const mem = std.mem;
4const testing = std.testing;3const testing = std.testing;
5const ArenaAllocator = std.heap.ArenaAllocator;4const ArenaAllocator = std.heap.ArenaAllocator;
...@@ -19,8 +18,6 @@ const jsonReader = @import("scanner.zig").reader;...@@ -19,8 +18,6 @@ const jsonReader = @import("scanner.zig").reader;
19const JsonReader = @import("scanner.zig").Reader;18const JsonReader = @import("scanner.zig").Reader;
2019
21test "json.parser.dynamic" {20test "json.parser.dynamic" {
22 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
23
24 const s =21 const s =
25 \\{22 \\{
26 \\ "Image": {23 \\ "Image": {
...@@ -75,8 +72,6 @@ test "json.parser.dynamic" {...@@ -75,8 +72,6 @@ test "json.parser.dynamic" {
7572
76const writeStream = @import("./stringify.zig").writeStream;73const writeStream = @import("./stringify.zig").writeStream;
77test "write json then parse it" {74test "write json then parse it" {
78 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
79
80 var out_buffer: [1000]u8 = undefined;75 var out_buffer: [1000]u8 = undefined;
8176
82 var fixed_buffer_stream = std.io.fixedBufferStream(&out_buffer);77 var fixed_buffer_stream = std.io.fixedBufferStream(&out_buffer);
...@@ -143,8 +138,6 @@ test "Value.array allocator should still be usable after parsing" {...@@ -143,8 +138,6 @@ test "Value.array allocator should still be usable after parsing" {
143}138}
144139
145test "integer after float has proper type" {140test "integer after float has proper type" {
146 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
147
148 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);141 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
149 defer arena_allocator.deinit();142 defer arena_allocator.deinit();
150 const parsed = try testParse(arena_allocator.allocator(),143 const parsed = try testParse(arena_allocator.allocator(),
...@@ -157,8 +150,6 @@ test "integer after float has proper type" {...@@ -157,8 +150,6 @@ test "integer after float has proper type" {
157}150}
158151
159test "escaped characters" {152test "escaped characters" {
160 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
161
162 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);153 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
163 defer arena_allocator.deinit();154 defer arena_allocator.deinit();
164 const input =155 const input =
...@@ -238,8 +229,6 @@ test "Value.jsonStringify" {...@@ -238,8 +229,6 @@ test "Value.jsonStringify" {
238}229}
239230
240test "parseFromValue(std.json.Value,...)" {231test "parseFromValue(std.json.Value,...)" {
241 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
242
243 const str =232 const str =
244 \\{233 \\{
245 \\ "int": 32,234 \\ "int": 32,
...@@ -328,8 +317,6 @@ test "ParseOptions.max_value_len" {...@@ -328,8 +317,6 @@ test "ParseOptions.max_value_len" {
328}317}
329318
330test "many object keys" {319test "many object keys" {
331 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
332
333 const doc =320 const doc =
334 \\{321 \\{
335 \\ "k1": "v1",322 \\ "k1": "v1",
lib/std/json/hashmap_test.zig-13
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const testing = std.testing;2const testing = std.testing;
43
5const ArrayHashMap = @import("hashmap.zig").ArrayHashMap;4const ArrayHashMap = @import("hashmap.zig").ArrayHashMap;
...@@ -19,8 +18,6 @@ const T = struct {...@@ -19,8 +18,6 @@ const T = struct {
19};18};
2019
21test "parse json hashmap" {20test "parse json hashmap" {
22 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
23
24 const doc =21 const doc =
25 \\{22 \\{
26 \\ "abc": {"i": 0, "s": "d"},23 \\ "abc": {"i": 0, "s": "d"},
...@@ -36,8 +33,6 @@ test "parse json hashmap" {...@@ -36,8 +33,6 @@ test "parse json hashmap" {
36}33}
3734
38test "parse json hashmap while streaming" {35test "parse json hashmap while streaming" {
39 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
40
41 const doc =36 const doc =
42 \\{37 \\{
43 \\ "abc": {"i": 0, "s": "d"},38 \\ "abc": {"i": 0, "s": "d"},
...@@ -63,8 +58,6 @@ test "parse json hashmap while streaming" {...@@ -63,8 +58,6 @@ test "parse json hashmap while streaming" {
63}58}
6459
65test "parse json hashmap duplicate fields" {60test "parse json hashmap duplicate fields" {
66 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
67
68 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);61 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
69 defer arena.deinit();62 defer arena.deinit();
7063
...@@ -93,8 +86,6 @@ test "parse json hashmap duplicate fields" {...@@ -93,8 +86,6 @@ test "parse json hashmap duplicate fields" {
93}86}
9487
95test "stringify json hashmap" {88test "stringify json hashmap" {
96 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
97
98 var value = ArrayHashMap(T){};89 var value = ArrayHashMap(T){};
99 defer value.deinit(testing.allocator);90 defer value.deinit(testing.allocator);
100 {91 {
...@@ -132,8 +123,6 @@ test "stringify json hashmap" {...@@ -132,8 +123,6 @@ test "stringify json hashmap" {
132}123}
133124
134test "stringify json hashmap whitespace" {125test "stringify json hashmap whitespace" {
135 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
136
137 var value = ArrayHashMap(T){};126 var value = ArrayHashMap(T){};
138 defer value.deinit(testing.allocator);127 defer value.deinit(testing.allocator);
139 try value.map.put(testing.allocator, "abc", .{ .i = 0, .s = "d" });128 try value.map.put(testing.allocator, "abc", .{ .i = 0, .s = "d" });
...@@ -158,8 +147,6 @@ test "stringify json hashmap whitespace" {...@@ -158,8 +147,6 @@ test "stringify json hashmap whitespace" {
158}147}
159148
160test "json parse from value hashmap" {149test "json parse from value hashmap" {
161 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
162
163 const doc =150 const doc =
164 \\{151 \\{
165 \\ "abc": {"i": 0, "s": "d"},152 \\ "abc": {"i": 0, "s": "d"},
lib/std/json/static_test.zig+1-2
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const testing = std.testing;2const testing = std.testing;
4const ArenaAllocator = std.heap.ArenaAllocator;3const ArenaAllocator = std.heap.ArenaAllocator;
5const Allocator = std.mem.Allocator;4const Allocator = std.mem.Allocator;
...@@ -786,7 +785,7 @@ test "max_value_len" {...@@ -786,7 +785,7 @@ test "max_value_len" {
786}785}
787786
788test "parse into vector" {787test "parse into vector" {
789 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;788 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
790789
791 const T = struct {790 const T = struct {
792 vec_i32: @Vector(4, i32),791 vec_i32: @Vector(4, i32),
lib/std/json/stringify_test.zig-3
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const mem = std.mem;2const mem = std.mem;
4const testing = std.testing;3const testing = std.testing;
54
...@@ -16,8 +15,6 @@ const writeStreamMaxDepth = @import("stringify.zig").writeStreamMaxDepth;...@@ -16,8 +15,6 @@ const writeStreamMaxDepth = @import("stringify.zig").writeStreamMaxDepth;
16const writeStreamArbitraryDepth = @import("stringify.zig").writeStreamArbitraryDepth;15const writeStreamArbitraryDepth = @import("stringify.zig").writeStreamArbitraryDepth;
1716
18test "json write stream" {17test "json write stream" {
19 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
20
21 var out_buf: [1024]u8 = undefined;18 var out_buf: [1024]u8 = undefined;
22 var slice_stream = std.io.fixedBufferStream(&out_buf);19 var slice_stream = std.io.fixedBufferStream(&out_buf);
23 const out = slice_stream.writer();20 const out = slice_stream.writer();
lib/std/json/test.zig-2
...@@ -34,8 +34,6 @@ fn testHighLevelDynamicParser(s: []const u8) !void {...@@ -34,8 +34,6 @@ fn testHighLevelDynamicParser(s: []const u8) !void {
3434
35// Additional tests not part of test JSONTestSuite.35// Additional tests not part of test JSONTestSuite.
36test "y_trailing_comma_after_empty" {36test "y_trailing_comma_after_empty" {
37 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
38
39 try roundTrip(37 try roundTrip(
40 \\{"1":[],"2":{},"3":"4"}38 \\{"1":[],"2":{},"3":"4"}
41 );39 );
lib/std/math/ilogb.zig+1-2
...@@ -6,7 +6,6 @@...@@ -6,7 +6,6 @@
6// https://git.musl-libc.org/cgit/musl/tree/src/math/ilogb.c6// https://git.musl-libc.org/cgit/musl/tree/src/math/ilogb.c
77
8const std = @import("../std.zig");8const std = @import("../std.zig");
9const builtin = @import("builtin");
10const math = std.math;9const math = std.math;
11const expect = std.testing.expect;10const expect = std.testing.expect;
12const maxInt = std.math.maxInt;11const maxInt = std.math.maxInt;
...@@ -109,7 +108,7 @@ test "64" {...@@ -109,7 +108,7 @@ test "64" {
109}108}
110109
111test "80" {110test "80" {
112 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;111 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
113112
114 try expect(ilogbX(f80, 0.0) == fp_ilogb0);113 try expect(ilogbX(f80, 0.0) == fp_ilogb0);
115 try expect(ilogbX(f80, 0.5) == -1);114 try expect(ilogbX(f80, 0.5) == -1);
lib/std/mem.zig+2-4
...@@ -4661,10 +4661,8 @@ pub fn alignInSlice(slice: anytype, comptime new_alignment: usize) ?AlignedSlice...@@ -4661,10 +4661,8 @@ pub fn alignInSlice(slice: anytype, comptime new_alignment: usize) ?AlignedSlice
4661}4661}
46624662
4663test "read/write(Var)PackedInt" {4663test "read/write(Var)PackedInt" {
4664 switch (builtin.zig_backend) {4664 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
4665 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,4665 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
4666 else => {},
4667 }
46684666
4669 switch (builtin.cpu.arch) {4667 switch (builtin.cpu.arch) {
4670 // This test generates too much code to execute on WASI.4668 // This test generates too much code to execute on WASI.
lib/std/net/test.zig-1
...@@ -107,7 +107,6 @@ test "parse and render UNIX addresses" {...@@ -107,7 +107,6 @@ test "parse and render UNIX addresses" {
107}107}
108108
109test "resolve DNS" {109test "resolve DNS" {
110 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
111 if (builtin.os.tag == .wasi) return error.SkipZigTest;110 if (builtin.os.tag == .wasi) return error.SkipZigTest;
112111
113 if (builtin.os.tag == .windows) {112 if (builtin.os.tag == .windows) {
lib/std/os/linux/io_uring.zig-2
...@@ -2268,8 +2268,6 @@ test "timeout (after a number of completions)" {...@@ -2268,8 +2268,6 @@ test "timeout (after a number of completions)" {
2268test "timeout_remove" {2268test "timeout_remove" {
2269 if (builtin.os.tag != .linux) return error.SkipZigTest;2269 if (builtin.os.tag != .linux) return error.SkipZigTest;
22702270
2271 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2272
2273 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {2271 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
2274 error.SystemOutdated => return error.SkipZigTest,2272 error.SystemOutdated => return error.SkipZigTest,
2275 error.PermissionDenied => return error.SkipZigTest,2273 error.PermissionDenied => return error.SkipZigTest,
lib/std/rand/Xoshiro256.zig+2-4
...@@ -90,10 +90,8 @@ pub fn fill(self: *Xoshiro256, buf: []u8) void {...@@ -90,10 +90,8 @@ pub fn fill(self: *Xoshiro256, buf: []u8) void {
90}90}
9191
92test "xoroshiro sequence" {92test "xoroshiro sequence" {
93 switch (@import("builtin").zig_backend) {93 if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
94 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,94 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
95 else => {},
96 }
9795
98 var r = Xoshiro256.init(0);96 var r = Xoshiro256.init(0);
9997
lib/std/zig/Parse.zig-2
...@@ -4102,7 +4102,5 @@ const TokenIndex = Ast.TokenIndex;...@@ -4102,7 +4102,5 @@ const TokenIndex = Ast.TokenIndex;
4102const Token = std.zig.Token;4102const Token = std.zig.Token;
41034103
4104test {4104test {
4105 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4106
4107 _ = @import("parser_test.zig");4105 _ = @import("parser_test.zig");
4108}4106}
lib/std/zig/parser_test.zig+320
...@@ -26,6 +26,8 @@ test "zig fmt: tuple struct" {...@@ -26,6 +26,8 @@ test "zig fmt: tuple struct" {
26}26}
2727
28test "zig fmt: preserves clobbers in inline asm with stray comma" {28test "zig fmt: preserves clobbers in inline asm with stray comma" {
29 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
30
29 try testCanonical(31 try testCanonical(
30 \\fn foo() void {32 \\fn foo() void {
31 \\ asm volatile (""33 \\ asm volatile (""
...@@ -44,6 +46,8 @@ test "zig fmt: preserves clobbers in inline asm with stray comma" {...@@ -44,6 +46,8 @@ test "zig fmt: preserves clobbers in inline asm with stray comma" {
44}46}
4547
46test "zig fmt: remove trailing comma at the end of assembly clobber" {48test "zig fmt: remove trailing comma at the end of assembly clobber" {
49 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
50
47 try testTransform(51 try testTransform(
48 \\fn foo() void {52 \\fn foo() void {
49 \\ asm volatile (""53 \\ asm volatile (""
...@@ -66,6 +70,8 @@ test "zig fmt: remove trailing comma at the end of assembly clobber" {...@@ -66,6 +70,8 @@ test "zig fmt: remove trailing comma at the end of assembly clobber" {
66}70}
6771
68test "zig fmt: respect line breaks in struct field value declaration" {72test "zig fmt: respect line breaks in struct field value declaration" {
73 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
74
69 try testCanonical(75 try testCanonical(
70 \\const Foo = struct {76 \\const Foo = struct {
71 \\ bar: u32 =77 \\ bar: u32 =
...@@ -220,6 +226,8 @@ test "zig fmt: file ends in comment after var decl" {...@@ -220,6 +226,8 @@ test "zig fmt: file ends in comment after var decl" {
220}226}
221227
222test "zig fmt: if statement" {228test "zig fmt: if statement" {
229 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
230
223 try testCanonical(231 try testCanonical(
224 \\test "" {232 \\test "" {
225 \\ if (optional()) |some|233 \\ if (optional()) |some|
...@@ -318,6 +326,8 @@ test "zig fmt: decl between fields" {...@@ -318,6 +326,8 @@ test "zig fmt: decl between fields" {
318}326}
319327
320test "zig fmt: errdefer with payload" {328test "zig fmt: errdefer with payload" {
329 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
330
321 try testCanonical(331 try testCanonical(
322 \\pub fn main() anyerror!void {332 \\pub fn main() anyerror!void {
323 \\ errdefer |a| x += 1;333 \\ errdefer |a| x += 1;
...@@ -331,6 +341,8 @@ test "zig fmt: errdefer with payload" {...@@ -331,6 +341,8 @@ test "zig fmt: errdefer with payload" {
331}341}
332342
333test "zig fmt: nosuspend block" {343test "zig fmt: nosuspend block" {
344 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
345
334 try testCanonical(346 try testCanonical(
335 \\pub fn main() anyerror!void {347 \\pub fn main() anyerror!void {
336 \\ nosuspend {348 \\ nosuspend {
...@@ -342,6 +354,8 @@ test "zig fmt: nosuspend block" {...@@ -342,6 +354,8 @@ test "zig fmt: nosuspend block" {
342}354}
343355
344test "zig fmt: nosuspend await" {356test "zig fmt: nosuspend await" {
357 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
358
345 try testCanonical(359 try testCanonical(
346 \\fn foo() void {360 \\fn foo() void {
347 \\ x = nosuspend await y;361 \\ x = nosuspend await y;
...@@ -362,6 +376,8 @@ test "zig fmt: container declaration, single line" {...@@ -362,6 +376,8 @@ test "zig fmt: container declaration, single line" {
362}376}
363377
364test "zig fmt: container declaration, one item, multi line trailing comma" {378test "zig fmt: container declaration, one item, multi line trailing comma" {
379 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
380
365 try testCanonical(381 try testCanonical(
366 \\test "" {382 \\test "" {
367 \\ comptime {383 \\ comptime {
...@@ -375,6 +391,8 @@ test "zig fmt: container declaration, one item, multi line trailing comma" {...@@ -375,6 +391,8 @@ test "zig fmt: container declaration, one item, multi line trailing comma" {
375}391}
376392
377test "zig fmt: container declaration, no trailing comma on separate line" {393test "zig fmt: container declaration, no trailing comma on separate line" {
394 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
395
378 try testTransform(396 try testTransform(
379 \\test "" {397 \\test "" {
380 \\ comptime {398 \\ comptime {
...@@ -501,6 +519,8 @@ test "zig fmt: remove empty lines at start/end of container decl" {...@@ -501,6 +519,8 @@ test "zig fmt: remove empty lines at start/end of container decl" {
501}519}
502520
503test "zig fmt: remove empty lines at start/end of block" {521test "zig fmt: remove empty lines at start/end of block" {
522 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
523
504 try testTransform(524 try testTransform(
505 \\test {525 \\test {
506 \\526 \\
...@@ -521,6 +541,8 @@ test "zig fmt: remove empty lines at start/end of block" {...@@ -521,6 +541,8 @@ test "zig fmt: remove empty lines at start/end of block" {
521}541}
522542
523test "zig fmt: allow empty line before comment at start of block" {543test "zig fmt: allow empty line before comment at start of block" {
544 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
545
524 try testCanonical(546 try testCanonical(
525 \\test {547 \\test {
526 \\548 \\
...@@ -584,6 +606,8 @@ test "zig fmt: comptime struct field" {...@@ -584,6 +606,8 @@ test "zig fmt: comptime struct field" {
584}606}
585607
586test "zig fmt: break from block" {608test "zig fmt: break from block" {
609 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
610
587 try testCanonical(611 try testCanonical(
588 \\const a = blk: {612 \\const a = blk: {
589 \\ break :blk 42;613 \\ break :blk 42;
...@@ -616,6 +640,8 @@ test "zig fmt: c pointer type" {...@@ -616,6 +640,8 @@ test "zig fmt: c pointer type" {
616}640}
617641
618test "zig fmt: builtin call with trailing comma" {642test "zig fmt: builtin call with trailing comma" {
643 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
644
619 try testCanonical(645 try testCanonical(
620 \\pub fn main() void {646 \\pub fn main() void {
621 \\ @breakpoint();647 \\ @breakpoint();
...@@ -631,6 +657,8 @@ test "zig fmt: builtin call with trailing comma" {...@@ -631,6 +657,8 @@ test "zig fmt: builtin call with trailing comma" {
631}657}
632658
633test "zig fmt: asm expression with comptime content" {659test "zig fmt: asm expression with comptime content" {
660 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
661
634 try testCanonical(662 try testCanonical(
635 \\comptime {663 \\comptime {
636 \\ asm ("foo" ++ "bar");664 \\ asm ("foo" ++ "bar");
...@@ -655,6 +683,8 @@ test "zig fmt: asm expression with comptime content" {...@@ -655,6 +683,8 @@ test "zig fmt: asm expression with comptime content" {
655}683}
656684
657test "zig fmt: array types last token" {685test "zig fmt: array types last token" {
686 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
687
658 try testCanonical(688 try testCanonical(
659 \\test {689 \\test {
660 \\ const x = [40]u32;690 \\ const x = [40]u32;
...@@ -668,6 +698,8 @@ test "zig fmt: array types last token" {...@@ -668,6 +698,8 @@ test "zig fmt: array types last token" {
668}698}
669699
670test "zig fmt: sentinel-terminated array type" {700test "zig fmt: sentinel-terminated array type" {
701 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
702
671 try testCanonical(703 try testCanonical(
672 \\pub fn cStrToPrefixedFileW(s: [*:0]const u8) ![PATH_MAX_WIDE:0]u16 {704 \\pub fn cStrToPrefixedFileW(s: [*:0]const u8) ![PATH_MAX_WIDE:0]u16 {
673 \\ return sliceToPrefixedFileW(mem.toSliceConst(u8, s));705 \\ return sliceToPrefixedFileW(mem.toSliceConst(u8, s));
...@@ -677,6 +709,8 @@ test "zig fmt: sentinel-terminated array type" {...@@ -677,6 +709,8 @@ test "zig fmt: sentinel-terminated array type" {
677}709}
678710
679test "zig fmt: sentinel-terminated slice type" {711test "zig fmt: sentinel-terminated slice type" {
712 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
713
680 try testCanonical(714 try testCanonical(
681 \\pub fn toSlice(self: Buffer) [:0]u8 {715 \\pub fn toSlice(self: Buffer) [:0]u8 {
682 \\ return self.list.toSlice()[0..self.len()];716 \\ return self.list.toSlice()[0..self.len()];
...@@ -748,6 +782,8 @@ test "zig fmt: anon literal in array" {...@@ -748,6 +782,8 @@ test "zig fmt: anon literal in array" {
748}782}
749783
750test "zig fmt: alignment in anonymous literal" {784test "zig fmt: alignment in anonymous literal" {
785 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
786
751 try testTransform(787 try testTransform(
752 \\const a = .{788 \\const a = .{
753 \\ "U", "L", "F",789 \\ "U", "L", "F",
...@@ -766,6 +802,8 @@ test "zig fmt: alignment in anonymous literal" {...@@ -766,6 +802,8 @@ test "zig fmt: alignment in anonymous literal" {
766}802}
767803
768test "zig fmt: anon struct literal 0 element" {804test "zig fmt: anon struct literal 0 element" {
805 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
806
769 try testCanonical(807 try testCanonical(
770 \\test {808 \\test {
771 \\ const x = .{};809 \\ const x = .{};
...@@ -775,6 +813,8 @@ test "zig fmt: anon struct literal 0 element" {...@@ -775,6 +813,8 @@ test "zig fmt: anon struct literal 0 element" {
775}813}
776814
777test "zig fmt: anon struct literal 1 element" {815test "zig fmt: anon struct literal 1 element" {
816 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
817
778 try testCanonical(818 try testCanonical(
779 \\test {819 \\test {
780 \\ const x = .{ .a = b };820 \\ const x = .{ .a = b };
...@@ -784,6 +824,8 @@ test "zig fmt: anon struct literal 1 element" {...@@ -784,6 +824,8 @@ test "zig fmt: anon struct literal 1 element" {
784}824}
785825
786test "zig fmt: anon struct literal 1 element comma" {826test "zig fmt: anon struct literal 1 element comma" {
827 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
828
787 try testCanonical(829 try testCanonical(
788 \\test {830 \\test {
789 \\ const x = .{831 \\ const x = .{
...@@ -795,6 +837,8 @@ test "zig fmt: anon struct literal 1 element comma" {...@@ -795,6 +837,8 @@ test "zig fmt: anon struct literal 1 element comma" {
795}837}
796838
797test "zig fmt: anon struct literal 2 element" {839test "zig fmt: anon struct literal 2 element" {
840 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
841
798 try testCanonical(842 try testCanonical(
799 \\test {843 \\test {
800 \\ const x = .{ .a = b, .c = d };844 \\ const x = .{ .a = b, .c = d };
...@@ -804,6 +848,8 @@ test "zig fmt: anon struct literal 2 element" {...@@ -804,6 +848,8 @@ test "zig fmt: anon struct literal 2 element" {
804}848}
805849
806test "zig fmt: anon struct literal 2 element comma" {850test "zig fmt: anon struct literal 2 element comma" {
851 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
852
807 try testCanonical(853 try testCanonical(
808 \\test {854 \\test {
809 \\ const x = .{855 \\ const x = .{
...@@ -816,6 +862,8 @@ test "zig fmt: anon struct literal 2 element comma" {...@@ -816,6 +862,8 @@ test "zig fmt: anon struct literal 2 element comma" {
816}862}
817863
818test "zig fmt: anon struct literal 3 element" {864test "zig fmt: anon struct literal 3 element" {
865 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
866
819 try testCanonical(867 try testCanonical(
820 \\test {868 \\test {
821 \\ const x = .{ .a = b, .c = d, .e = f };869 \\ const x = .{ .a = b, .c = d, .e = f };
...@@ -825,6 +873,8 @@ test "zig fmt: anon struct literal 3 element" {...@@ -825,6 +873,8 @@ test "zig fmt: anon struct literal 3 element" {
825}873}
826874
827test "zig fmt: anon struct literal 3 element comma" {875test "zig fmt: anon struct literal 3 element comma" {
876 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
877
828 try testCanonical(878 try testCanonical(
829 \\test {879 \\test {
830 \\ const x = .{880 \\ const x = .{
...@@ -838,6 +888,8 @@ test "zig fmt: anon struct literal 3 element comma" {...@@ -838,6 +888,8 @@ test "zig fmt: anon struct literal 3 element comma" {
838}888}
839889
840test "zig fmt: struct literal 0 element" {890test "zig fmt: struct literal 0 element" {
891 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
892
841 try testCanonical(893 try testCanonical(
842 \\test {894 \\test {
843 \\ const x = X{};895 \\ const x = X{};
...@@ -847,6 +899,8 @@ test "zig fmt: struct literal 0 element" {...@@ -847,6 +899,8 @@ test "zig fmt: struct literal 0 element" {
847}899}
848900
849test "zig fmt: struct literal 1 element" {901test "zig fmt: struct literal 1 element" {
902 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
903
850 try testCanonical(904 try testCanonical(
851 \\test {905 \\test {
852 \\ const x = X{ .a = b };906 \\ const x = X{ .a = b };
...@@ -856,6 +910,8 @@ test "zig fmt: struct literal 1 element" {...@@ -856,6 +910,8 @@ test "zig fmt: struct literal 1 element" {
856}910}
857911
858test "zig fmt: Unicode code point literal larger than u8" {912test "zig fmt: Unicode code point literal larger than u8" {
913 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
914
859 try testCanonical(915 try testCanonical(
860 \\test {916 \\test {
861 \\ const x = X{917 \\ const x = X{
...@@ -867,6 +923,8 @@ test "zig fmt: Unicode code point literal larger than u8" {...@@ -867,6 +923,8 @@ test "zig fmt: Unicode code point literal larger than u8" {
867}923}
868924
869test "zig fmt: struct literal 2 element" {925test "zig fmt: struct literal 2 element" {
926 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
927
870 try testCanonical(928 try testCanonical(
871 \\test {929 \\test {
872 \\ const x = X{ .a = b, .c = d };930 \\ const x = X{ .a = b, .c = d };
...@@ -876,6 +934,8 @@ test "zig fmt: struct literal 2 element" {...@@ -876,6 +934,8 @@ test "zig fmt: struct literal 2 element" {
876}934}
877935
878test "zig fmt: struct literal 2 element comma" {936test "zig fmt: struct literal 2 element comma" {
937 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
938
879 try testCanonical(939 try testCanonical(
880 \\test {940 \\test {
881 \\ const x = X{941 \\ const x = X{
...@@ -888,6 +948,8 @@ test "zig fmt: struct literal 2 element comma" {...@@ -888,6 +948,8 @@ test "zig fmt: struct literal 2 element comma" {
888}948}
889949
890test "zig fmt: struct literal 3 element" {950test "zig fmt: struct literal 3 element" {
951 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
952
891 try testCanonical(953 try testCanonical(
892 \\test {954 \\test {
893 \\ const x = X{ .a = b, .c = d, .e = f };955 \\ const x = X{ .a = b, .c = d, .e = f };
...@@ -897,6 +959,8 @@ test "zig fmt: struct literal 3 element" {...@@ -897,6 +959,8 @@ test "zig fmt: struct literal 3 element" {
897}959}
898960
899test "zig fmt: struct literal 3 element comma" {961test "zig fmt: struct literal 3 element comma" {
962 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
963
900 try testCanonical(964 try testCanonical(
901 \\test {965 \\test {
902 \\ const x = X{966 \\ const x = X{
...@@ -910,6 +974,8 @@ test "zig fmt: struct literal 3 element comma" {...@@ -910,6 +974,8 @@ test "zig fmt: struct literal 3 element comma" {
910}974}
911975
912test "zig fmt: anon list literal 1 element" {976test "zig fmt: anon list literal 1 element" {
977 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
978
913 try testCanonical(979 try testCanonical(
914 \\test {980 \\test {
915 \\ const x = .{a};981 \\ const x = .{a};
...@@ -930,6 +996,8 @@ test "zig fmt: anon list literal 1 element comma" {...@@ -930,6 +996,8 @@ test "zig fmt: anon list literal 1 element comma" {
930}996}
931997
932test "zig fmt: anon list literal 2 element" {998test "zig fmt: anon list literal 2 element" {
999 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1000
933 try testCanonical(1001 try testCanonical(
934 \\test {1002 \\test {
935 \\ const x = .{ a, b };1003 \\ const x = .{ a, b };
...@@ -951,6 +1019,8 @@ test "zig fmt: anon list literal 2 element comma" {...@@ -951,6 +1019,8 @@ test "zig fmt: anon list literal 2 element comma" {
951}1019}
9521020
953test "zig fmt: anon list literal 3 element" {1021test "zig fmt: anon list literal 3 element" {
1022 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1023
954 try testCanonical(1024 try testCanonical(
955 \\test {1025 \\test {
956 \\ const x = .{ a, b, c };1026 \\ const x = .{ a, b, c };
...@@ -975,6 +1045,8 @@ test "zig fmt: anon list literal 3 element comma" {...@@ -975,6 +1045,8 @@ test "zig fmt: anon list literal 3 element comma" {
975}1045}
9761046
977test "zig fmt: array literal 0 element" {1047test "zig fmt: array literal 0 element" {
1048 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1049
978 try testCanonical(1050 try testCanonical(
979 \\test {1051 \\test {
980 \\ const x = [_]u32{};1052 \\ const x = [_]u32{};
...@@ -984,6 +1056,8 @@ test "zig fmt: array literal 0 element" {...@@ -984,6 +1056,8 @@ test "zig fmt: array literal 0 element" {
984}1056}
9851057
986test "zig fmt: array literal 1 element" {1058test "zig fmt: array literal 1 element" {
1059 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1060
987 try testCanonical(1061 try testCanonical(
988 \\test {1062 \\test {
989 \\ const x = [_]u32{a};1063 \\ const x = [_]u32{a};
...@@ -1004,6 +1078,8 @@ test "zig fmt: array literal 1 element comma" {...@@ -1004,6 +1078,8 @@ test "zig fmt: array literal 1 element comma" {
1004}1078}
10051079
1006test "zig fmt: array literal 2 element" {1080test "zig fmt: array literal 2 element" {
1081 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1082
1007 try testCanonical(1083 try testCanonical(
1008 \\test {1084 \\test {
1009 \\ const x = [_]u32{ a, b };1085 \\ const x = [_]u32{ a, b };
...@@ -1025,6 +1101,8 @@ test "zig fmt: array literal 2 element comma" {...@@ -1025,6 +1101,8 @@ test "zig fmt: array literal 2 element comma" {
1025}1101}
10261102
1027test "zig fmt: array literal 3 element" {1103test "zig fmt: array literal 3 element" {
1104 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1105
1028 try testCanonical(1106 try testCanonical(
1029 \\test {1107 \\test {
1030 \\ const x = [_]u32{ a, b, c };1108 \\ const x = [_]u32{ a, b, c };
...@@ -1047,6 +1125,8 @@ test "zig fmt: array literal 3 element comma" {...@@ -1047,6 +1125,8 @@ test "zig fmt: array literal 3 element comma" {
1047}1125}
10481126
1049test "zig fmt: sentinel array literal 1 element" {1127test "zig fmt: sentinel array literal 1 element" {
1128 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1129
1050 try testCanonical(1130 try testCanonical(
1051 \\test {1131 \\test {
1052 \\ const x = [_:9000]u32{a};1132 \\ const x = [_:9000]u32{a};
...@@ -1076,6 +1156,8 @@ test "zig fmt: slices with spaces in bounds" {...@@ -1076,6 +1156,8 @@ test "zig fmt: slices with spaces in bounds" {
1076}1156}
10771157
1078test "zig fmt: block in slice expression" {1158test "zig fmt: block in slice expression" {
1159 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1160
1079 try testCanonical(1161 try testCanonical(
1080 \\const a = b[{1162 \\const a = b[{
1081 \\ _ = x;1163 \\ _ = x;
...@@ -1094,6 +1176,8 @@ test "zig fmt: block in slice expression" {...@@ -1094,6 +1176,8 @@ test "zig fmt: block in slice expression" {
1094}1176}
10951177
1096test "zig fmt: async function" {1178test "zig fmt: async function" {
1179 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1180
1097 try testCanonical(1181 try testCanonical(
1098 \\pub const Server = struct {1182 \\pub const Server = struct {
1099 \\ handleRequestFn: fn (*Server, *const std.net.Address, File) callconv(.Async) void,1183 \\ handleRequestFn: fn (*Server, *const std.net.Address, File) callconv(.Async) void,
...@@ -1106,6 +1190,8 @@ test "zig fmt: async function" {...@@ -1106,6 +1190,8 @@ test "zig fmt: async function" {
1106}1190}
11071191
1108test "zig fmt: whitespace fixes" {1192test "zig fmt: whitespace fixes" {
1193 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1194
1109 try testTransform("test \"\" {\r\n\tconst hi = x;\r\n}\n// zig fmt: off\ntest \"\"{\r\n\tconst a = b;}\r\n",1195 try testTransform("test \"\" {\r\n\tconst hi = x;\r\n}\n// zig fmt: off\ntest \"\"{\r\n\tconst a = b;}\r\n",
1110 \\test "" {1196 \\test "" {
1111 \\ const hi = x;1197 \\ const hi = x;
...@@ -1118,6 +1204,8 @@ test "zig fmt: whitespace fixes" {...@@ -1118,6 +1204,8 @@ test "zig fmt: whitespace fixes" {
1118}1204}
11191205
1120test "zig fmt: while else err prong with no block" {1206test "zig fmt: while else err prong with no block" {
1207 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1208
1121 try testCanonical(1209 try testCanonical(
1122 \\test "" {1210 \\test "" {
1123 \\ const result = while (returnError()) |value| {1211 \\ const result = while (returnError()) |value| {
...@@ -1147,6 +1235,8 @@ test "zig fmt: tagged union with enum values" {...@@ -1147,6 +1235,8 @@ test "zig fmt: tagged union with enum values" {
1147}1235}
11481236
1149test "zig fmt: tagged union enum tag last token" {1237test "zig fmt: tagged union enum tag last token" {
1238 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1239
1150 try testCanonical(1240 try testCanonical(
1151 \\test {1241 \\test {
1152 \\ const U = union(enum(u32)) {};1242 \\ const U = union(enum(u32)) {};
...@@ -1482,6 +1572,8 @@ test "zig fmt: doc and line comment following 'zig fmt: on'" {...@@ -1482,6 +1572,8 @@ test "zig fmt: doc and line comment following 'zig fmt: on'" {
1482}1572}
14831573
1484test "zig fmt: 'zig fmt: (off|on)' works in the middle of code" {1574test "zig fmt: 'zig fmt: (off|on)' works in the middle of code" {
1575 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1576
1485 try testTransform(1577 try testTransform(
1486 \\test "" {1578 \\test "" {
1487 \\ const x = 42;1579 \\ const x = 42;
...@@ -1508,6 +1600,8 @@ test "zig fmt: 'zig fmt: (off|on)' works in the middle of code" {...@@ -1508,6 +1600,8 @@ test "zig fmt: 'zig fmt: (off|on)' works in the middle of code" {
1508}1600}
15091601
1510test "zig fmt: 'zig fmt: on' indentation is unchanged" {1602test "zig fmt: 'zig fmt: on' indentation is unchanged" {
1603 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1604
1511 try testCanonical(1605 try testCanonical(
1512 \\fn initOptionsAndLayouts(output: *Output, context: *Context) !void {1606 \\fn initOptionsAndLayouts(output: *Output, context: *Context) !void {
1513 \\ // zig fmt: off1607 \\ // zig fmt: off
...@@ -1550,6 +1644,8 @@ test "zig fmt: spaces around slice operator" {...@@ -1550,6 +1644,8 @@ test "zig fmt: spaces around slice operator" {
1550}1644}
15511645
1552test "zig fmt: async call in if condition" {1646test "zig fmt: async call in if condition" {
1647 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1648
1553 try testCanonical(1649 try testCanonical(
1554 \\comptime {1650 \\comptime {
1555 \\ if (async b()) {1651 \\ if (async b()) {
...@@ -1561,6 +1657,8 @@ test "zig fmt: async call in if condition" {...@@ -1561,6 +1657,8 @@ test "zig fmt: async call in if condition" {
1561}1657}
15621658
1563test "zig fmt: 2nd arg multiline string" {1659test "zig fmt: 2nd arg multiline string" {
1660 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1661
1564 try testCanonical(1662 try testCanonical(
1565 \\comptime {1663 \\comptime {
1566 \\ cases.addAsm("hello world linux x86_64",1664 \\ cases.addAsm("hello world linux x86_64",
...@@ -1589,6 +1687,8 @@ test "zig fmt: 2nd arg multiline string" {...@@ -1589,6 +1687,8 @@ test "zig fmt: 2nd arg multiline string" {
1589}1687}
15901688
1591test "zig fmt: 2nd arg multiline string many args" {1689test "zig fmt: 2nd arg multiline string many args" {
1690 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1691
1592 try testCanonical(1692 try testCanonical(
1593 \\comptime {1693 \\comptime {
1594 \\ cases.addAsm("hello world linux x86_64",1694 \\ cases.addAsm("hello world linux x86_64",
...@@ -1600,6 +1700,8 @@ test "zig fmt: 2nd arg multiline string many args" {...@@ -1600,6 +1700,8 @@ test "zig fmt: 2nd arg multiline string many args" {
1600}1700}
16011701
1602test "zig fmt: final arg multiline string" {1702test "zig fmt: final arg multiline string" {
1703 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1704
1603 try testCanonical(1705 try testCanonical(
1604 \\comptime {1706 \\comptime {
1605 \\ cases.addAsm("hello world linux x86_64", "Hello, world!\n",1707 \\ cases.addAsm("hello world linux x86_64", "Hello, world!\n",
...@@ -1611,6 +1713,8 @@ test "zig fmt: final arg multiline string" {...@@ -1611,6 +1713,8 @@ test "zig fmt: final arg multiline string" {
1611}1713}
16121714
1613test "zig fmt: if condition wraps" {1715test "zig fmt: if condition wraps" {
1716 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1717
1614 try testTransform(1718 try testTransform(
1615 \\comptime {1719 \\comptime {
1616 \\ if (cond and1720 \\ if (cond and
...@@ -1692,6 +1796,8 @@ test "zig fmt: if condition wraps" {...@@ -1692,6 +1796,8 @@ test "zig fmt: if condition wraps" {
1692}1796}
16931797
1694test "zig fmt: if condition has line break but must not wrap" {1798test "zig fmt: if condition has line break but must not wrap" {
1799 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1800
1695 try testCanonical(1801 try testCanonical(
1696 \\comptime {1802 \\comptime {
1697 \\ if (self.user_input_options.put(1803 \\ if (self.user_input_options.put(
...@@ -1716,6 +1822,8 @@ test "zig fmt: if condition has line break but must not wrap" {...@@ -1716,6 +1822,8 @@ test "zig fmt: if condition has line break but must not wrap" {
1716}1822}
17171823
1718test "zig fmt: if condition has line break but must not wrap (no fn call comma)" {1824test "zig fmt: if condition has line break but must not wrap (no fn call comma)" {
1825 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1826
1719 try testCanonical(1827 try testCanonical(
1720 \\comptime {1828 \\comptime {
1721 \\ if (self.user_input_options.put(name, UserInputOption{1829 \\ if (self.user_input_options.put(name, UserInputOption{
...@@ -1737,6 +1845,8 @@ test "zig fmt: if condition has line break but must not wrap (no fn call comma)"...@@ -1737,6 +1845,8 @@ test "zig fmt: if condition has line break but must not wrap (no fn call comma)"
1737}1845}
17381846
1739test "zig fmt: function call with multiline argument" {1847test "zig fmt: function call with multiline argument" {
1848 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1849
1740 try testCanonical(1850 try testCanonical(
1741 \\comptime {1851 \\comptime {
1742 \\ self.user_input_options.put(name, UserInputOption{1852 \\ self.user_input_options.put(name, UserInputOption{
...@@ -1749,6 +1859,8 @@ test "zig fmt: function call with multiline argument" {...@@ -1749,6 +1859,8 @@ test "zig fmt: function call with multiline argument" {
1749}1859}
17501860
1751test "zig fmt: if-else with comment before else" {1861test "zig fmt: if-else with comment before else" {
1862 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1863
1752 try testCanonical(1864 try testCanonical(
1753 \\comptime {1865 \\comptime {
1754 \\ // cexp(finite|nan +- i inf|nan) = nan + i nan1866 \\ // cexp(finite|nan +- i inf|nan) = nan + i nan
...@@ -1767,6 +1879,8 @@ test "zig fmt: if-else with comment before else" {...@@ -1767,6 +1879,8 @@ test "zig fmt: if-else with comment before else" {
1767}1879}
17681880
1769test "zig fmt: if nested" {1881test "zig fmt: if nested" {
1882 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1883
1770 try testCanonical(1884 try testCanonical(
1771 \\pub fn foo() void {1885 \\pub fn foo() void {
1772 \\ return if ((aInt & bInt) >= 0)1886 \\ return if ((aInt & bInt) >= 0)
...@@ -1790,6 +1904,8 @@ test "zig fmt: if nested" {...@@ -1790,6 +1904,8 @@ test "zig fmt: if nested" {
1790}1904}
17911905
1792test "zig fmt: respect line breaks in if-else" {1906test "zig fmt: respect line breaks in if-else" {
1907 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1908
1793 try testCanonical(1909 try testCanonical(
1794 \\comptime {1910 \\comptime {
1795 \\ return if (cond) a else b;1911 \\ return if (cond) a else b;
...@@ -1809,6 +1925,8 @@ test "zig fmt: respect line breaks in if-else" {...@@ -1809,6 +1925,8 @@ test "zig fmt: respect line breaks in if-else" {
1809}1925}
18101926
1811test "zig fmt: respect line breaks after infix operators" {1927test "zig fmt: respect line breaks after infix operators" {
1928 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1929
1812 try testCanonical(1930 try testCanonical(
1813 \\comptime {1931 \\comptime {
1814 \\ self.crc =1932 \\ self.crc =
...@@ -1872,6 +1990,8 @@ test "zig fmt: switch comment after prong" {...@@ -1872,6 +1990,8 @@ test "zig fmt: switch comment after prong" {
1872}1990}
18731991
1874test "zig fmt: struct literal no trailing comma" {1992test "zig fmt: struct literal no trailing comma" {
1993 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1994
1875 try testTransform(1995 try testTransform(
1876 \\const a = foo{ .x = 1, .y = 2 };1996 \\const a = foo{ .x = 1, .y = 2 };
1877 \\const a = foo{ .x = 1,1997 \\const a = foo{ .x = 1,
...@@ -1890,6 +2010,8 @@ test "zig fmt: struct literal no trailing comma" {...@@ -1890,6 +2010,8 @@ test "zig fmt: struct literal no trailing comma" {
1890}2010}
18912011
1892test "zig fmt: struct literal containing a multiline expression" {2012test "zig fmt: struct literal containing a multiline expression" {
2013 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2014
1893 try testTransform(2015 try testTransform(
1894 \\const a = A{ .x = if (f1()) 10 else 20 };2016 \\const a = A{ .x = if (f1()) 10 else 20 };
1895 \\const a = A{ .x = if (f1()) 10 else 20, };2017 \\const a = A{ .x = if (f1()) 10 else 20, };
...@@ -1951,6 +2073,8 @@ test "zig fmt: struct literal containing a multiline expression" {...@@ -1951,6 +2073,8 @@ test "zig fmt: struct literal containing a multiline expression" {
1951}2073}
19522074
1953test "zig fmt: array literal with hint" {2075test "zig fmt: array literal with hint" {
2076 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2077
1954 try testTransform(2078 try testTransform(
1955 \\const a = []u8{2079 \\const a = []u8{
1956 \\ 1, 2, //2080 \\ 1, 2, //
...@@ -2028,6 +2152,8 @@ test "zig fmt: array literal with hint" {...@@ -2028,6 +2152,8 @@ test "zig fmt: array literal with hint" {
2028}2152}
20292153
2030test "zig fmt: array literal vertical column alignment" {2154test "zig fmt: array literal vertical column alignment" {
2155 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2156
2031 try testTransform(2157 try testTransform(
2032 \\const a = []u8{2158 \\const a = []u8{
2033 \\ 1000, 200,2159 \\ 1000, 200,
...@@ -2075,6 +2201,8 @@ test "zig fmt: array literal vertical column alignment" {...@@ -2075,6 +2201,8 @@ test "zig fmt: array literal vertical column alignment" {
2075}2201}
20762202
2077test "zig fmt: multiline string with backslash at end of line" {2203test "zig fmt: multiline string with backslash at end of line" {
2204 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2205
2078 try testCanonical(2206 try testCanonical(
2079 \\comptime {2207 \\comptime {
2080 \\ err(2208 \\ err(
...@@ -2086,6 +2214,8 @@ test "zig fmt: multiline string with backslash at end of line" {...@@ -2086,6 +2214,8 @@ test "zig fmt: multiline string with backslash at end of line" {
2086}2214}
20872215
2088test "zig fmt: multiline string parameter in fn call with trailing comma" {2216test "zig fmt: multiline string parameter in fn call with trailing comma" {
2217 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2218
2089 try testCanonical(2219 try testCanonical(
2090 \\fn foo() void {2220 \\fn foo() void {
2091 \\ try stdout.print(2221 \\ try stdout.print(
...@@ -2104,6 +2234,8 @@ test "zig fmt: multiline string parameter in fn call with trailing comma" {...@@ -2104,6 +2234,8 @@ test "zig fmt: multiline string parameter in fn call with trailing comma" {
2104}2234}
21052235
2106test "zig fmt: trailing comma on fn call" {2236test "zig fmt: trailing comma on fn call" {
2237 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2238
2107 try testCanonical(2239 try testCanonical(
2108 \\comptime {2240 \\comptime {
2109 \\ var module = try Module.create(2241 \\ var module = try Module.create(
...@@ -2117,6 +2249,8 @@ test "zig fmt: trailing comma on fn call" {...@@ -2117,6 +2249,8 @@ test "zig fmt: trailing comma on fn call" {
2117}2249}
21182250
2119test "zig fmt: multi line arguments without last comma" {2251test "zig fmt: multi line arguments without last comma" {
2252 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2253
2120 try testTransform(2254 try testTransform(
2121 \\pub fn foo(2255 \\pub fn foo(
2122 \\ a: usize,2256 \\ a: usize,
...@@ -2178,6 +2312,8 @@ test "zig fmt: extra newlines at the end" {...@@ -2178,6 +2312,8 @@ test "zig fmt: extra newlines at the end" {
2178}2312}
21792313
2180test "zig fmt: simple asm" {2314test "zig fmt: simple asm" {
2315 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2316
2181 try testTransform(2317 try testTransform(
2182 \\comptime {2318 \\comptime {
2183 \\ asm volatile (2319 \\ asm volatile (
...@@ -2215,6 +2351,8 @@ test "zig fmt: simple asm" {...@@ -2215,6 +2351,8 @@ test "zig fmt: simple asm" {
2215}2351}
22162352
2217test "zig fmt: nested struct literal with one item" {2353test "zig fmt: nested struct literal with one item" {
2354 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2355
2218 try testCanonical(2356 try testCanonical(
2219 \\const a = foo{2357 \\const a = foo{
2220 \\ .item = bar{ .a = b },2358 \\ .item = bar{ .a = b },
...@@ -2258,6 +2396,8 @@ test "zig fmt: slice align" {...@@ -2258,6 +2396,8 @@ test "zig fmt: slice align" {
2258}2396}
22592397
2260test "zig fmt: add trailing comma to array literal" {2398test "zig fmt: add trailing comma to array literal" {
2399 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2400
2261 try testTransform(2401 try testTransform(
2262 \\comptime {2402 \\comptime {
2263 \\ return []u16{'m', 's', 'y', 's', '-' // hi2403 \\ return []u16{'m', 's', 'y', 's', '-' // hi
...@@ -2299,6 +2439,8 @@ test "zig fmt: line comment after doc comment" {...@@ -2299,6 +2439,8 @@ test "zig fmt: line comment after doc comment" {
2299}2439}
23002440
2301test "zig fmt: bit field alignment" {2441test "zig fmt: bit field alignment" {
2442 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2443
2302 try testCanonical(2444 try testCanonical(
2303 \\test {2445 \\test {
2304 \\ assert(@TypeOf(&blah.b) == *align(1:3:6) const u3);2446 \\ assert(@TypeOf(&blah.b) == *align(1:3:6) const u3);
...@@ -2330,6 +2472,8 @@ test "zig fmt: float literal with exponent" {...@@ -2330,6 +2472,8 @@ test "zig fmt: float literal with exponent" {
2330}2472}
23312473
2332test "zig fmt: if-else end of comptime" {2474test "zig fmt: if-else end of comptime" {
2475 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2476
2333 try testCanonical(2477 try testCanonical(
2334 \\comptime {2478 \\comptime {
2335 \\ if (a) {2479 \\ if (a) {
...@@ -2343,6 +2487,8 @@ test "zig fmt: if-else end of comptime" {...@@ -2343,6 +2487,8 @@ test "zig fmt: if-else end of comptime" {
2343}2487}
23442488
2345test "zig fmt: nested blocks" {2489test "zig fmt: nested blocks" {
2490 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2491
2346 try testCanonical(2492 try testCanonical(
2347 \\comptime {2493 \\comptime {
2348 \\ {2494 \\ {
...@@ -2358,6 +2504,8 @@ test "zig fmt: nested blocks" {...@@ -2358,6 +2504,8 @@ test "zig fmt: nested blocks" {
2358}2504}
23592505
2360test "zig fmt: block with same line comment after end brace" {2506test "zig fmt: block with same line comment after end brace" {
2507 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2508
2361 try testCanonical(2509 try testCanonical(
2362 \\comptime {2510 \\comptime {
2363 \\ {2511 \\ {
...@@ -2369,6 +2517,8 @@ test "zig fmt: block with same line comment after end brace" {...@@ -2369,6 +2517,8 @@ test "zig fmt: block with same line comment after end brace" {
2369}2517}
23702518
2371test "zig fmt: statements with comment between" {2519test "zig fmt: statements with comment between" {
2520 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2521
2372 try testCanonical(2522 try testCanonical(
2373 \\comptime {2523 \\comptime {
2374 \\ a = b;2524 \\ a = b;
...@@ -2380,6 +2530,8 @@ test "zig fmt: statements with comment between" {...@@ -2380,6 +2530,8 @@ test "zig fmt: statements with comment between" {
2380}2530}
23812531
2382test "zig fmt: statements with empty line between" {2532test "zig fmt: statements with empty line between" {
2533 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2534
2383 try testCanonical(2535 try testCanonical(
2384 \\comptime {2536 \\comptime {
2385 \\ a = b;2537 \\ a = b;
...@@ -2399,6 +2551,8 @@ test "zig fmt: ptr deref operator and unwrap optional operator" {...@@ -2399,6 +2551,8 @@ test "zig fmt: ptr deref operator and unwrap optional operator" {
2399}2551}
24002552
2401test "zig fmt: comment after if before another if" {2553test "zig fmt: comment after if before another if" {
2554 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2555
2402 try testCanonical(2556 try testCanonical(
2403 \\test "aoeu" {2557 \\test "aoeu" {
2404 \\ // comment2558 \\ // comment
...@@ -2421,6 +2575,8 @@ test "zig fmt: comment after if before another if" {...@@ -2421,6 +2575,8 @@ test "zig fmt: comment after if before another if" {
2421}2575}
24222576
2423test "zig fmt: line comment between if block and else keyword" {2577test "zig fmt: line comment between if block and else keyword" {
2578 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2579
2424 try testCanonical(2580 try testCanonical(
2425 \\test "aoeu" {2581 \\test "aoeu" {
2426 \\ // cexp(finite|nan +- i inf|nan) = nan + i nan2582 \\ // cexp(finite|nan +- i inf|nan) = nan + i nan
...@@ -2442,6 +2598,8 @@ test "zig fmt: line comment between if block and else keyword" {...@@ -2442,6 +2598,8 @@ test "zig fmt: line comment between if block and else keyword" {
2442}2598}
24432599
2444test "zig fmt: same line comments in expression" {2600test "zig fmt: same line comments in expression" {
2601 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2602
2445 try testCanonical(2603 try testCanonical(
2446 \\test "aoeu" {2604 \\test "aoeu" {
2447 \\ const x = ( // a2605 \\ const x = ( // a
...@@ -2482,6 +2640,8 @@ test "zig fmt: add comma on last switch prong" {...@@ -2482,6 +2640,8 @@ test "zig fmt: add comma on last switch prong" {
2482}2640}
24832641
2484test "zig fmt: same-line comment after a statement" {2642test "zig fmt: same-line comment after a statement" {
2643 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2644
2485 try testCanonical(2645 try testCanonical(
2486 \\test "" {2646 \\test "" {
2487 \\ a = b;2647 \\ a = b;
...@@ -2527,6 +2687,8 @@ test "zig fmt: same-line comment after switch prong" {...@@ -2527,6 +2687,8 @@ test "zig fmt: same-line comment after switch prong" {
2527}2687}
25282688
2529test "zig fmt: same-line comment after non-block if expression" {2689test "zig fmt: same-line comment after non-block if expression" {
2690 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2691
2530 try testCanonical(2692 try testCanonical(
2531 \\comptime {2693 \\comptime {
2532 \\ if (sr > n_uword_bits - 1) // d > r2694 \\ if (sr > n_uword_bits - 1) // d > r
...@@ -2537,6 +2699,8 @@ test "zig fmt: same-line comment after non-block if expression" {...@@ -2537,6 +2699,8 @@ test "zig fmt: same-line comment after non-block if expression" {
2537}2699}
25382700
2539test "zig fmt: same-line comment on comptime expression" {2701test "zig fmt: same-line comment on comptime expression" {
2702 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2703
2540 try testCanonical(2704 try testCanonical(
2541 \\test "" {2705 \\test "" {
2542 \\ comptime assert(@typeInfo(T) == .Int); // must pass an integer to absInt2706 \\ comptime assert(@typeInfo(T) == .Int); // must pass an integer to absInt
...@@ -2546,6 +2710,8 @@ test "zig fmt: same-line comment on comptime expression" {...@@ -2546,6 +2710,8 @@ test "zig fmt: same-line comment on comptime expression" {
2546}2710}
25472711
2548test "zig fmt: switch with empty body" {2712test "zig fmt: switch with empty body" {
2713 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2714
2549 try testCanonical(2715 try testCanonical(
2550 \\test "" {2716 \\test "" {
2551 \\ foo() catch |err| switch (err) {};2717 \\ foo() catch |err| switch (err) {};
...@@ -2555,6 +2721,8 @@ test "zig fmt: switch with empty body" {...@@ -2555,6 +2721,8 @@ test "zig fmt: switch with empty body" {
2555}2721}
25562722
2557test "zig fmt: line comments in struct initializer" {2723test "zig fmt: line comments in struct initializer" {
2724 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2725
2558 try testCanonical(2726 try testCanonical(
2559 \\fn foo() void {2727 \\fn foo() void {
2560 \\ return Self{2728 \\ return Self{
...@@ -2577,6 +2745,8 @@ test "zig fmt: line comments in struct initializer" {...@@ -2577,6 +2745,8 @@ test "zig fmt: line comments in struct initializer" {
2577}2745}
25782746
2579test "zig fmt: first line comment in struct initializer" {2747test "zig fmt: first line comment in struct initializer" {
2748 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2749
2580 try testCanonical(2750 try testCanonical(
2581 \\pub fn acquire(self: *Self) HeldLock {2751 \\pub fn acquire(self: *Self) HeldLock {
2582 \\ return HeldLock{2752 \\ return HeldLock{
...@@ -2645,6 +2815,8 @@ test "zig fmt: union(enum(u32)) with assigned enum values" {...@@ -2645,6 +2815,8 @@ test "zig fmt: union(enum(u32)) with assigned enum values" {
2645}2815}
26462816
2647test "zig fmt: resume from suspend block" {2817test "zig fmt: resume from suspend block" {
2818 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2819
2648 try testCanonical(2820 try testCanonical(
2649 \\fn foo() void {2821 \\fn foo() void {
2650 \\ suspend {2822 \\ suspend {
...@@ -2730,6 +2902,8 @@ test "zig fmt: comments before global variables" {...@@ -2730,6 +2902,8 @@ test "zig fmt: comments before global variables" {
2730}2902}
27312903
2732test "zig fmt: comments in statements" {2904test "zig fmt: comments in statements" {
2905 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2906
2733 try testCanonical(2907 try testCanonical(
2734 \\test "std" {2908 \\test "std" {
2735 \\ // statement comment2909 \\ // statement comment
...@@ -2757,6 +2931,8 @@ test "zig fmt: comments before test decl" {...@@ -2757,6 +2931,8 @@ test "zig fmt: comments before test decl" {
2757}2931}
27582932
2759test "zig fmt: preserve spacing" {2933test "zig fmt: preserve spacing" {
2934 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2935
2760 try testCanonical(2936 try testCanonical(
2761 \\const std = @import("std");2937 \\const std = @import("std");
2762 \\2938 \\
...@@ -2825,6 +3001,8 @@ test "zig fmt: alignment" {...@@ -2825,6 +3001,8 @@ test "zig fmt: alignment" {
2825}3001}
28263002
2827test "zig fmt: C main" {3003test "zig fmt: C main" {
3004 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3005
2828 try testCanonical(3006 try testCanonical(
2829 \\fn main(argc: c_int, argv: **u8) c_int {3007 \\fn main(argc: c_int, argv: **u8) c_int {
2830 \\ const a = b;3008 \\ const a = b;
...@@ -2834,6 +3012,8 @@ test "zig fmt: C main" {...@@ -2834,6 +3012,8 @@ test "zig fmt: C main" {
2834}3012}
28353013
2836test "zig fmt: return" {3014test "zig fmt: return" {
3015 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3016
2837 try testCanonical(3017 try testCanonical(
2838 \\fn foo(argc: c_int, argv: **u8) c_int {3018 \\fn foo(argc: c_int, argv: **u8) c_int {
2839 \\ return 0;3019 \\ return 0;
...@@ -2896,6 +3076,8 @@ test "zig fmt: slice attributes" {...@@ -2896,6 +3076,8 @@ test "zig fmt: slice attributes" {
2896}3076}
28973077
2898test "zig fmt: test declaration" {3078test "zig fmt: test declaration" {
3079 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3080
2899 try testCanonical(3081 try testCanonical(
2900 \\test "test name" {3082 \\test "test name" {
2901 \\ const a = 1;3083 \\ const a = 1;
...@@ -2906,6 +3088,8 @@ test "zig fmt: test declaration" {...@@ -2906,6 +3088,8 @@ test "zig fmt: test declaration" {
2906}3088}
29073089
2908test "zig fmt: infix operators" {3090test "zig fmt: infix operators" {
3091 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3092
2909 try testCanonical(3093 try testCanonical(
2910 \\test {3094 \\test {
2911 \\ var i = undefined;3095 \\ var i = undefined;
...@@ -2958,6 +3142,8 @@ test "zig fmt: infix operators" {...@@ -2958,6 +3142,8 @@ test "zig fmt: infix operators" {
2958}3142}
29593143
2960test "zig fmt: precedence" {3144test "zig fmt: precedence" {
3145 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3146
2961 try testCanonical(3147 try testCanonical(
2962 \\test "precedence" {3148 \\test "precedence" {
2963 \\ a!b();3149 \\ a!b();
...@@ -2990,6 +3176,8 @@ test "zig fmt: precedence" {...@@ -2990,6 +3176,8 @@ test "zig fmt: precedence" {
2990}3176}
29913177
2992test "zig fmt: prefix operators" {3178test "zig fmt: prefix operators" {
3179 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3180
2993 try testCanonical(3181 try testCanonical(
2994 \\test "prefix operators" {3182 \\test "prefix operators" {
2995 \\ try return --%~!&0;3183 \\ try return --%~!&0;
...@@ -2999,6 +3187,8 @@ test "zig fmt: prefix operators" {...@@ -2999,6 +3187,8 @@ test "zig fmt: prefix operators" {
2999}3187}
30003188
3001test "zig fmt: call expression" {3189test "zig fmt: call expression" {
3190 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3191
3002 try testCanonical(3192 try testCanonical(
3003 \\test "test calls" {3193 \\test "test calls" {
3004 \\ a();3194 \\ a();
...@@ -3018,6 +3208,8 @@ test "zig fmt: anytype type" {...@@ -3018,6 +3208,8 @@ test "zig fmt: anytype type" {
3018}3208}
30193209
3020test "zig fmt: functions" {3210test "zig fmt: functions" {
3211 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3212
3021 try testCanonical(3213 try testCanonical(
3022 \\extern fn puts(s: *const u8) c_int;3214 \\extern fn puts(s: *const u8) c_int;
3023 \\extern "c" fn puts(s: *const u8) c_int;3215 \\extern "c" fn puts(s: *const u8) c_int;
...@@ -3042,6 +3234,8 @@ test "zig fmt: functions" {...@@ -3042,6 +3234,8 @@ test "zig fmt: functions" {
3042}3234}
30433235
3044test "zig fmt: multiline string" {3236test "zig fmt: multiline string" {
3237 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3238
3045 try testCanonical(3239 try testCanonical(
3046 \\test "" {3240 \\test "" {
3047 \\ const s1 =3241 \\ const s1 =
...@@ -3060,6 +3254,8 @@ test "zig fmt: multiline string" {...@@ -3060,6 +3254,8 @@ test "zig fmt: multiline string" {
3060}3254}
30613255
3062test "zig fmt: values" {3256test "zig fmt: values" {
3257 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3258
3063 try testCanonical(3259 try testCanonical(
3064 \\test "values" {3260 \\test "values" {
3065 \\ 1;3261 \\ 1;
...@@ -3079,6 +3275,8 @@ test "zig fmt: values" {...@@ -3079,6 +3275,8 @@ test "zig fmt: values" {
3079}3275}
30803276
3081test "zig fmt: indexing" {3277test "zig fmt: indexing" {
3278 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3279
3082 try testCanonical(3280 try testCanonical(
3083 \\test "test index" {3281 \\test "test index" {
3084 \\ a[0];3282 \\ a[0];
...@@ -3099,6 +3297,8 @@ test "zig fmt: indexing" {...@@ -3099,6 +3297,8 @@ test "zig fmt: indexing" {
3099}3297}
31003298
3101test "zig fmt: struct declaration" {3299test "zig fmt: struct declaration" {
3300 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3301
3102 try testCanonical(3302 try testCanonical(
3103 \\const S = struct {3303 \\const S = struct {
3104 \\ const Self = @This();3304 \\ const Self = @This();
...@@ -3205,6 +3405,8 @@ test "zig fmt: union declaration" {...@@ -3205,6 +3405,8 @@ test "zig fmt: union declaration" {
3205}3405}
32063406
3207test "zig fmt: arrays" {3407test "zig fmt: arrays" {
3408 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3409
3208 try testCanonical(3410 try testCanonical(
3209 \\test "test array" {3411 \\test "test array" {
3210 \\ const a: [2]u8 = [2]u8{3412 \\ const a: [2]u8 = [2]u8{
...@@ -3223,6 +3425,8 @@ test "zig fmt: arrays" {...@@ -3223,6 +3425,8 @@ test "zig fmt: arrays" {
3223}3425}
32243426
3225test "zig fmt: container initializers" {3427test "zig fmt: container initializers" {
3428 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3429
3226 try testCanonical(3430 try testCanonical(
3227 \\const a0 = []u8{};3431 \\const a0 = []u8{};
3228 \\const a1 = []u8{1};3432 \\const a1 = []u8{1};
...@@ -3243,6 +3447,8 @@ test "zig fmt: container initializers" {...@@ -3243,6 +3447,8 @@ test "zig fmt: container initializers" {
3243}3447}
32443448
3245test "zig fmt: catch" {3449test "zig fmt: catch" {
3450 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3451
3246 try testCanonical(3452 try testCanonical(
3247 \\test "catch" {3453 \\test "catch" {
3248 \\ const a: anyerror!u8 = 0;3454 \\ const a: anyerror!u8 = 0;
...@@ -3258,6 +3464,8 @@ test "zig fmt: catch" {...@@ -3258,6 +3464,8 @@ test "zig fmt: catch" {
3258}3464}
32593465
3260test "zig fmt: blocks" {3466test "zig fmt: blocks" {
3467 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3468
3261 try testCanonical(3469 try testCanonical(
3262 \\test "blocks" {3470 \\test "blocks" {
3263 \\ {3471 \\ {
...@@ -3280,6 +3488,8 @@ test "zig fmt: blocks" {...@@ -3280,6 +3488,8 @@ test "zig fmt: blocks" {
3280}3488}
32813489
3282test "zig fmt: switch" {3490test "zig fmt: switch" {
3491 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3492
3283 try testCanonical(3493 try testCanonical(
3284 \\test "switch" {3494 \\test "switch" {
3285 \\ switch (0) {3495 \\ switch (0) {
...@@ -3335,6 +3545,8 @@ test "zig fmt: switch" {...@@ -3335,6 +3545,8 @@ test "zig fmt: switch" {
3335}3545}
33363546
3337test "zig fmt: switch multiline string" {3547test "zig fmt: switch multiline string" {
3548 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3549
3338 try testCanonical(3550 try testCanonical(
3339 \\test "switch multiline string" {3551 \\test "switch multiline string" {
3340 \\ const x: u32 = 0;3552 \\ const x: u32 = 0;
...@@ -3366,6 +3578,8 @@ test "zig fmt: switch multiline string" {...@@ -3366,6 +3578,8 @@ test "zig fmt: switch multiline string" {
3366}3578}
33673579
3368test "zig fmt: while" {3580test "zig fmt: while" {
3581 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3582
3369 try testCanonical(3583 try testCanonical(
3370 \\test "while" {3584 \\test "while" {
3371 \\ while (10 < 1) unreachable;3585 \\ while (10 < 1) unreachable;
...@@ -3441,6 +3655,8 @@ test "zig fmt: while" {...@@ -3441,6 +3655,8 @@ test "zig fmt: while" {
3441}3655}
34423656
3443test "zig fmt: for" {3657test "zig fmt: for" {
3658 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3659
3444 try testCanonical(3660 try testCanonical(
3445 \\test "for" {3661 \\test "for" {
3446 \\ for (a) |v| {3662 \\ for (a) |v| {
...@@ -3542,6 +3758,8 @@ test "zig fmt: for" {...@@ -3542,6 +3758,8 @@ test "zig fmt: for" {
3542}3758}
35433759
3544test "zig fmt: for if" {3760test "zig fmt: for if" {
3761 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3762
3545 try testCanonical(3763 try testCanonical(
3546 \\test {3764 \\test {
3547 \\ for (a) |x| if (x) f(x);3765 \\ for (a) |x| if (x) f(x);
...@@ -3567,6 +3785,8 @@ test "zig fmt: for if" {...@@ -3567,6 +3785,8 @@ test "zig fmt: for if" {
3567}3785}
35683786
3569test "zig fmt: if for" {3787test "zig fmt: if for" {
3788 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3789
3570 try testCanonical(3790 try testCanonical(
3571 \\test {3791 \\test {
3572 \\ if (a) for (x) |x| f(x);3792 \\ if (a) for (x) |x| f(x);
...@@ -3592,6 +3812,8 @@ test "zig fmt: if for" {...@@ -3592,6 +3812,8 @@ test "zig fmt: if for" {
3592}3812}
35933813
3594test "zig fmt: while if" {3814test "zig fmt: while if" {
3815 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3816
3595 try testCanonical(3817 try testCanonical(
3596 \\test {3818 \\test {
3597 \\ while (a) if (x) f(x);3819 \\ while (a) if (x) f(x);
...@@ -3617,6 +3839,8 @@ test "zig fmt: while if" {...@@ -3617,6 +3839,8 @@ test "zig fmt: while if" {
3617}3839}
36183840
3619test "zig fmt: if while" {3841test "zig fmt: if while" {
3842 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3843
3620 try testCanonical(3844 try testCanonical(
3621 \\test {3845 \\test {
3622 \\ if (a) while (x) : (cont) f(x);3846 \\ if (a) while (x) : (cont) f(x);
...@@ -3642,6 +3866,8 @@ test "zig fmt: if while" {...@@ -3642,6 +3866,8 @@ test "zig fmt: if while" {
3642}3866}
36433867
3644test "zig fmt: while for" {3868test "zig fmt: while for" {
3869 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3870
3645 try testCanonical(3871 try testCanonical(
3646 \\test {3872 \\test {
3647 \\ while (a) for (x) |x| f(x);3873 \\ while (a) for (x) |x| f(x);
...@@ -3667,6 +3893,8 @@ test "zig fmt: while for" {...@@ -3667,6 +3893,8 @@ test "zig fmt: while for" {
3667}3893}
36683894
3669test "zig fmt: for while" {3895test "zig fmt: for while" {
3896 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3897
3670 try testCanonical(3898 try testCanonical(
3671 \\test {3899 \\test {
3672 \\ for (a) |a| while (x) |x| f(x);3900 \\ for (a) |a| while (x) |x| f(x);
...@@ -3692,6 +3920,8 @@ test "zig fmt: for while" {...@@ -3692,6 +3920,8 @@ test "zig fmt: for while" {
3692}3920}
36933921
3694test "zig fmt: if" {3922test "zig fmt: if" {
3923 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3924
3695 try testCanonical(3925 try testCanonical(
3696 \\test "if" {3926 \\test "if" {
3697 \\ if (10 < 0) {3927 \\ if (10 < 0) {
...@@ -3741,6 +3971,8 @@ test "zig fmt: if" {...@@ -3741,6 +3971,8 @@ test "zig fmt: if" {
3741}3971}
37423972
3743test "zig fmt: fix single statement if/for/while line breaks" {3973test "zig fmt: fix single statement if/for/while line breaks" {
3974 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3975
3744 try testTransform(3976 try testTransform(
3745 \\test {3977 \\test {
3746 \\ if (cond) a3978 \\ if (cond) a
...@@ -3793,6 +4025,8 @@ test "zig fmt: fix single statement if/for/while line breaks" {...@@ -3793,6 +4025,8 @@ test "zig fmt: fix single statement if/for/while line breaks" {
3793}4025}
37944026
3795test "zig fmt: anon struct/array literal in if" {4027test "zig fmt: anon struct/array literal in if" {
4028 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4029
3796 try testCanonical(4030 try testCanonical(
3797 \\test {4031 \\test {
3798 \\ const a = if (cond) .{4032 \\ const a = if (cond) .{
...@@ -3817,6 +4051,8 @@ test "zig fmt: anon struct/array literal in if" {...@@ -3817,6 +4051,8 @@ test "zig fmt: anon struct/array literal in if" {
3817}4051}
38184052
3819test "zig fmt: defer" {4053test "zig fmt: defer" {
4054 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4055
3820 try testCanonical(4056 try testCanonical(
3821 \\test "defer" {4057 \\test "defer" {
3822 \\ var i: usize = 0;4058 \\ var i: usize = 0;
...@@ -3837,6 +4073,8 @@ test "zig fmt: defer" {...@@ -3837,6 +4073,8 @@ test "zig fmt: defer" {
3837}4073}
38384074
3839test "zig fmt: comptime" {4075test "zig fmt: comptime" {
4076 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4077
3840 try testCanonical(4078 try testCanonical(
3841 \\fn a() u8 {4079 \\fn a() u8 {
3842 \\ return 5;4080 \\ return 5;
...@@ -3876,6 +4114,8 @@ test "zig fmt: comptime" {...@@ -3876,6 +4114,8 @@ test "zig fmt: comptime" {
3876}4114}
38774115
3878test "zig fmt: fn type" {4116test "zig fmt: fn type" {
4117 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4118
3879 try testCanonical(4119 try testCanonical(
3880 \\fn a(i: u8) u8 {4120 \\fn a(i: u8) u8 {
3881 \\ return i + 1;4121 \\ return i + 1;
...@@ -3889,6 +4129,8 @@ test "zig fmt: fn type" {...@@ -3889,6 +4129,8 @@ test "zig fmt: fn type" {
3889}4129}
38904130
3891test "zig fmt: inline asm" {4131test "zig fmt: inline asm" {
4132 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4133
3892 try testCanonical(4134 try testCanonical(
3893 \\pub fn syscall1(number: usize, arg1: usize) usize {4135 \\pub fn syscall1(number: usize, arg1: usize) usize {
3894 \\ return asm volatile ("syscall"4136 \\ return asm volatile ("syscall"
...@@ -3903,6 +4145,8 @@ test "zig fmt: inline asm" {...@@ -3903,6 +4145,8 @@ test "zig fmt: inline asm" {
3903}4145}
39044146
3905test "zig fmt: async functions" {4147test "zig fmt: async functions" {
4148 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4149
3906 try testCanonical(4150 try testCanonical(
3907 \\fn simpleAsyncFn() void {4151 \\fn simpleAsyncFn() void {
3908 \\ const a = async a.b();4152 \\ const a = async a.b();
...@@ -3931,6 +4175,8 @@ test "zig fmt: nosuspend" {...@@ -3931,6 +4175,8 @@ test "zig fmt: nosuspend" {
3931}4175}
39324176
3933test "zig fmt: Block after if" {4177test "zig fmt: Block after if" {
4178 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4179
3934 try testCanonical(4180 try testCanonical(
3935 \\test {4181 \\test {
3936 \\ if (true) {4182 \\ if (true) {
...@@ -3962,6 +4208,8 @@ test "zig fmt: string identifier" {...@@ -3962,6 +4208,8 @@ test "zig fmt: string identifier" {
3962}4208}
39634209
3964test "zig fmt: error return" {4210test "zig fmt: error return" {
4211 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4212
3965 try testCanonical(4213 try testCanonical(
3966 \\fn err() anyerror {4214 \\fn err() anyerror {
3967 \\ call();4215 \\ call();
...@@ -3972,6 +4220,8 @@ test "zig fmt: error return" {...@@ -3972,6 +4220,8 @@ test "zig fmt: error return" {
3972}4220}
39734221
3974test "zig fmt: comptime block in container" {4222test "zig fmt: comptime block in container" {
4223 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4224
3975 try testCanonical(4225 try testCanonical(
3976 \\pub fn container() type {4226 \\pub fn container() type {
3977 \\ return struct {4227 \\ return struct {
...@@ -3987,6 +4237,8 @@ test "zig fmt: comptime block in container" {...@@ -3987,6 +4237,8 @@ test "zig fmt: comptime block in container" {
3987}4237}
39884238
3989test "zig fmt: inline asm parameter alignment" {4239test "zig fmt: inline asm parameter alignment" {
4240 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4241
3990 try testCanonical(4242 try testCanonical(
3991 \\pub fn main() void {4243 \\pub fn main() void {
3992 \\ asm volatile (4244 \\ asm volatile (
...@@ -4025,6 +4277,8 @@ test "zig fmt: inline asm parameter alignment" {...@@ -4025,6 +4277,8 @@ test "zig fmt: inline asm parameter alignment" {
4025}4277}
40264278
4027test "zig fmt: multiline string in array" {4279test "zig fmt: multiline string in array" {
4280 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4281
4028 try testCanonical(4282 try testCanonical(
4029 \\const Foo = [][]const u8{4283 \\const Foo = [][]const u8{
4030 \\ \\aaa4284 \\ \\aaa
...@@ -4050,6 +4304,8 @@ test "zig fmt: multiline string in array" {...@@ -4050,6 +4304,8 @@ test "zig fmt: multiline string in array" {
4050}4304}
40514305
4052test "zig fmt: if type expr" {4306test "zig fmt: if type expr" {
4307 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4308
4053 try testCanonical(4309 try testCanonical(
4054 \\const mycond = true;4310 \\const mycond = true;
4055 \\pub fn foo() if (mycond) i32 else void {4311 \\pub fn foo() if (mycond) i32 else void {
...@@ -4078,6 +4334,8 @@ test "zig fmt: comment after empty comment" {...@@ -4078,6 +4334,8 @@ test "zig fmt: comment after empty comment" {
4078}4334}
40794335
4080test "zig fmt: line comment in array" {4336test "zig fmt: line comment in array" {
4337 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4338
4081 try testTransform(4339 try testTransform(
4082 \\test "a" {4340 \\test "a" {
4083 \\ var arr = [_]u32{4341 \\ var arr = [_]u32{
...@@ -4136,6 +4394,8 @@ test "zig fmt: comment after params" {...@@ -4136,6 +4394,8 @@ test "zig fmt: comment after params" {
4136}4394}
41374395
4138test "zig fmt: comment in array initializer/access" {4396test "zig fmt: comment in array initializer/access" {
4397 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4398
4139 try testCanonical(4399 try testCanonical(
4140 \\test "a" {4400 \\test "a" {
4141 \\ var a = x{ //aa4401 \\ var a = x{ //aa
...@@ -4172,6 +4432,8 @@ test "zig fmt: comment in array initializer/access" {...@@ -4172,6 +4432,8 @@ test "zig fmt: comment in array initializer/access" {
4172}4432}
41734433
4174test "zig fmt: comments at several places in struct init" {4434test "zig fmt: comments at several places in struct init" {
4435 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4436
4175 try testTransform(4437 try testTransform(
4176 \\var bar = Bar{4438 \\var bar = Bar{
4177 \\ .x = 10, // test4439 \\ .x = 10, // test
...@@ -4395,6 +4657,8 @@ test "zig fmt: integer literals with underscore separators" {...@@ -4395,6 +4657,8 @@ test "zig fmt: integer literals with underscore separators" {
4395}4657}
43964658
4397test "zig fmt: hex literals with underscore separators" {4659test "zig fmt: hex literals with underscore separators" {
4660 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4661
4398 try testTransform(4662 try testTransform(
4399 \\pub fn orMask(a: [ 1_000 ]u64, b: [ 1_000] u64) [1_000]u64 {4663 \\pub fn orMask(a: [ 1_000 ]u64, b: [ 1_000] u64) [1_000]u64 {
4400 \\ var c: [1_000]u64 = [1]u64{ 0xFFFF_FFFF_FFFF_FFFF}**1_000;4664 \\ var c: [1_000]u64 = [1]u64{ 0xFFFF_FFFF_FFFF_FFFF}**1_000;
...@@ -4418,6 +4682,8 @@ test "zig fmt: hex literals with underscore separators" {...@@ -4418,6 +4682,8 @@ test "zig fmt: hex literals with underscore separators" {
4418}4682}
44194683
4420test "zig fmt: decimal float literals with underscore separators" {4684test "zig fmt: decimal float literals with underscore separators" {
4685 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4686
4421 try testTransform(4687 try testTransform(
4422 \\pub fn main() void {4688 \\pub fn main() void {
4423 \\ const a:f64=(10.0e-0+(10.0e+0))+10_00.00_00e-2+20_00.00_10e+4;4689 \\ const a:f64=(10.0e-0+(10.0e+0))+10_00.00_00e-2+20_00.00_10e+4;
...@@ -4435,6 +4701,8 @@ test "zig fmt: decimal float literals with underscore separators" {...@@ -4435,6 +4701,8 @@ test "zig fmt: decimal float literals with underscore separators" {
4435}4701}
44364702
4437test "zig fmt: hexadeciaml float literals with underscore separators" {4703test "zig fmt: hexadeciaml float literals with underscore separators" {
4704 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4705
4438 try testTransform(4706 try testTransform(
4439 \\pub fn main() void {4707 \\pub fn main() void {
4440 \\ const a: f64 = (0x10.0p-0+(0x10.0p+0))+0x10_00.00_00p-8+0x00_00.00_10p+16;4708 \\ const a: f64 = (0x10.0p-0+(0x10.0p+0))+0x10_00.00_00p-8+0x00_00.00_10p+16;
...@@ -4459,6 +4727,8 @@ test "zig fmt: C var args" {...@@ -4459,6 +4727,8 @@ test "zig fmt: C var args" {
4459}4727}
44604728
4461test "zig fmt: Only indent multiline string literals in function calls" {4729test "zig fmt: Only indent multiline string literals in function calls" {
4730 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4731
4462 try testCanonical(4732 try testCanonical(
4463 \\test "zig fmt:" {4733 \\test "zig fmt:" {
4464 \\ try testTransform(4734 \\ try testTransform(
...@@ -4476,6 +4746,8 @@ test "zig fmt: Only indent multiline string literals in function calls" {...@@ -4476,6 +4746,8 @@ test "zig fmt: Only indent multiline string literals in function calls" {
4476}4746}
44774747
4478test "zig fmt: Don't add extra newline after if" {4748test "zig fmt: Don't add extra newline after if" {
4749 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4750
4479 try testCanonical(4751 try testCanonical(
4480 \\pub fn atomicSymLink(allocator: Allocator, existing_path: []const u8, new_path: []const u8) !void {4752 \\pub fn atomicSymLink(allocator: Allocator, existing_path: []const u8, new_path: []const u8) !void {
4481 \\ if (cwd().symLink(existing_path, new_path, .{})) {4753 \\ if (cwd().symLink(existing_path, new_path, .{})) {
...@@ -4487,6 +4759,8 @@ test "zig fmt: Don't add extra newline after if" {...@@ -4487,6 +4759,8 @@ test "zig fmt: Don't add extra newline after if" {
4487}4759}
44884760
4489test "zig fmt: comments in ternary ifs" {4761test "zig fmt: comments in ternary ifs" {
4762 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4763
4490 try testCanonical(4764 try testCanonical(
4491 \\const x = if (true) {4765 \\const x = if (true) {
4492 \\ 1;4766 \\ 1;
...@@ -4506,6 +4780,8 @@ test "zig fmt: comments in ternary ifs" {...@@ -4506,6 +4780,8 @@ test "zig fmt: comments in ternary ifs" {
4506}4780}
45074781
4508test "zig fmt: while statement in blockless if" {4782test "zig fmt: while statement in blockless if" {
4783 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4784
4509 try testCanonical(4785 try testCanonical(
4510 \\pub fn main() void {4786 \\pub fn main() void {
4511 \\ const zoom_node = if (focused_node == layout_first)4787 \\ const zoom_node = if (focused_node == layout_first)
...@@ -4555,6 +4831,8 @@ test "zig fmt: test comments in field access chain" {...@@ -4555,6 +4831,8 @@ test "zig fmt: test comments in field access chain" {
4555}4831}
45564832
4557test "zig fmt: allow line break before field access" {4833test "zig fmt: allow line break before field access" {
4834 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4835
4558 try testCanonical(4836 try testCanonical(
4559 \\test {4837 \\test {
4560 \\ const w = foo.bar().zippy(zag).iguessthisisok();4838 \\ const w = foo.bar().zippy(zag).iguessthisisok();
...@@ -4603,6 +4881,8 @@ test "zig fmt: allow line break before field access" {...@@ -4603,6 +4881,8 @@ test "zig fmt: allow line break before field access" {
4603}4881}
46044882
4605test "zig fmt: Indent comma correctly after multiline string literals in arg list (trailing comma)" {4883test "zig fmt: Indent comma correctly after multiline string literals in arg list (trailing comma)" {
4884 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4885
4606 try testCanonical(4886 try testCanonical(
4607 \\fn foo() void {4887 \\fn foo() void {
4608 \\ z.display_message_dialog(4888 \\ z.display_message_dialog(
...@@ -4628,6 +4908,8 @@ test "zig fmt: Indent comma correctly after multiline string literals in arg lis...@@ -4628,6 +4908,8 @@ test "zig fmt: Indent comma correctly after multiline string literals in arg lis
4628}4908}
46294909
4630test "zig fmt: Control flow statement as body of blockless if" {4910test "zig fmt: Control flow statement as body of blockless if" {
4911 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4912
4631 try testCanonical(4913 try testCanonical(
4632 \\pub fn main() void {4914 \\pub fn main() void {
4633 \\ const zoom_node = if (focused_node == layout_first)4915 \\ const zoom_node = if (focused_node == layout_first)
...@@ -4663,6 +4945,8 @@ test "zig fmt: Control flow statement as body of blockless if" {...@@ -4663,6 +4945,8 @@ test "zig fmt: Control flow statement as body of blockless if" {
4663}4945}
46644946
4665test "zig fmt: regression test for #5722" {4947test "zig fmt: regression test for #5722" {
4948 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4949
4666 try testCanonical(4950 try testCanonical(
4667 \\pub fn sendViewTags(self: Self) void {4951 \\pub fn sendViewTags(self: Self) void {
4668 \\ var it = ViewStack(View).iterator(self.output.views.first, std.math.maxInt(u32));4952 \\ var it = ViewStack(View).iterator(self.output.views.first, std.math.maxInt(u32));
...@@ -4685,6 +4969,8 @@ test "zig fmt: regression test for #8974" {...@@ -4685,6 +4969,8 @@ test "zig fmt: regression test for #8974" {
4685}4969}
46864970
4687test "zig fmt: allow trailing line comments to do manual array formatting" {4971test "zig fmt: allow trailing line comments to do manual array formatting" {
4972 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4973
4688 try testCanonical(4974 try testCanonical(
4689 \\fn foo() void {4975 \\fn foo() void {
4690 \\ self.code.appendSliceAssumeCapacity(&[_]u8{4976 \\ self.code.appendSliceAssumeCapacity(&[_]u8{
...@@ -4723,6 +5009,8 @@ test "zig fmt: allow trailing line comments to do manual array formatting" {...@@ -4723,6 +5009,8 @@ test "zig fmt: allow trailing line comments to do manual array formatting" {
4723}5009}
47245010
4725test "zig fmt: multiline string literals should play nice with array initializers" {5011test "zig fmt: multiline string literals should play nice with array initializers" {
5012 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5013
4726 try testCanonical(5014 try testCanonical(
4727 \\fn main() void {5015 \\fn main() void {
4728 \\ var a = .{.{.{.{.{.{.{.{5016 \\ var a = .{.{.{.{.{.{.{.{
...@@ -4789,6 +5077,8 @@ test "zig fmt: multiline string literals should play nice with array initializer...@@ -4789,6 +5077,8 @@ test "zig fmt: multiline string literals should play nice with array initializer
4789}5077}
47905078
4791test "zig fmt: use of comments and multiline string literals may force the parameters over multiple lines" {5079test "zig fmt: use of comments and multiline string literals may force the parameters over multiple lines" {
5080 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5081
4792 try testCanonical(5082 try testCanonical(
4793 \\pub fn makeMemUndefined(qzz: []u8) i1 {5083 \\pub fn makeMemUndefined(qzz: []u8) i1 {
4794 \\ cases.add( // fixed bug foo5084 \\ cases.add( // fixed bug foo
...@@ -4829,6 +5119,8 @@ test "zig fmt: use of comments and multiline string literals may force the param...@@ -4829,6 +5119,8 @@ test "zig fmt: use of comments and multiline string literals may force the param
4829}5119}
48305120
4831test "zig fmt: single argument trailing commas in @builtins()" {5121test "zig fmt: single argument trailing commas in @builtins()" {
5122 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5123
4832 try testCanonical(5124 try testCanonical(
4833 \\pub fn foo(qzz: []u8) i1 {5125 \\pub fn foo(qzz: []u8) i1 {
4834 \\ @panic(5126 \\ @panic(
...@@ -4862,6 +5154,8 @@ test "zig fmt: trailing comma should force multiline 1 column" {...@@ -4862,6 +5154,8 @@ test "zig fmt: trailing comma should force multiline 1 column" {
4862}5154}
48635155
4864test "zig fmt: function params should align nicely" {5156test "zig fmt: function params should align nicely" {
5157 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5158
4865 try testCanonical(5159 try testCanonical(
4866 \\pub fn foo() void {5160 \\pub fn foo() void {
4867 \\ cases.addRuntimeSafety("slicing operator with sentinel",5161 \\ cases.addRuntimeSafety("slicing operator with sentinel",
...@@ -4918,6 +5212,8 @@ test "zig fmt: remove trailing whitespace after doc comment" {...@@ -4918,6 +5212,8 @@ test "zig fmt: remove trailing whitespace after doc comment" {
4918}5212}
49195213
4920test "zig fmt: for loop with ptr payload and index" {5214test "zig fmt: for loop with ptr payload and index" {
5215 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5216
4921 try testCanonical(5217 try testCanonical(
4922 \\test {5218 \\test {
4923 \\ for (self.entries.items, 0..) |*item, i| {}5219 \\ for (self.entries.items, 0..) |*item, i| {}
...@@ -4930,6 +5226,8 @@ test "zig fmt: for loop with ptr payload and index" {...@@ -4930,6 +5226,8 @@ test "zig fmt: for loop with ptr payload and index" {
4930}5226}
49315227
4932test "zig fmt: proper indent line comment after multi-line single expr while loop" {5228test "zig fmt: proper indent line comment after multi-line single expr while loop" {
5229 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5230
4933 try testCanonical(5231 try testCanonical(
4934 \\test {5232 \\test {
4935 \\ while (a) : (b)5233 \\ while (a) : (b)
...@@ -4943,6 +5241,8 @@ test "zig fmt: proper indent line comment after multi-line single expr while loo...@@ -4943,6 +5241,8 @@ test "zig fmt: proper indent line comment after multi-line single expr while loo
4943}5241}
49445242
4945test "zig fmt: function with labeled block as return type" {5243test "zig fmt: function with labeled block as return type" {
5244 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5245
4946 try testCanonical(5246 try testCanonical(
4947 \\fn foo() t: {5247 \\fn foo() t: {
4948 \\ break :t bar;5248 \\ break :t bar;
...@@ -4965,6 +5265,8 @@ test "zig fmt: extern function with missing param name" {...@@ -4965,6 +5265,8 @@ test "zig fmt: extern function with missing param name" {
4965}5265}
49665266
4967test "zig fmt: line comment after multiline single expr if statement with multiline string" {5267test "zig fmt: line comment after multiline single expr if statement with multiline string" {
5268 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5269
4968 try testCanonical(5270 try testCanonical(
4969 \\test {5271 \\test {
4970 \\ if (foo)5272 \\ if (foo)
...@@ -4997,6 +5299,8 @@ test "zig fmt: line comment after multiline single expr if statement with multil...@@ -4997,6 +5299,8 @@ test "zig fmt: line comment after multiline single expr if statement with multil
4997}5299}
49985300
4999test "zig fmt: respect extra newline between fn and pub usingnamespace" {5301test "zig fmt: respect extra newline between fn and pub usingnamespace" {
5302 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5303
5000 try testCanonical(5304 try testCanonical(
5001 \\fn foo() void {5305 \\fn foo() void {
5002 \\ bar();5306 \\ bar();
...@@ -5121,6 +5425,8 @@ test "zig fmt: insert trailing comma if comments in array init" {...@@ -5121,6 +5425,8 @@ test "zig fmt: insert trailing comma if comments in array init" {
5121}5425}
51225426
5123test "zig fmt: make single-line if no trailing comma" {5427test "zig fmt: make single-line if no trailing comma" {
5428 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5429
5124 try testTransform(5430 try testTransform(
5125 \\test "function call no trailing comma" {5431 \\test "function call no trailing comma" {
5126 \\ foo(5432 \\ foo(
...@@ -5300,6 +5606,8 @@ test "zig fmt: missing const/var before local variable" {...@@ -5300,6 +5606,8 @@ test "zig fmt: missing const/var before local variable" {
5300}5606}
53015607
5302test "zig fmt: while continue expr" {5608test "zig fmt: while continue expr" {
5609 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5610
5303 try testCanonical(5611 try testCanonical(
5304 \\test {5612 \\test {
5305 \\ while (i > 0)5613 \\ while (i > 0)
...@@ -5319,6 +5627,8 @@ test "zig fmt: while continue expr" {...@@ -5319,6 +5627,8 @@ test "zig fmt: while continue expr" {
5319}5627}
53205628
5321test "zig fmt: canonicalize symbols (simple)" {5629test "zig fmt: canonicalize symbols (simple)" {
5630 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5631
5322 try testTransform(5632 try testTransform(
5323 \\const val_normal: Normal = .{};5633 \\const val_normal: Normal = .{};
5324 \\const @"val_unesc_me": @"UnescMe" = .{};5634 \\const @"val_unesc_me": @"UnescMe" = .{};
...@@ -5468,6 +5778,8 @@ test "zig fmt: canonicalize symbols (simple)" {...@@ -5468,6 +5778,8 @@ test "zig fmt: canonicalize symbols (simple)" {
54685778
5469// Contextually unescape when shadowing primitive types and values.5779// Contextually unescape when shadowing primitive types and values.
5470test "zig fmt: canonicalize symbols (primitive types)" {5780test "zig fmt: canonicalize symbols (primitive types)" {
5781 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5782
5471 try testTransform(5783 try testTransform(
5472 \\const @"anyopaque" = struct {5784 \\const @"anyopaque" = struct {
5473 \\ @"u8": @"type" = true,5785 \\ @"u8": @"type" = true,
...@@ -5577,6 +5889,8 @@ test "zig fmt: canonicalize symbols (primitive types)" {...@@ -5577,6 +5889,8 @@ test "zig fmt: canonicalize symbols (primitive types)" {
55775889
5578// Never unescape names spelled like keywords.5890// Never unescape names spelled like keywords.
5579test "zig fmt: canonicalize symbols (keywords)" {5891test "zig fmt: canonicalize symbols (keywords)" {
5892 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5893
5580 try testCanonical(5894 try testCanonical(
5581 \\const @"enum" = struct {5895 \\const @"enum" = struct {
5582 \\ @"error": @"struct" = true,5896 \\ @"error": @"struct" = true,
...@@ -5604,6 +5918,8 @@ test "zig fmt: canonicalize symbols (keywords)" {...@@ -5604,6 +5918,8 @@ test "zig fmt: canonicalize symbols (keywords)" {
5604}5918}
56055919
5606test "zig fmt: no space before newline before multiline string" {5920test "zig fmt: no space before newline before multiline string" {
5921 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5922
5607 try testCanonical(5923 try testCanonical(
5608 \\const S = struct {5924 \\const S = struct {
5609 \\ text: []const u8,5925 \\ text: []const u8,
...@@ -5634,6 +5950,8 @@ test "zig fmt: no space before newline before multiline string" {...@@ -5634,6 +5950,8 @@ test "zig fmt: no space before newline before multiline string" {
56345950
5635// Normalize \xNN and \u{NN} escapes and unicode inside @"" escapes.5951// Normalize \xNN and \u{NN} escapes and unicode inside @"" escapes.
5636test "zig fmt: canonicalize symbols (character escapes)" {5952test "zig fmt: canonicalize symbols (character escapes)" {
5953 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5954
5637 try testTransform(5955 try testTransform(
5638 \\const @"\x46\x6f\x6f\x64" = struct {5956 \\const @"\x46\x6f\x6f\x64" = struct {
5639 \\ @"\x62\x61\x72\x6E": @"\x43\x72\x61\x62" = false,5957 \\ @"\x62\x61\x72\x6E": @"\x43\x72\x61\x62" = false,
...@@ -5676,6 +5994,8 @@ test "zig fmt: canonicalize symbols (character escapes)" {...@@ -5676,6 +5994,8 @@ test "zig fmt: canonicalize symbols (character escapes)" {
5676}5994}
56775995
5678test "zig fmt: canonicalize symbols (asm)" {5996test "zig fmt: canonicalize symbols (asm)" {
5997 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
5998
5679 try testTransform(5999 try testTransform(
5680 \\test "asm" {6000 \\test "asm" {
5681 \\ const @"null" = usize;6001 \\ const @"null" = usize;
src/arch/x86_64/CodeGen.zig+8-4
...@@ -2293,7 +2293,11 @@ fn genLazy(self: *Self, lazy_sym: link.File.LazySymbol) InnerError!void {...@@ -2293,7 +2293,11 @@ fn genLazy(self: *Self, lazy_sym: link.File.LazySymbol) InnerError!void {
2293 }2293 }
2294}2294}
22952295
2296fn getValue(self: *Self, value: MCValue, inst: ?Air.Inst.Index) void {2296fn getValue(self: *Self, value: MCValue, inst: ?Air.Inst.Index) !void {
2297 for (value.getRegs()) |reg| try self.register_manager.getReg(reg, inst);
2298}
2299
2300fn getValueIfFree(self: *Self, value: MCValue, inst: ?Air.Inst.Index) void {
2297 for (value.getRegs()) |reg| if (self.register_manager.isRegFree(reg))2301 for (value.getRegs()) |reg| if (self.register_manager.isRegFree(reg))
2298 self.register_manager.getRegAssumeFree(reg, inst);2302 self.register_manager.getRegAssumeFree(reg, inst);
2299}2303}
...@@ -2341,7 +2345,7 @@ fn finishAirResult(self: *Self, inst: Air.Inst.Index, result: MCValue) void {...@@ -2341,7 +2345,7 @@ fn finishAirResult(self: *Self, inst: Air.Inst.Index, result: MCValue) void {
2341 // In some cases, an operand may be reused as the result.2345 // In some cases, an operand may be reused as the result.
2342 // If that operand died and was a register, it was freed by2346 // If that operand died and was a register, it was freed by
2343 // processDeath, so we have to "re-allocate" the register.2347 // processDeath, so we have to "re-allocate" the register.
2344 self.getValue(result, inst);2348 self.getValueIfFree(result, inst);
2345 }2349 }
2346 self.finishAirBookkeeping();2350 self.finishAirBookkeeping();
2347}2351}
...@@ -11017,7 +11021,7 @@ fn airBlock(self: *Self, inst: Air.Inst.Index) !void {...@@ -11017,7 +11021,7 @@ fn airBlock(self: *Self, inst: Air.Inst.Index) !void {
11017 if (std.debug.runtime_safety) assert(self.inst_tracking.getIndex(inst).? == inst_tracking_i);11021 if (std.debug.runtime_safety) assert(self.inst_tracking.getIndex(inst).? == inst_tracking_i);
11018 const tracking = &self.inst_tracking.values()[inst_tracking_i];11022 const tracking = &self.inst_tracking.values()[inst_tracking_i];
11019 if (self.liveness.isUnused(inst)) try tracking.die(self, inst);11023 if (self.liveness.isUnused(inst)) try tracking.die(self, inst);
11020 self.getValue(tracking.short, inst);11024 self.getValueIfFree(tracking.short, inst);
11021 self.finishAirBookkeeping();11025 self.finishAirBookkeeping();
11022}11026}
1102311027
...@@ -11131,7 +11135,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) !void {...@@ -11131,7 +11135,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) !void {
11131 }11135 }
1113211136
11133 const dst_mcv = if (first_br) try self.allocRegOrMem(br.block_inst, true) else dst: {11137 const dst_mcv = if (first_br) try self.allocRegOrMem(br.block_inst, true) else dst: {
11134 self.getValue(block_tracking.short, br.block_inst);11138 try self.getValue(block_tracking.short, br.block_inst);
11135 break :dst block_tracking.short;11139 break :dst block_tracking.short;
11136 };11140 };
11137 try self.genCopy(block_ty, dst_mcv, src_mcv);11141 try self.genCopy(block_ty, dst_mcv, src_mcv);