aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-03-12 18:05:27 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-03-12 18:05:27 -0700
commit1f34c03ac14ac352ec03267ca8592dadfbd5e4bc (patch)
treeebcb851922636b7dd2b17acb72187836c86180ec /tools
parent868253a9c94d9907fae81e5e3108c7d10a85f5c3 (diff)
parent8ebb18d9da0bfbe6a974636fd36e3391d1de253b (diff)
downloadzig-1f34c03ac14ac352ec03267ca8592dadfbd5e4bc.tar.gz
zig-1f34c03ac14ac352ec03267ca8592dadfbd5e4bc.zip
Merge remote-tracking branch 'origin/master' into llvm12
Diffstat (limited to 'tools')
-rw-r--r--tools/process_headers.zig30
1 files changed, 18 insertions, 12 deletions
diff --git a/tools/process_headers.zig b/tools/process_headers.zig
index c5279ba74f..9c0822a9f3 100644
--- a/tools/process_headers.zig
+++ b/tools/process_headers.zig
@@ -270,7 +270,7 @@ pub fn main() !void {
if (std.mem.eql(u8, args[arg_i], "--help"))
usageAndExit(args[0]);
if (arg_i + 1 >= args.len) {
- std.debug.warn("expected argument after '{}'\n", .{args[arg_i]});
+ std.debug.warn("expected argument after '{s}'\n", .{args[arg_i]});
usageAndExit(args[0]);
}
@@ -283,7 +283,7 @@ pub fn main() !void {
assert(opt_abi == null);
opt_abi = args[arg_i + 1];
} else {
- std.debug.warn("unrecognized argument: {}\n", .{args[arg_i]});
+ std.debug.warn("unrecognized argument: {s}\n", .{args[arg_i]});
usageAndExit(args[0]);
}
@@ -297,10 +297,10 @@ pub fn main() !void {
else if (std.mem.eql(u8, abi_name, "glibc"))
LibCVendor.glibc
else {
- std.debug.warn("unrecognized C ABI: {}\n", .{abi_name});
+ std.debug.warn("unrecognized C ABI: {s}\n", .{abi_name});
usageAndExit(args[0]);
};
- const generic_name = try std.fmt.allocPrint(allocator, "generic-{}", .{abi_name});
+ const generic_name = try std.fmt.allocPrint(allocator, "generic-{s}", .{abi_name});
// TODO compiler crashed when I wrote this the canonical way
var libc_targets: []const LibCTarget = undefined;
@@ -368,10 +368,10 @@ pub fn main() !void {
if (gop.found_existing) {
max_bytes_saved += raw_bytes.len;
gop.entry.value.hit_count += 1;
- std.debug.warn("duplicate: {} {} ({Bi:2})\n", .{
+ std.debug.warn("duplicate: {s} {s} ({:2})\n", .{
libc_target.name,
rel_path,
- raw_bytes.len,
+ std.fmt.fmtIntSizeDec(raw_bytes.len),
});
} else {
gop.entry.value = Contents{
@@ -390,16 +390,19 @@ pub fn main() !void {
};
try target_to_hash.putNoClobber(dest_target, hash);
},
- else => std.debug.warn("warning: weird file: {}\n", .{full_path}),
+ else => std.debug.warn("warning: weird file: {s}\n", .{full_path}),
}
}
}
break;
} else {
- std.debug.warn("warning: libc target not found: {}\n", .{libc_target.name});
+ std.debug.warn("warning: libc target not found: {s}\n", .{libc_target.name});
}
}
- std.debug.warn("summary: {Bi:2} could be reduced to {Bi:2}\n", .{ total_bytes, total_bytes - max_bytes_saved });
+ std.debug.warn("summary: {:2} could be reduced to {:2}\n", .{
+ std.fmt.fmtIntSizeDec(total_bytes),
+ std.fmt.fmtIntSizeDec(total_bytes - max_bytes_saved),
+ });
try std.fs.cwd().makePath(out_dir);
var missed_opportunity_bytes: usize = 0;
@@ -428,7 +431,10 @@ pub fn main() !void {
if (contender.hit_count > 1) {
const this_missed_bytes = contender.hit_count * contender.bytes.len;
missed_opportunity_bytes += this_missed_bytes;
- std.debug.warn("Missed opportunity ({Bi:2}): {}\n", .{ this_missed_bytes, path_kv.key });
+ std.debug.warn("Missed opportunity ({:2}): {s}\n", .{
+ std.fmt.fmtIntSizeDec(this_missed_bytes),
+ path_kv.key,
+ });
} else break;
}
}
@@ -442,7 +448,7 @@ pub fn main() !void {
.specific => |a| @tagName(a),
else => @tagName(dest_target.arch),
};
- const out_subpath = try std.fmt.allocPrint(allocator, "{}-{}-{}", .{
+ const out_subpath = try std.fmt.allocPrint(allocator, "{s}-{s}-{s}", .{
arch_name,
@tagName(dest_target.os),
@tagName(dest_target.abi),
@@ -455,7 +461,7 @@ pub fn main() !void {
}
fn usageAndExit(arg0: []const u8) noreturn {
- std.debug.warn("Usage: {} [--search-path <dir>] --out <dir> --abi <name>\n", .{arg0});
+ std.debug.warn("Usage: {s} [--search-path <dir>] --out <dir> --abi <name>\n", .{arg0});
std.debug.warn("--search-path can be used any number of times.\n", .{});
std.debug.warn(" subdirectories of search paths look like, e.g. x86_64-linux-gnu\n", .{});
std.debug.warn("--out is a dir that will be created, and populated with the results\n", .{});