Skip to content

Commit 1f639bd

Browse files
committed
Fix all compile errors
1 parent 4e228a2 commit 1f639bd

File tree

7 files changed

+14
-15
lines changed

7 files changed

+14
-15
lines changed

src/Dylib.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ fn parseBinary(self: *Dylib, macho_file: *MachO) !void {
148148
if (match) |this_plat| {
149149
if (this_plat.version.value > plat.version.value) {
150150
macho_file.warn(
151-
"{s}: object file was built for newer platform version: expected {}, got {}",
151+
"{s}: object file was built for newer platform version: expected {f}, got {f}",
152152
.{
153153
self.path,
154154
plat.version,

src/MachO.zig

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ fn classifyInputFile(self: *MachO, obj: LinkObject) !void {
589589
const tracy = trace(@src());
590590
defer tracy.end();
591591

592-
log.debug("parsing positional {}", .{obj});
592+
log.debug("parsing positional {f}", .{obj});
593593

594594
const file = try std.fs.cwd().openFile(obj.path, .{});
595595
const fh = try self.addFileHandle(file);
@@ -810,10 +810,9 @@ fn parseDylibWorker(self: *MachO, index: File.Index) void {
810810
dylib.parse(self) catch |err| {
811811
switch (err) {
812812
error.ParseFailed => {}, // reported already
813-
else => |e| self.fatal("{s}: unexpected error occurred while parsing input file: {s}: {f}", .{
813+
else => |e| self.fatal("{s}: unexpected error occurred while parsing input file: {s}", .{
814814
dylib.path,
815815
@errorName(e),
816-
@errorReturnTrace(),
817816
}),
818817
}
819818
_ = self.has_errors.swap(true, .seq_cst);
@@ -869,7 +868,7 @@ fn dedupDylibs(self: *MachO, resolved_objects: []const LinkObject) !void {
869868
if (!gop.found_existing) continue;
870869

871870
if (cmd_object.tag == .lib) {
872-
self.warn("ignoring duplicate libraries: {}", .{cmd_object});
871+
self.warn("ignoring duplicate libraries: {f}", .{cmd_object});
873872
}
874873

875874
marker.* = true;
@@ -1296,12 +1295,12 @@ fn reportDuplicates(self: *MachO) error{ HasDuplicates, OutOfMemory }!void {
12961295
const err = try self.addErrorWithNotes(nnotes + 1);
12971296
defer err.unlock();
12981297
try err.addMsg("duplicate symbol definition: {s}", .{sym.getName(self)});
1299-
try err.addNote("defined by {}", .{sym.getFile(self).fmtPath()});
1298+
try err.addNote("defined by {f}", .{sym.getFile(self).fmtPath()});
13001299

13011300
var inote: usize = 0;
13021301
while (inote < @min(notes.items.len, max_notes)) : (inote += 1) {
13031302
const file = self.getFile(notes.items[inote]);
1304-
try err.addNote("defined by {}", .{file.fmtPath()});
1303+
try err.addNote("defined by {f}", .{file.fmtPath()});
13051304
}
13061305

13071306
if (notes.items.len > max_notes) {
@@ -1441,7 +1440,7 @@ fn reportUndefs(self: *MachO) !void {
14411440
const ref = refs.items[inote].unwrap().?;
14421441
const file = self.getFile(ref.file);
14431442
const atom = file.getAtom(ref.atom);
1444-
try err.addNote("referenced by {}:{s}", .{ file.fmtPath(), atom.getName(self) });
1443+
try err.addNote("referenced by {f}:{s}", .{ file.fmtPath(), atom.getName(self) });
14451444
}
14461445

14471446
if (refs.items.len > max_notes) {
@@ -3082,7 +3081,7 @@ fn formatSegments(self: *MachO, writer: *Writer) Writer.Error!void {
30823081
}
30833082
}
30843083

3085-
pub fn fmtSectType(tt: u8) std.fmt.Formatter(*MachO, formatSectType) {
3084+
pub fn fmtSectType(tt: u8) std.fmt.Formatter(u8, formatSectType) {
30863085
return .{ .data = tt };
30873086
}
30883087

src/Object.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ pub fn parse(self: *Object, macho_file: *MachO) !void {
175175
if (match) |this_plat| {
176176
if (this_plat.version.value > plat.version.value) {
177177
macho_file.warn(
178-
"{f}: object file was built for newer platform version: expected {}, got {}",
178+
"{f}: object file was built for newer platform version: expected {f}, got {f}",
179179
.{
180180
self.fmtPath(),
181181
plat.version,

src/dyld_info/Trie.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,9 @@ const Edge = struct {
336336
fn expectEqualHexStrings(expected: []const u8, given: []const u8) !void {
337337
assert(expected.len > 0);
338338
if (mem.eql(u8, expected, given)) return;
339-
const expected_fmt = try std.fmt.allocPrint(testing.allocator, "{x}", .{std.fmt.fmtSliceHexLower(expected)});
339+
const expected_fmt = try std.fmt.allocPrint(testing.allocator, "{x}", .{expected});
340340
defer testing.allocator.free(expected_fmt);
341-
const given_fmt = try std.fmt.allocPrint(testing.allocator, "{x}", .{std.fmt.fmtSliceHexLower(given)});
341+
const given_fmt = try std.fmt.allocPrint(testing.allocator, "{x}", .{given});
342342
defer testing.allocator.free(given_fmt);
343343
const idx = mem.indexOfDiff(u8, expected_fmt, given_fmt).?;
344344
const padding = try testing.allocator.alloc(u8, idx + 5);

src/file.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub const File = union(enum) {
1616
fn formatPath(file: File, writer: *std.Io.Writer) std.Io.Writer.Error!void {
1717
switch (file) {
1818
.internal => try writer.writeAll(""),
19-
.object => |x| try writer.print("{}", .{x.fmtPath()}),
19+
.object => |x| try writer.print("{f}", .{x.fmtPath()}),
2020
.dylib => |x| try writer.writeAll(x.path),
2121
}
2222
}

src/relocatable.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ fn stripLocalsWorker(object: *Object, macho_file: *MachO) void {
229229
const tracy = trace(@src());
230230
defer tracy.end();
231231
object.stripLocalsRelocatable(macho_file) catch |err| {
232-
macho_file.fatal("failed to strip local symbols in object {}: {s}", .{
232+
macho_file.fatal("failed to strip local symbols in object {f}: {s}", .{
233233
object.fmtPath(),
234234
@errorName(err),
235235
});

test/macho.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,7 @@ fn testHelloZig(b: *Build, opts: Options) *Step {
15681568
obj.addZigSource(
15691569
\\const std = @import("std");
15701570
\\pub fn main() void {
1571-
\\ std.io.getStdOut().writer().print("Hello world!\n", .{}) catch unreachable;
1571+
\\ std.fs.File.stdout().writeAll("Hello world!\n") catch unreachable;
15721572
\\}
15731573
);
15741574
obj.addArg("-fno-stack-check"); // TODO find a way to include Zig's crt

0 commit comments

Comments
 (0)