tools: fix compilation errors

This commit is contained in:
Andrew Kelley 2025-12-22 22:30:49 -08:00
parent 7a09d579b5
commit c05e2720a1
8 changed files with 27 additions and 25 deletions

View file

@ -51,8 +51,8 @@ pub fn main() !void {
var coverage: std.debug.Coverage = .init;
defer coverage.deinit(gpa);
var debug_info = std.debug.Info.load(gpa, exe_path, &coverage, target.ofmt, target.cpu.arch) catch |err| {
fatal("failed to load debug info for {f}: {s}", .{ exe_path, @errorName(err) });
var debug_info = std.debug.Info.load(gpa, io, exe_path, &coverage, target.ofmt, target.cpu.arch) catch |err| {
fatal("failed to load debug info for {f}: {t}", .{ exe_path, err });
};
defer debug_info.deinit(gpa);

View file

@ -930,8 +930,9 @@ fn parseHexInt(text: []const u8) !u31 {
}
fn usageAndExit(arg0: []const u8, code: u8) noreturn {
const stderr, _ = std.debug.lockStderrWriter(&.{});
stderr.print(
const stderr = std.debug.lockStderr(&.{});
const w = &stderr.file_writer.interface;
w.print(
\\Usage: {s} <SPIRV-Headers repository path> <path/to/zig/src/codegen/spirv/extinst.zig.grammar.json>
\\
\\Generates Zig bindings for SPIR-V specifications found in the SPIRV-Headers

View file

@ -181,8 +181,8 @@ pub fn main() !void {
const args = try std.process.argsAlloc(gpa);
if (args.len < 2 or mem.eql(u8, args[1], "--help")) {
const w, _ = std.debug.lockStderrWriter(&.{});
defer std.debug.unlockStderrWriter();
const stderr = std.debug.lockStderr(&.{});
const w = &stderr.file_writer.interface;
usage(w, args[0]) catch std.process.exit(2);
std.process.exit(1);
}

View file

@ -197,7 +197,7 @@ pub fn main() !void {
try dir_stack.append(target_include_dir);
while (dir_stack.pop()) |full_dir_name| {
var dir = Dir.cwd().openDir(full_dir_name, .{ .iterate = true }) catch |err| switch (err) {
var dir = Dir.cwd().openDir(io, full_dir_name, .{ .iterate = true }) catch |err| switch (err) {
error.FileNotFound => continue :search,
error.AccessDenied => continue :search,
else => return err,
@ -213,7 +213,7 @@ pub fn main() !void {
.file => {
const rel_path = try Dir.path.relative(arena, target_include_dir, full_path);
const max_size = 2 * 1024 * 1024 * 1024;
const raw_bytes = try Dir.cwd().readFileAlloc(full_path, arena, .limited(max_size));
const raw_bytes = try Dir.cwd().readFileAlloc(io, full_path, arena, .limited(max_size));
const trimmed = std.mem.trim(u8, raw_bytes, " \r\n\t");
total_bytes += raw_bytes.len;
const hash = try arena.alloc(u8, 32);

View file

@ -961,8 +961,8 @@ fn objectLessThan(context: void, a: *json.ObjectMap, b: *json.ObjectMap) bool {
}
fn printUsageAndExit(arg0: []const u8) noreturn {
const w, _ = std.debug.lockStderrWriter(&.{});
defer std.debug.unlockStderrWriter();
const stderr = std.debug.lockStderr(&.{});
const w = &stderr.file_writer.interface;
printUsage(w, arg0) catch std.process.exit(2);
std.process.exit(1);
}

View file

@ -2426,8 +2426,9 @@ fn processOneTarget(io: Io, job: Job) void {
}
fn usageAndExit(arg0: []const u8, code: u8) noreturn {
const stderr, _ = std.debug.lockStderrWriter(&.{});
stderr.print(
const stderr = std.debug.lockStderr(&.{});
const w = &stderr.file_writer.interface;
w.print(
\\Usage: {s} /path/to/llvm-tblgen /path/git/llvm-project /path/git/zig [zig_name filter]
\\
\\Updates lib/std/target/<target>.zig from llvm/lib/Target/<Target>/<Target>.td .

View file

@ -195,8 +195,8 @@ pub fn main() anyerror!void {
}
fn printUsageAndExit(arg0: []const u8) noreturn {
const w, _ = std.debug.lockStderrWriter(&.{});
defer std.debug.unlockStderrWriter();
const stderr = std.debug.lockStderr(&.{});
const w = &stderr.file_writer.interface;
printUsage(w, arg0) catch std.process.exit(2);
std.process.exit(1);
}