authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2020-01-09 01:56:38-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-09 13:36:44-05:00
log834218d789430ac238e5ef4fa99cfe4bcf006f2d
tree6a43ac11524812625dba225dde6a091bcf2b0b2d
parentd7333d8798a929312ceb897007e7bb6a8b2999ee

Fix remaining variadic formatted prints

Used a series of regex searches to try to find as many instances of the old pattern as I could and update them.

23 files changed, 76 insertions(+), 83 deletions(-)

lib/std/crypto/benchmark.zig+6-6
......@@ -125,9 +125,9 @@ fn mode(comptime x: comptime_int) comptime_int {
125125fn printPad(stdout: var, s: []const u8) !void {
126126 var i: usize = 0;
127127 while (i < 12 - s.len) : (i += 1) {
128 try stdout.print(" ");
128 try stdout.print(" ", .{});
129129 }
130 try stdout.print("{}", s);
130 try stdout.print("{}", .{s});
131131}
132132
133133pub fn main() !void {
......@@ -142,7 +142,7 @@ pub fn main() !void {
142142 var i: usize = 1;
143143 while (i < args.len) : (i += 1) {
144144 if (std.mem.eql(u8, args[i], "--mode")) {
145 try stdout.print("{}\n", builtin.mode);
145 try stdout.print("{}\n", .{builtin.mode});
146146 return;
147147 } else if (std.mem.eql(u8, args[i], "--seed")) {
148148 i += 1;
......@@ -174,7 +174,7 @@ pub fn main() !void {
174174 if (filter == null or std.mem.indexOf(u8, H.name, filter.?) != null) {
175175 const throughput = try benchmarkHash(H.ty, mode(32 * MiB));
176176 try printPad(stdout, H.name);
177 try stdout.print(": {} MiB/s\n", throughput / (1 * MiB));
177 try stdout.print(": {} MiB/s\n", .{throughput / (1 * MiB)});
178178 }
179179 }
180180
......@@ -182,7 +182,7 @@ pub fn main() !void {
182182 if (filter == null or std.mem.indexOf(u8, M.name, filter.?) != null) {
183183 const throughput = try benchmarkMac(M.ty, mode(128 * MiB));
184184 try printPad(stdout, M.name);
185 try stdout.print(": {} MiB/s\n", throughput / (1 * MiB));
185 try stdout.print(": {} MiB/s\n", .{throughput / (1 * MiB)});
186186 }
187187 }
188188
......@@ -190,7 +190,7 @@ pub fn main() !void {
190190 if (filter == null or std.mem.indexOf(u8, E.name, filter.?) != null) {
191191 const throughput = try benchmarkKeyExchange(E.ty, mode(1000));
192192 try printPad(stdout, E.name);
193 try stdout.print(": {} exchanges/s\n", throughput);
193 try stdout.print(": {} exchanges/s\n", .{throughput});
194194 }
195195 }
196196}
lib/std/hash/benchmark.zig+5-14
......@@ -171,15 +171,6 @@ fn mode(comptime x: comptime_int) comptime_int {
171171 return if (builtin.mode == builtin.Mode.Debug) x / 64 else x;
172172}
173173
174// TODO(#1358): Replace with builtin formatted padding when available.
175fn printPad(stdout: var, s: []const u8) !void {
176 var i: usize = 0;
177 while (i < 12 - s.len) : (i += 1) {
178 try stdout.print(" ");
179 }
180 try stdout.print("{}", s);
181}
182
183174pub fn main() !void {
184175 var stdout_file = std.io.getStdOut();
185176 var stdout_out_stream = stdout_file.outStream();
......@@ -198,7 +189,7 @@ pub fn main() !void {
198189 var i: usize = 1;
199190 while (i < args.len) : (i += 1) {
200191 if (std.mem.eql(u8, args[i], "--mode")) {
201 try stdout.print("{}\n", builtin.mode);
192 try stdout.print("{}\n", .{builtin.mode});
202193 return;
203194 } else if (std.mem.eql(u8, args[i], "--seed")) {
204195 i += 1;
......@@ -235,7 +226,7 @@ pub fn main() !void {
235226
236227 key_size = try std.fmt.parseUnsigned(usize, args[i], 10);
237228 if (key_size > block_size) {
238 try stdout.print("key_size cannot exceed block size of {}\n", block_size);
229 try stdout.print("key_size cannot exceed block size of {}\n", .{block_size});
239230 std.os.exit(1);
240231 }
241232 } else if (std.mem.eql(u8, args[i], "--iterative-only")) {
......@@ -252,20 +243,20 @@ pub fn main() !void {
252243 inline for (hashes) |H| {
253244 if (filter == null or std.mem.indexOf(u8, H.name, filter.?) != null) {
254245 if (!test_iterative_only or H.has_iterative_api) {
255 try stdout.print("{}\n", H.name);
246 try stdout.print("{}\n", .{H.name});
256247
257248 // Always reseed prior to every call so we are hashing the same buffer contents.
258249 // This allows easier comparison between different implementations.
259250 if (H.has_iterative_api) {
260251 prng.seed(seed);
261252 const result = try benchmarkHash(H, count);
262 try stdout.print(" iterative: {:4} MiB/s [{x:0<16}]\n", result.throughput / (1 * MiB), result.hash);
253 try stdout.print(" iterative: {:4} MiB/s [{x:0<16}]\n", .{result.throughput / (1 * MiB), result.hash});
263254 }
264255
265256 if (!test_iterative_only) {
266257 prng.seed(seed);
267258 const result_small = try benchmarkHashSmallKeys(H, key_size, count);
268 try stdout.print(" small keys: {:4} MiB/s [{x:0<16}]\n", result_small.throughput / (1 * MiB), result_small.hash);
259 try stdout.print(" small keys: {:4} MiB/s [{x:0<16}]\n", .{result_small.throughput / (1 * MiB), result_small.hash});
269260 }
270261 }
271262 }
lib/std/os/uefi.zig+7-1
......@@ -35,7 +35,13 @@ pub const Guid = extern struct {
3535 output: fn (@TypeOf(context), []const u8) Errors!void,
3636 ) Errors!void {
3737 if (f.len == 0) {
38 return fmt.format(context, Errors, output, "{x:0>8}-{x:0>4}-{x:0>4}-{x:0>2}{x:0>2}-{x:0>12}", self.time_low, self.time_mid, self.time_high_and_version, self.clock_seq_high_and_reserved, self.clock_seq_low, self.node);
38 return fmt.format(context, Errors, output, "{x:0>8}-{x:0>4}-{x:0>4}-{x:0>2}{x:0>2}-{x:0>12}", .{
39 self.time_low,
40 self.time_mid,
41 self.time_high_and_version,
42 self.clock_seq_high_and_reserved,
43 self.clock_seq_low, self.node,
44 });
3945 } else {
4046 @compileError("Unknown format character: '" ++ f ++ "'");
4147 }
lib/std/special/c.zig+1-1
......@@ -81,7 +81,7 @@ test "strncmp" {
8181pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn {
8282 if (builtin.is_test) {
8383 @setCold(true);
84 std.debug.panic("{}", msg);
84 std.debug.panic("{}", .{msg});
8585 }
8686 if (builtin.os != .freestanding and builtin.os != .other) {
8787 std.os.abort();
lib/std/special/compiler_rt.zig+1-1
......@@ -308,7 +308,7 @@ const __udivmoddi4 = @import("compiler_rt/udivmoddi4.zig").__udivmoddi4;
308308pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn {
309309 @setCold(true);
310310 if (is_test) {
311 std.debug.panic("{}", msg);
311 std.debug.panic("{}", .{msg});
312312 } else {
313313 unreachable;
314314 }
lib/std/special/compiler_rt/ashrti3_test.zig+2-2
......@@ -3,8 +3,8 @@ const testing = @import("std").testing;
33
44fn test__ashrti3(a: i128, b: i32, expected: i128) void {
55 const x = __ashrti3(a, b);
6 // @import("std").debug.warn("got 0x{x}\nexp 0x{x}\n", @truncate(u64,
7 // @bitCast(u128, x) >> 64), @truncate(u64, @bitCast(u128, expected)) >> 64);
6 // @import("std").debug.warn("got 0x{x}\nexp 0x{x}\n", .{@truncate(u64,
7 // @bitCast(u128, x) >> 64), @truncate(u64, @bitCast(u128, expected)) >> 64});
88 testing.expect(x == expected);
99}
1010
lib/std/special/compiler_rt/fixdfdi_test.zig+2-2
......@@ -6,12 +6,12 @@ const warn = std.debug.warn;
66
77fn test__fixdfdi(a: f64, expected: i64) void {
88 const x = __fixdfdi(a);
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u64, {x})\n", a, @bitCast(u64, a), x, x, expected, expected, @bitCast(u64, expected));
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u64, {x})\n", .{a, @bitCast(u64, a), x, x, expected, expected, @bitCast(u64, expected)});
1010 testing.expect(x == expected);
1111}
1212
1313test "fixdfdi" {
14 //warn("\n");
14 //warn("\n", .{});
1515 test__fixdfdi(-math.f64_max, math.minInt(i64));
1616
1717 test__fixdfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
lib/std/special/compiler_rt/fixdfsi_test.zig+2-2
......@@ -6,12 +6,12 @@ const warn = std.debug.warn;
66
77fn test__fixdfsi(a: f64, expected: i32) void {
88 const x = __fixdfsi(a);
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u64, {x})\n", a, @bitCast(u64, a), x, x, expected, expected, @bitCast(u32, expected));
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u64, {x})\n", .{a, @bitCast(u64, a), x, x, expected, expected, @bitCast(u32, expected)});
1010 testing.expect(x == expected);
1111}
1212
1313test "fixdfsi" {
14 //warn("\n");
14 //warn("\n", .{});
1515 test__fixdfsi(-math.f64_max, math.minInt(i32));
1616
1717 test__fixdfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
lib/std/special/compiler_rt/fixdfti_test.zig+2-2
......@@ -6,12 +6,12 @@ const warn = std.debug.warn;
66
77fn test__fixdfti(a: f64, expected: i128) void {
88 const x = __fixdfti(a);
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u64, {x})\n", a, @bitCast(u64, a), x, x, expected, expected, @bitCast(u128, expected));
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u64, {x})\n", .{a, @bitCast(u64, a), x, x, expected, expected, @bitCast(u128, expected)});
1010 testing.expect(x == expected);
1111}
1212
1313test "fixdfti" {
14 //warn("\n");
14 //warn("\n", .{});
1515 test__fixdfti(-math.f64_max, math.minInt(i128));
1616
1717 test__fixdfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
lib/std/special/compiler_rt/fixint_test.zig+1-1
......@@ -8,7 +8,7 @@ const fixint = @import("fixint.zig").fixint;
88
99fn test__fixint(comptime fp_t: type, comptime fixint_t: type, a: fp_t, expected: fixint_t) void {
1010 const x = fixint(fp_t, fixint_t, a);
11 //warn("a={} x={}:{x} expected={}:{x})\n", a, x, x, expected, expected);
11 //warn("a={} x={}:{x} expected={}:{x})\n", .{a, x, x, expected, expected});
1212 testing.expect(x == expected);
1313}
1414
lib/std/special/compiler_rt/fixsfdi_test.zig+2-2
......@@ -6,12 +6,12 @@ const warn = std.debug.warn;
66
77fn test__fixsfdi(a: f32, expected: i64) void {
88 const x = __fixsfdi(a);
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u32, {x})\n", a, @bitCast(u32, a), x, x, expected, expected, @bitCast(u64, expected));
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u32, {x})\n", .{a, @bitCast(u32, a), x, x, expected, expected, @bitCast(u64, expected)});
1010 testing.expect(x == expected);
1111}
1212
1313test "fixsfdi" {
14 //warn("\n");
14 //warn("\n", .{});
1515 test__fixsfdi(-math.f32_max, math.minInt(i64));
1616
1717 test__fixsfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
lib/std/special/compiler_rt/fixsfsi_test.zig+2-2
......@@ -6,12 +6,12 @@ const warn = std.debug.warn;
66
77fn test__fixsfsi(a: f32, expected: i32) void {
88 const x = __fixsfsi(a);
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u32, {x})\n", a, @bitCast(u32, a), x, x, expected, expected, @bitCast(u32, expected));
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u32, {x})\n", .{a, @bitCast(u32, a), x, x, expected, expected, @bitCast(u32, expected)});
1010 testing.expect(x == expected);
1111}
1212
1313test "fixsfsi" {
14 //warn("\n");
14 //warn("\n", .{});
1515 test__fixsfsi(-math.f32_max, math.minInt(i32));
1616
1717 test__fixsfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
lib/std/special/compiler_rt/fixsfti_test.zig+2-2
......@@ -6,12 +6,12 @@ const warn = std.debug.warn;
66
77fn test__fixsfti(a: f32, expected: i128) void {
88 const x = __fixsfti(a);
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u128, {x})\n", a, @bitCast(u32, a), x, x, expected, expected, @bitCast(u128, expected));
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u128, {x})\n", .{a, @bitCast(u32, a), x, x, expected, expected, @bitCast(u128, expected)});
1010 testing.expect(x == expected);
1111}
1212
1313test "fixsfti" {
14 //warn("\n");
14 //warn("\n", .{});
1515 test__fixsfti(-math.f32_max, math.minInt(i128));
1616
1717 test__fixsfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
lib/std/special/compiler_rt/fixtfdi_test.zig+2-2
......@@ -6,12 +6,12 @@ const warn = std.debug.warn;
66
77fn test__fixtfdi(a: f128, expected: i64) void {
88 const x = __fixtfdi(a);
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u64, {x})\n", a, @bitCast(u128, a), x, x, expected, expected, @bitCast(u64, expected));
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u64, {x})\n", .{a, @bitCast(u128, a), x, x, expected, expected, @bitCast(u64, expected)});
1010 testing.expect(x == expected);
1111}
1212
1313test "fixtfdi" {
14 //warn("\n");
14 //warn("\n", .{});
1515 test__fixtfdi(-math.f128_max, math.minInt(i64));
1616
1717 test__fixtfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
lib/std/special/compiler_rt/fixtfsi_test.zig+2-2
......@@ -6,12 +6,12 @@ const warn = std.debug.warn;
66
77fn test__fixtfsi(a: f128, expected: i32) void {
88 const x = __fixtfsi(a);
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u32, {x})\n", a, @bitCast(u128, a), x, x, expected, expected, @bitCast(u32, expected));
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u32, {x})\n", .{a, @bitCast(u128, a), x, x, expected, expected, @bitCast(u32, expected)});
1010 testing.expect(x == expected);
1111}
1212
1313test "fixtfsi" {
14 //warn("\n");
14 //warn("\n", .{});
1515 test__fixtfsi(-math.f128_max, math.minInt(i32));
1616
1717 test__fixtfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
lib/std/special/compiler_rt/fixtfti_test.zig+2-2
......@@ -6,12 +6,12 @@ const warn = std.debug.warn;
66
77fn test__fixtfti(a: f128, expected: i128) void {
88 const x = __fixtfti(a);
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u128, {x})\n", a, @bitCast(u128, a), x, x, expected, expected, @bitCast(u128, expected));
9 //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u128, {x})\n", .{a, @bitCast(u128, a), x, x, expected, expected, @bitCast(u128, expected)});
1010 testing.expect(x == expected);
1111}
1212
1313test "fixtfti" {
14 //warn("\n");
14 //warn("\n", .{});
1515 test__fixtfti(-math.f128_max, math.minInt(i128));
1616
1717 test__fixtfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
lib/std/zig/perf_test.zig+1-1
......@@ -25,7 +25,7 @@ pub fn main() !void {
2525
2626 var stdout_file = std.io.getStdOut();
2727 const stdout = &stdout_file.outStream().stream;
28 try stdout.print("{:.3} MiB/s, {} KiB used \n", mb_per_sec, memory_used / 1024);
28 try stdout.print("{:.3} MiB/s, {} KiB used \n", .{mb_per_sec, memory_used / 1024});
2929}
3030
3131fn testOnce() usize {
src-self-hosted/dep_tokenizer.zig+1-1
......@@ -894,7 +894,7 @@ fn printSection(out: var, label: []const u8, bytes: []const u8) !void {
894894
895895fn printLabel(out: var, label: []const u8, bytes: []const u8) !void {
896896 var buf: [80]u8 = undefined;
897 var text = try std.fmt.bufPrint(buf[0..], "{} {} bytes ", label, bytes.len);
897 var text = try std.fmt.bufPrint(buf[0..], "{} {} bytes ", .{label, bytes.len});
898898 try out.write(text);
899899 var i: usize = text.len;
900900 const end = 79;
src-self-hosted/test.zig+7-8
......@@ -81,7 +81,7 @@ pub const TestContext = struct {
8181 msg: []const u8,
8282 ) !void {
8383 var file_index_buf: [20]u8 = undefined;
84 const file_index = try std.fmt.bufPrint(file_index_buf[0..], "{}", self.file_index.incr());
84 const file_index = try std.fmt.bufPrint(file_index_buf[0..], "{}", .{self.file_index.incr()});
8585 const file1_path = try std.fs.path.join(allocator, [_][]const u8{ tmp_dir_name, file_index, file1 });
8686
8787 if (std.fs.path.dirname(file1_path)) |dirname| {
......@@ -114,10 +114,10 @@ pub const TestContext = struct {
114114 expected_output: []const u8,
115115 ) !void {
116116 var file_index_buf: [20]u8 = undefined;
117 const file_index = try std.fmt.bufPrint(file_index_buf[0..], "{}", self.file_index.incr());
117 const file_index = try std.fmt.bufPrint(file_index_buf[0..], "{}", .{self.file_index.incr()});
118118 const file1_path = try std.fs.path.join(allocator, [_][]const u8{ tmp_dir_name, file_index, file1 });
119119
120 const output_file = try std.fmt.allocPrint(allocator, "{}-out{}", file1_path, (Target{ .Native = {} }).exeFileExt());
120 const output_file = try std.fmt.allocPrint(allocator, "{}-out{}", .{ file1_path, (Target{ .Native = {} }).exeFileExt() });
121121 if (std.fs.path.dirname(file1_path)) |dirname| {
122122 try std.fs.makePath(allocator, dirname);
123123 }
......@@ -214,21 +214,20 @@ pub const TestContext = struct {
214214 }
215215 }
216216 }
217 std.debug.warn(
218 "\n=====source:=======\n{}\n====expected:========\n{}:{}:{}: error: {}\n",
217 std.debug.warn("\n=====source:=======\n{}\n====expected:========\n{}:{}:{}: error: {}\n", .{
219218 source,
220219 path,
221220 line,
222221 column,
223222 text,
224 );
225 std.debug.warn("\n====found:========\n");
223 });
224 std.debug.warn("\n====found:========\n", .{});
226225 const stderr = std.io.getStdErr();
227226 for (msgs) |msg| {
228227 defer msg.destroy();
229228 try msg.printToFile(stderr, errmsg.Color.Auto);
230229 }
231 std.debug.warn("============\n");
230 std.debug.warn("============\n", .{});
232231 return error.TestFailed;
233232 },
234233 }
src-self-hosted/translate_c.zig+2-2
......@@ -330,11 +330,11 @@ pub fn translate(
330330 tree.root_node.eof_token = try appendToken(&context, .Eof, "");
331331 tree.source = source_buffer.toOwnedSlice();
332332 if (false) {
333 std.debug.warn("debug source:\n{}\n==EOF==\ntokens:\n", tree.source);
333 std.debug.warn("debug source:\n{}\n==EOF==\ntokens:\n", .{tree.source});
334334 var i: usize = 0;
335335 while (i < tree.tokens.len) : (i += 1) {
336336 const token = tree.tokens.at(i);
337 std.debug.warn("{}\n", token);
337 std.debug.warn("{}\n", .{token});
338338 }
339339 }
340340 return tree;
src-self-hosted/type.zig+1-1
......@@ -162,7 +162,7 @@ pub const Type = struct {
162162 }
163163
164164 pub fn dump(base: *const Type) void {
165 std.debug.warn("{}", @tagName(base.id));
165 std.debug.warn("{}", .{@tagName(base.id)});
166166 }
167167
168168 fn init(base: *Type, comp: *Compilation, id: Id, name: []const u8) void {
tools/process_headers.zig+17-20
......@@ -270,7 +270,7 @@ pub fn main() !void {
270270 if (std.mem.eql(u8, args[arg_i], "--help"))
271271 usageAndExit(args[0]);
272272 if (arg_i + 1 >= args.len) {
273 std.debug.warn("expected argument after '{}'\n", args[arg_i]);
273 std.debug.warn("expected argument after '{}'\n", .{args[arg_i]});
274274 usageAndExit(args[0]);
275275 }
276276
......@@ -283,7 +283,7 @@ pub fn main() !void {
283283 assert(opt_abi == null);
284284 opt_abi = args[arg_i + 1];
285285 } else {
286 std.debug.warn("unrecognized argument: {}\n", args[arg_i]);
286 std.debug.warn("unrecognized argument: {}\n", .{args[arg_i]});
287287 usageAndExit(args[0]);
288288 }
289289
......@@ -297,10 +297,10 @@ pub fn main() !void {
297297 else if (std.mem.eql(u8, abi_name, "glibc"))
298298 LibCVendor.glibc
299299 else {
300 std.debug.warn("unrecognized C ABI: {}\n", abi_name);
300 std.debug.warn("unrecognized C ABI: {}\n", .{abi_name});
301301 usageAndExit(args[0]);
302302 };
303 const generic_name = try std.fmt.allocPrint(allocator, "generic-{}", abi_name);
303 const generic_name = try std.fmt.allocPrint(allocator, "generic-{}", .{abi_name});
304304
305305 // TODO compiler crashed when I wrote this the canonical way
306306 var libc_targets: []const LibCTarget = undefined;
......@@ -365,12 +365,11 @@ pub fn main() !void {
365365 if (gop.found_existing) {
366366 max_bytes_saved += raw_bytes.len;
367367 gop.kv.value.hit_count += 1;
368 std.debug.warn(
369 "duplicate: {} {} ({Bi:2})\n",
368 std.debug.warn("duplicate: {} {} ({Bi:2})\n", .{
370369 libc_target.name,
371370 rel_path,
372371 raw_bytes.len,
373 );
372 });
374373 } else {
375374 gop.kv.value = Contents{
376375 .bytes = trimmed,
......@@ -388,16 +387,16 @@ pub fn main() !void {
388387 };
389388 assert((try target_to_hash.put(dest_target, hash)) == null);
390389 },
391 else => std.debug.warn("warning: weird file: {}\n", full_path),
390 else => std.debug.warn("warning: weird file: {}\n", .{full_path}),
392391 }
393392 }
394393 }
395394 break;
396395 } else {
397 std.debug.warn("warning: libc target not found: {}\n", libc_target.name);
396 std.debug.warn("warning: libc target not found: {}\n", .{libc_target.name});
398397 }
399398 }
400 std.debug.warn("summary: {Bi:2} could be reduced to {Bi:2}\n", total_bytes, total_bytes - max_bytes_saved);
399 std.debug.warn("summary: {Bi:2} could be reduced to {Bi:2}\n", .{total_bytes, total_bytes - max_bytes_saved});
401400 try std.fs.makePath(allocator, out_dir);
402401
403402 var missed_opportunity_bytes: usize = 0;
......@@ -426,7 +425,7 @@ pub fn main() !void {
426425 if (contender.hit_count > 1) {
427426 const this_missed_bytes = contender.hit_count * contender.bytes.len;
428427 missed_opportunity_bytes += this_missed_bytes;
429 std.debug.warn("Missed opportunity ({Bi:2}): {}\n", this_missed_bytes, path_kv.key);
428 std.debug.warn("Missed opportunity ({Bi:2}): {}\n", .{this_missed_bytes, path_kv.key});
430429 } else break;
431430 }
432431 }
......@@ -440,13 +439,11 @@ pub fn main() !void {
440439 .specific => |a| @tagName(a),
441440 else => @tagName(dest_target.arch),
442441 };
443 const out_subpath = try std.fmt.allocPrint(
444 allocator,
445 "{}-{}-{}",
442 const out_subpath = try std.fmt.allocPrint(allocator, "{}-{}-{}", .{
446443 arch_name,
447444 @tagName(dest_target.os),
448445 @tagName(dest_target.abi),
449 );
446 });
450447 const full_path = try std.fs.path.join(allocator, [_][]const u8{ out_dir, out_subpath, path_kv.key });
451448 try std.fs.makePath(allocator, std.fs.path.dirname(full_path).?);
452449 try std.io.writeFile(full_path, contents.bytes);
......@@ -455,10 +452,10 @@ pub fn main() !void {
455452}
456453
457454fn usageAndExit(arg0: []const u8) noreturn {
458 std.debug.warn("Usage: {} [--search-path <dir>] --out <dir> --abi <name>\n", arg0);
459 std.debug.warn("--search-path can be used any number of times.\n");
460 std.debug.warn(" subdirectories of search paths look like, e.g. x86_64-linux-gnu\n");
461 std.debug.warn("--out is a dir that will be created, and populated with the results\n");
462 std.debug.warn("--abi is either musl or glibc\n");
455 std.debug.warn("Usage: {} [--search-path <dir>] --out <dir> --abi <name>\n", .{arg0});
456 std.debug.warn("--search-path can be used any number of times.\n", .{});
457 std.debug.warn(" subdirectories of search paths look like, e.g. x86_64-linux-gnu\n", .{});
458 std.debug.warn("--out is a dir that will be created, and populated with the results\n", .{});
459 std.debug.warn("--abi is either musl or glibc\n", .{});
463460 std.process.exit(1);
464461}
tools/update_glibc.zig+6-6
......@@ -155,7 +155,7 @@ pub fn main() !void {
155155 const fn_set = &target_funcs_gop.kv.value.list;
156156
157157 for (lib_names) |lib_name, lib_name_index| {
158 const basename = try fmt.allocPrint(allocator, "lib{}.abilist", lib_name);
158 const basename = try fmt.allocPrint(allocator, "lib{}.abilist", .{lib_name});
159159 const abi_list_filename = blk: {
160160 if (abi_list.targets[0].abi == .gnuabi64 and std.mem.eql(u8, lib_name, "c")) {
161161 break :blk try fs.path.join(allocator, [_][]const u8{ prefix, abi_list.path, "n64", basename });
......@@ -177,7 +177,7 @@ pub fn main() !void {
177177 break :blk try fs.path.join(allocator, [_][]const u8{ prefix, abi_list.path, basename });
178178 };
179179 const contents = std.io.readFileAlloc(allocator, abi_list_filename) catch |err| {
180 std.debug.warn("unable to open {}: {}\n", abi_list_filename, err);
180 std.debug.warn("unable to open {}: {}\n", .{abi_list_filename, err});
181181 std.process.exit(1);
182182 };
183183 var lines_it = std.mem.tokenize(contents, "\n");
......@@ -235,7 +235,7 @@ pub fn main() !void {
235235 const vers_txt = &buffered.stream;
236236 for (global_ver_list) |name, i| {
237237 _ = global_ver_set.put(name, i) catch unreachable;
238 try vers_txt.print("{}\n", name);
238 try vers_txt.print("{}\n", .{name});
239239 }
240240 try buffered.flush();
241241 }
......@@ -248,7 +248,7 @@ pub fn main() !void {
248248 for (global_fn_list) |name, i| {
249249 const kv = global_fn_set.get(name).?;
250250 kv.value.index = i;
251 try fns_txt.print("{} {}\n", name, kv.value.lib);
251 try fns_txt.print("{} {}\n", .{name, kv.value.lib});
252252 }
253253 try buffered.flush();
254254 }
......@@ -282,7 +282,7 @@ pub fn main() !void {
282282 const fn_vers_list = &target_functions.get(@ptrToInt(abi_list)).?.value.fn_vers_list;
283283 for (abi_list.targets) |target, it_i| {
284284 if (it_i != 0) try abilist_txt.writeByte(' ');
285 try abilist_txt.print("{}-linux-{}", @tagName(target.arch), @tagName(target.abi));
285 try abilist_txt.print("{}-linux-{}", .{@tagName(target.arch), @tagName(target.abi)});
286286 }
287287 try abilist_txt.writeByte('\n');
288288 // next, each line implicitly corresponds to a function
......@@ -293,7 +293,7 @@ pub fn main() !void {
293293 };
294294 for (kv.value.toSliceConst()) |ver_index, it_i| {
295295 if (it_i != 0) try abilist_txt.writeByte(' ');
296 try abilist_txt.print("{d}", ver_index);
296 try abilist_txt.print("{d}", .{ver_index});
297297 }
298298 try abilist_txt.writeByte('\n');
299299 }