mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 02:24:33 +01:00
compiler: fix compilation when linking libc
This commit is contained in:
parent
a5b719e9eb
commit
54865e0483
4 changed files with 16 additions and 11 deletions
|
|
@ -224,7 +224,7 @@ fn mainTerminal() void {
|
|||
var skip_count: usize = 0;
|
||||
var fail_count: usize = 0;
|
||||
var fuzz_count: usize = 0;
|
||||
const root_node = if (builtin.fuzz) std.Progress.Node.none else std.Progress.start(.{
|
||||
const root_node = if (builtin.fuzz) std.Progress.Node.none else std.Progress.start(runner_threaded_io.io(), .{
|
||||
.root_name = "Test",
|
||||
.estimated_total_items = test_fn_list.len,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6804,7 +6804,7 @@ fn fileWritePositional(
|
|||
|
||||
try current_thread.beginSyscall();
|
||||
while (true) {
|
||||
const rc = pwritev_sym(file.handle, &iovecs, iovlen, @bitCast(offset));
|
||||
const rc = pwritev_sym(file.handle, &iovecs, @intCast(iovlen), @bitCast(offset));
|
||||
switch (posix.errno(rc)) {
|
||||
.SUCCESS => {
|
||||
current_thread.endSyscall();
|
||||
|
|
@ -6923,7 +6923,7 @@ fn fileWriteStreaming(
|
|||
|
||||
try current_thread.beginSyscall();
|
||||
while (true) {
|
||||
const rc = posix.system.writev(file.handle, &iovecs, iovlen);
|
||||
const rc = posix.system.writev(file.handle, &iovecs, @intCast(iovlen));
|
||||
switch (posix.errno(rc)) {
|
||||
.SUCCESS => {
|
||||
current_thread.endSyscall();
|
||||
|
|
|
|||
|
|
@ -370,7 +370,8 @@ pub fn expectEqualSlices(comptime T: type, expected: []const T, actual: []const
|
|||
if (!backend_can_print) return error.TestExpectedEqual;
|
||||
if (io.lockStderr(&.{}, null)) |stderr| {
|
||||
defer io.unlockStderr();
|
||||
failEqualSlices(T, expected, actual, diff_index, &stderr.interface, stderr.mode) catch {};
|
||||
const w = &stderr.file_writer.interface;
|
||||
failEqualSlices(T, expected, actual, diff_index, w, stderr.terminal_mode) catch {};
|
||||
} else |_| {}
|
||||
return error.TestExpectedEqual;
|
||||
}
|
||||
|
|
@ -475,13 +476,13 @@ fn SliceDiffer(comptime T: type) type {
|
|||
for (self.expected, 0..) |value, i| {
|
||||
const full_index = self.start_index + i;
|
||||
const diff = if (i < self.actual.len) !std.meta.eql(self.actual[i], value) else true;
|
||||
if (diff) try t.setColor(writer, .red);
|
||||
if (diff) try t.setColor(.red);
|
||||
if (@typeInfo(T) == .pointer) {
|
||||
try writer.print("[{}]{*}: {any}\n", .{ full_index, value, value });
|
||||
} else {
|
||||
try writer.print("[{}]: {any}\n", .{ full_index, value });
|
||||
}
|
||||
if (diff) try t.setColor(writer, .reset);
|
||||
if (diff) try t.setColor(.reset);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -538,10 +539,14 @@ const BytesDiffer = struct {
|
|||
}
|
||||
}
|
||||
|
||||
fn terminal(self: *const BytesDiffer, writer: *Io.Writer) Io.Terminal {
|
||||
return .{ .writer = writer, .mode = self.terminal_mode };
|
||||
}
|
||||
|
||||
fn writeDiff(self: BytesDiffer, writer: *Io.Writer, comptime fmt: []const u8, args: anytype, diff: bool) !void {
|
||||
if (diff) try self.file_writer_mode.setColor(writer, .red);
|
||||
if (diff) try self.terminal(writer).setColor(.red);
|
||||
try writer.print(fmt, args);
|
||||
if (diff) try self.file_writer_mode.setColor(writer, .reset);
|
||||
if (diff) try self.terminal(writer).setColor(.reset);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6270,7 +6270,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: std.Pr
|
|||
}
|
||||
|
||||
if (comp.verbose_cc) {
|
||||
dumpArgv(io, argv.items);
|
||||
try dumpArgv(io, argv.items);
|
||||
}
|
||||
|
||||
const err = std.process.execv(arena, argv.items);
|
||||
|
|
@ -6316,7 +6316,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: std.Pr
|
|||
}
|
||||
|
||||
if (comp.verbose_cc) {
|
||||
dumpArgv(io, argv.items);
|
||||
try dumpArgv(io, argv.items);
|
||||
}
|
||||
|
||||
// Just to save disk space, we delete the files that are never needed again.
|
||||
|
|
@ -6358,7 +6358,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: std.Pr
|
|||
var stderr_reader = child.stderr.?.readerStreaming(io, &.{});
|
||||
const stderr = try stderr_reader.interface.allocRemaining(arena, .limited(std.math.maxInt(u32)));
|
||||
|
||||
const term = child.wait() catch |err| {
|
||||
const term = child.wait(io) catch |err| {
|
||||
return comp.failCObj(c_object, "failed to spawn zig clang {s}: {s}", .{ argv.items[0], @errorName(err) });
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue