| author | |
| committer | |
| log | 30c2921eb87c3157d52edd7d8ee874209a0f7538 |
| tree | 876d4864abe53e1b43afa87b6e0f61572179ff86 |
| parent | d09b99d043cc097de569fb32938a423342490a83 |
57 files changed, 432 insertions(+), 514 deletions(-)
lib/compiler/aro/aro/Diagnostics.zig+7-6| ... | @@ -324,7 +324,8 @@ pub fn addExtra( | ... | @@ -324,7 +324,8 @@ pub fn addExtra( |
| 324 | 324 | ||
| 325 | pub fn render(comp: *Compilation, config: std.io.tty.Config) void { | 325 | pub fn render(comp: *Compilation, config: std.io.tty.Config) void { |
| 326 | if (comp.diagnostics.list.items.len == 0) return; | 326 | if (comp.diagnostics.list.items.len == 0) return; |
| 327 | var m = defaultMsgWriter(config); | 327 | var buffer: [1000]u8 = undefined; |
| 328 | var m = defaultMsgWriter(config, &buffer); | ||
| 328 | defer m.deinit(); | 329 | defer m.deinit(); |
| 329 | renderMessages(comp, &m); | 330 | renderMessages(comp, &m); |
| 330 | } | 331 | } |
| ... | @@ -525,12 +526,12 @@ fn tagKind(d: *Diagnostics, tag: Tag, langopts: LangOpts) Kind { | ... | @@ -525,12 +526,12 @@ fn tagKind(d: *Diagnostics, tag: Tag, langopts: LangOpts) Kind { |
| 525 | } | 526 | } |
| 526 | 527 | ||
| 527 | const MsgWriter = struct { | 528 | const MsgWriter = struct { |
| 528 | w: *std.fs.File.Writer, | 529 | writer: *std.io.Writer, |
| 529 | config: std.io.tty.Config, | 530 | config: std.io.tty.Config, |
| 530 | 531 | ||
| 531 | fn init(config: std.io.tty.Config, buffer: []u8) MsgWriter { | 532 | fn init(config: std.io.tty.Config, buffer: []u8) MsgWriter { |
| 532 | return .{ | 533 | return .{ |
| 533 | .w = std.debug.lockStderrWriter(buffer), | 534 | .writer = std.debug.lockStderrWriter(buffer), |
| 534 | .config = config, | 535 | .config = config, |
| 535 | }; | 536 | }; |
| 536 | } | 537 | } |
| ... | @@ -541,15 +542,15 @@ const MsgWriter = struct { | ... | @@ -541,15 +542,15 @@ const MsgWriter = struct { |
| 541 | } | 542 | } |
| 542 | 543 | ||
| 543 | pub fn print(m: *MsgWriter, comptime fmt: []const u8, args: anytype) void { | 544 | pub fn print(m: *MsgWriter, comptime fmt: []const u8, args: anytype) void { |
| 544 | m.w.interface.print(fmt, args) catch {}; | 545 | m.writer.print(fmt, args) catch {}; |
| 545 | } | 546 | } |
| 546 | 547 | ||
| 547 | fn write(m: *MsgWriter, msg: []const u8) void { | 548 | fn write(m: *MsgWriter, msg: []const u8) void { |
| 548 | m.w.interface.writeAll(msg) catch {}; | 549 | m.writer.writeAll(msg) catch {}; |
| 549 | } | 550 | } |
| 550 | 551 | ||
| 551 | fn setColor(m: *MsgWriter, color: std.io.tty.Color) void { | 552 | fn setColor(m: *MsgWriter, color: std.io.tty.Color) void { |
| 552 | m.config.setColor(m.w.interface, color) catch {}; | 553 | m.config.setColor(m.writer, color) catch {}; |
| 553 | } | 554 | } |
| 554 | 555 | ||
| 555 | fn location(m: *MsgWriter, path: []const u8, line: u32, col: u32) void { | 556 | fn location(m: *MsgWriter, path: []const u8, line: u32, col: u32) void { |
lib/compiler/aro/aro/Value.zig+2-1| ... | @@ -961,7 +961,8 @@ pub fn print(v: Value, ty: Type, comp: *const Compilation, w: anytype) @TypeOf(w | ... | @@ -961,7 +961,8 @@ pub fn print(v: Value, ty: Type, comp: *const Compilation, w: anytype) @TypeOf(w |
| 961 | switch (key) { | 961 | switch (key) { |
| 962 | .null => return w.writeAll("nullptr_t"), | 962 | .null => return w.writeAll("nullptr_t"), |
| 963 | .int => |repr| switch (repr) { | 963 | .int => |repr| switch (repr) { |
| 964 | inline else => |x| return w.print("{fd}", .{x}), | 964 | inline .u64, .i64 => |x| return w.print("{d}", .{x}), |
| 965 | .big_int => |x| return w.print("{fd}", .{x}), | ||
| 965 | }, | 966 | }, |
| 966 | .float => |repr| switch (repr) { | 967 | .float => |repr| switch (repr) { |
| 967 | .f16 => |x| return w.print("{d}", .{@round(@as(f64, @floatCast(x)) * 1000) / 1000}), | 968 | .f16 => |x| return w.print("{d}", .{@round(@as(f64, @floatCast(x)) * 1000) / 1000}), |
lib/std/io/Writer.zig+4| ... | @@ -881,6 +881,10 @@ pub fn printValue( | ... | @@ -881,6 +881,10 @@ pub fn printValue( |
| 881 | return; | 881 | return; |
| 882 | }, | 882 | }, |
| 883 | .@"union" => |info| { | 883 | .@"union" => |info| { |
| 884 | if (fmt.len == 1 and fmt[0] == 's') { | ||
| 885 | try w.writeAll(@tagName(value)); | ||
| 886 | return; | ||
| 887 | } | ||
| 884 | if (!is_any) { | 888 | if (!is_any) { |
| 885 | if (fmt.len != 0) invalidFmtError(fmt, value); | 889 | if (fmt.len != 0) invalidFmtError(fmt, value); |
| 886 | return printValue(w, ANY, options, value, max_depth); | 890 | return printValue(w, ANY, options, value, max_depth); |
lib/std/zig/AstGen.zig+1-7| ... | @@ -11305,13 +11305,7 @@ fn failWithStrLitError( | ... | @@ -11305,13 +11305,7 @@ fn failWithStrLitError( |
| 11305 | offset: u32, | 11305 | offset: u32, |
| 11306 | ) InnerError { | 11306 | ) InnerError { |
| 11307 | const raw_string = bytes[offset..]; | 11307 | const raw_string = bytes[offset..]; |
| 11308 | return failOff( | 11308 | return failOff(astgen, token, @intCast(offset + err.offset()), "{f}", .{err.fmt(raw_string)}); |
| 11309 | astgen, | ||
| 11310 | token, | ||
| 11311 | @intCast(offset + err.offset()), | ||
| 11312 | "{}", | ||
| 11313 | .{err.fmt(raw_string)}, | ||
| 11314 | ); | ||
| 11315 | } | 11309 | } |
| 11316 | 11310 | ||
| 11317 | fn failNode( | 11311 | fn failNode( |
lib/std/zig/llvm/Builder.zig+42-28| ... | @@ -1155,8 +1155,11 @@ pub const Attribute = union(Kind) { | ... | @@ -1155,8 +1155,11 @@ pub const Attribute = union(Kind) { |
| 1155 | const FormatData = struct { | 1155 | const FormatData = struct { |
| 1156 | attribute_index: Index, | 1156 | attribute_index: Index, |
| 1157 | builder: *const Builder, | 1157 | builder: *const Builder, |
| 1158 | mode: Mode, | 1158 | flags: Flags = .{}, |
| 1159 | const Mode = enum { default, quote, pound }; | 1159 | const Flags = struct { |
| 1160 | pound: bool = false, | ||
| 1161 | quote: bool = false, | ||
| 1162 | }; | ||
| 1160 | }; | 1163 | }; |
| 1161 | fn format(data: FormatData, w: *Writer) Writer.Error!void { | 1164 | fn format(data: FormatData, w: *Writer) Writer.Error!void { |
| 1162 | const attribute = data.attribute_index.toAttribute(data.builder); | 1165 | const attribute = data.attribute_index.toAttribute(data.builder); |
| ... | @@ -1262,11 +1265,12 @@ pub const Attribute = union(Kind) { | ... | @@ -1262,11 +1265,12 @@ pub const Attribute = union(Kind) { |
| 1262 | try w.writeByte(')'); | 1265 | try w.writeByte(')'); |
| 1263 | }, | 1266 | }, |
| 1264 | .alignstack => |alignment| { | 1267 | .alignstack => |alignment| { |
| 1265 | try w.print(" {f}", .{attribute}); | 1268 | try w.print(" {s}", .{attribute}); |
| 1266 | const alignment_bytes = alignment.toByteUnits() orelse return; | 1269 | const alignment_bytes = alignment.toByteUnits() orelse return; |
| 1267 | switch (data.mode) { | 1270 | if (data.flags.pound) { |
| 1268 | .pound => try w.print("({d})", .{alignment_bytes}), | 1271 | try w.print("={d}", .{alignment_bytes}); |
| 1269 | else => try w.print("={d}", .{alignment_bytes}), | 1272 | } else { |
| 1273 | try w.print("({d})", .{alignment_bytes}); | ||
| 1270 | } | 1274 | } |
| 1271 | }, | 1275 | }, |
| 1272 | .allockind => |allockind| { | 1276 | .allockind => |allockind| { |
| ... | @@ -1313,7 +1317,7 @@ pub const Attribute = union(Kind) { | ... | @@ -1313,7 +1317,7 @@ pub const Attribute = union(Kind) { |
| 1313 | vscale_range.min.toByteUnits().?, | 1317 | vscale_range.min.toByteUnits().?, |
| 1314 | vscale_range.max.toByteUnits() orelse 0, | 1318 | vscale_range.max.toByteUnits() orelse 0, |
| 1315 | }), | 1319 | }), |
| 1316 | .string => |string_attr| if (data.mode == .quote) { | 1320 | .string => |string_attr| if (data.flags.quote) { |
| 1317 | try w.print(" {f}", .{string_attr.kind.fmtQ(data.builder)}); | 1321 | try w.print(" {f}", .{string_attr.kind.fmtQ(data.builder)}); |
| 1318 | if (string_attr.value != .empty) | 1322 | if (string_attr.value != .empty) |
| 1319 | try w.print("={f}", .{string_attr.value.fmtQ(data.builder)}); | 1323 | try w.print("={f}", .{string_attr.value.fmtQ(data.builder)}); |
| ... | @@ -1595,16 +1599,18 @@ pub const Attributes = enum(u32) { | ... | @@ -1595,16 +1599,18 @@ pub const Attributes = enum(u32) { |
| 1595 | const FormatData = struct { | 1599 | const FormatData = struct { |
| 1596 | attributes: Attributes, | 1600 | attributes: Attributes, |
| 1597 | builder: *const Builder, | 1601 | builder: *const Builder, |
| 1602 | flags: Flags = .{}, | ||
| 1603 | const Flags = Attribute.Index.FormatData.Flags; | ||
| 1598 | }; | 1604 | }; |
| 1599 | fn format(data: FormatData, w: *Writer) Writer.Error!void { | 1605 | fn format(data: FormatData, w: *Writer) Writer.Error!void { |
| 1600 | for (data.attributes.slice(data.builder)) |attribute_index| try Attribute.Index.format(.{ | 1606 | for (data.attributes.slice(data.builder)) |attribute_index| try Attribute.Index.format(.{ |
| 1601 | .attribute_index = attribute_index, | 1607 | .attribute_index = attribute_index, |
| 1602 | .builder = data.builder, | 1608 | .builder = data.builder, |
| 1603 | .mode = .default, | 1609 | .flags = data.flags, |
| 1604 | }, w); | 1610 | }, w); |
| 1605 | } | 1611 | } |
| 1606 | pub fn fmt(self: Attributes, builder: *const Builder) std.fmt.Formatter(FormatData, format) { | 1612 | pub fn fmt(self: Attributes, builder: *const Builder, flags: FormatData.Flags) std.fmt.Formatter(FormatData, format) { |
| 1607 | return .{ .data = .{ .attributes = self, .builder = builder } }; | 1613 | return .{ .data = .{ .attributes = self, .builder = builder, .flags = flags } }; |
| 1608 | } | 1614 | } |
| 1609 | }; | 1615 | }; |
| 1610 | 1616 | ||
| ... | @@ -1808,7 +1814,8 @@ pub const Preemption = enum { | ... | @@ -1808,7 +1814,8 @@ pub const Preemption = enum { |
| 1808 | dso_local, | 1814 | dso_local, |
| 1809 | implicit_dso_local, | 1815 | implicit_dso_local, |
| 1810 | 1816 | ||
| 1811 | pub fn format(self: Preemption, w: *Writer, comptime _: []const u8) Writer.Error!void { | 1817 | pub fn format(self: Preemption, w: *Writer, comptime f: []const u8) Writer.Error!void { |
| 1818 | comptime assert(f.len == 0); | ||
| 1812 | if (self == .dso_local) try w.print(" {s}", .{@tagName(self)}); | 1819 | if (self == .dso_local) try w.print(" {s}", .{@tagName(self)}); |
| 1813 | } | 1820 | } |
| 1814 | }; | 1821 | }; |
| ... | @@ -1826,8 +1833,8 @@ pub const Visibility = enum(u2) { | ... | @@ -1826,8 +1833,8 @@ pub const Visibility = enum(u2) { |
| 1826 | }; | 1833 | }; |
| 1827 | } | 1834 | } |
| 1828 | 1835 | ||
| 1829 | pub fn format(self: Visibility, comptime format_string: []const u8, writer: *Writer) Writer.Error!void { | 1836 | pub fn format(self: Visibility, writer: *Writer, comptime f: []const u8) Writer.Error!void { |
| 1830 | comptime assert(format_string.len == 0); | 1837 | comptime assert(f.len == 0); |
| 1831 | if (self != .default) try writer.print(" {s}", .{@tagName(self)}); | 1838 | if (self != .default) try writer.print(" {s}", .{@tagName(self)}); |
| 1832 | } | 1839 | } |
| 1833 | }; | 1840 | }; |
| ... | @@ -1837,7 +1844,8 @@ pub const DllStorageClass = enum(u2) { | ... | @@ -1837,7 +1844,8 @@ pub const DllStorageClass = enum(u2) { |
| 1837 | dllimport = 1, | 1844 | dllimport = 1, |
| 1838 | dllexport = 2, | 1845 | dllexport = 2, |
| 1839 | 1846 | ||
| 1840 | pub fn format(self: DllStorageClass, w: *Writer, comptime _: []const u8) Writer.Error!void { | 1847 | pub fn format(self: DllStorageClass, w: *Writer, comptime f: []const u8) Writer.Error!void { |
| 1848 | comptime assert(f.len == 0); | ||
| 1841 | if (self != .default) try w.print(" {s}", .{@tagName(self)}); | 1849 | if (self != .default) try w.print(" {s}", .{@tagName(self)}); |
| 1842 | } | 1850 | } |
| 1843 | }; | 1851 | }; |
| ... | @@ -1863,7 +1871,8 @@ pub const UnnamedAddr = enum(u2) { | ... | @@ -1863,7 +1871,8 @@ pub const UnnamedAddr = enum(u2) { |
| 1863 | unnamed_addr = 1, | 1871 | unnamed_addr = 1, |
| 1864 | local_unnamed_addr = 2, | 1872 | local_unnamed_addr = 2, |
| 1865 | 1873 | ||
| 1866 | pub fn format(self: UnnamedAddr, w: *Writer, comptime _: []const u8) Writer.Error!void { | 1874 | pub fn format(self: UnnamedAddr, w: *Writer, comptime f: []const u8) Writer.Error!void { |
| 1875 | comptime assert(f.len == 0); | ||
| 1867 | if (self != .default) try w.print(" {s}", .{@tagName(self)}); | 1876 | if (self != .default) try w.print(" {s}", .{@tagName(self)}); |
| 1868 | } | 1877 | } |
| 1869 | }; | 1878 | }; |
| ... | @@ -1966,7 +1975,8 @@ pub const ExternallyInitialized = enum { | ... | @@ -1966,7 +1975,8 @@ pub const ExternallyInitialized = enum { |
| 1966 | default, | 1975 | default, |
| 1967 | externally_initialized, | 1976 | externally_initialized, |
| 1968 | 1977 | ||
| 1969 | pub fn format(self: ExternallyInitialized, w: *Writer, comptime _: []const u8) Writer.Error!void { | 1978 | pub fn format(self: ExternallyInitialized, w: *Writer, comptime f: []const u8) Writer.Error!void { |
| 1979 | comptime assert(f.len == 0); | ||
| 1970 | if (self != .default) try w.print(" {s}", .{@tagName(self)}); | 1980 | if (self != .default) try w.print(" {s}", .{@tagName(self)}); |
| 1971 | } | 1981 | } |
| 1972 | }; | 1982 | }; |
| ... | @@ -2064,7 +2074,8 @@ pub const CallConv = enum(u10) { | ... | @@ -2064,7 +2074,8 @@ pub const CallConv = enum(u10) { |
| 2064 | 2074 | ||
| 2065 | pub const default = CallConv.ccc; | 2075 | pub const default = CallConv.ccc; |
| 2066 | 2076 | ||
| 2067 | pub fn format(self: CallConv, w: *Writer, comptime _: []const u8) Writer.Error!void { | 2077 | pub fn format(self: CallConv, w: *Writer, comptime f: []const u8) Writer.Error!void { |
| 2078 | comptime assert(f.len == 0); | ||
| 2068 | switch (self) { | 2079 | switch (self) { |
| 2069 | default => {}, | 2080 | default => {}, |
| 2070 | .fastcc, | 2081 | .fastcc, |
| ... | @@ -7958,7 +7969,8 @@ pub const Metadata = enum(u32) { | ... | @@ -7958,7 +7969,8 @@ pub const Metadata = enum(u32) { |
| 7958 | AllCallsDescribed: bool = false, | 7969 | AllCallsDescribed: bool = false, |
| 7959 | Unused: u2 = 0, | 7970 | Unused: u2 = 0, |
| 7960 | 7971 | ||
| 7961 | pub fn format(self: DIFlags, w: *Writer, comptime _: []const u8) Writer.Error!void { | 7972 | pub fn format(self: DIFlags, w: *Writer, comptime f: []const u8) Writer.Error!void { |
| 7973 | comptime assert(f.len == 0); | ||
| 7962 | var need_pipe = false; | 7974 | var need_pipe = false; |
| 7963 | inline for (@typeInfo(DIFlags).@"struct".fields) |field| { | 7975 | inline for (@typeInfo(DIFlags).@"struct".fields) |field| { |
| 7964 | switch (@typeInfo(field.type)) { | 7976 | switch (@typeInfo(field.type)) { |
| ... | @@ -8015,7 +8027,8 @@ pub const Metadata = enum(u32) { | ... | @@ -8015,7 +8027,8 @@ pub const Metadata = enum(u32) { |
| 8015 | ObjCDirect: bool = false, | 8027 | ObjCDirect: bool = false, |
| 8016 | Unused: u20 = 0, | 8028 | Unused: u20 = 0, |
| 8017 | 8029 | ||
| 8018 | pub fn format(self: DISPFlags, w: *Writer, comptime _: []const u8) Writer.Error!void { | 8030 | pub fn format(self: DISPFlags, w: *Writer, comptime f: []const u8) Writer.Error!void { |
| 8031 | comptime assert(f.len == 0); | ||
| 8019 | var need_pipe = false; | 8032 | var need_pipe = false; |
| 8020 | inline for (@typeInfo(DISPFlags).@"struct".fields) |field| { | 8033 | inline for (@typeInfo(DISPFlags).@"struct".fields) |field| { |
| 8021 | switch (@typeInfo(field.type)) { | 8034 | switch (@typeInfo(field.type)) { |
| ... | @@ -9469,8 +9482,9 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void | ... | @@ -9469,8 +9482,9 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 9469 | \\ | 9482 | \\ |
| 9470 | , .{ | 9483 | , .{ |
| 9471 | variable.global.fmt(self), | 9484 | variable.global.fmt(self), |
| 9472 | Linkage.fmtOptional(if (global.linkage == .external and | 9485 | Linkage.fmtOptional( |
| 9473 | variable.init != .no_init) null else global.linkage), | 9486 | if (global.linkage == .external and variable.init != .no_init) null else global.linkage, |
| 9487 | ), | ||
| 9474 | global.preemption, | 9488 | global.preemption, |
| 9475 | global.visibility, | 9489 | global.visibility, |
| 9476 | global.dll_storage_class, | 9490 | global.dll_storage_class, |
| ... | @@ -9525,7 +9539,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void | ... | @@ -9525,7 +9539,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 9525 | if (function_attributes != .none) try w.print( | 9539 | if (function_attributes != .none) try w.print( |
| 9526 | \\; Function Attrs:{f} | 9540 | \\; Function Attrs:{f} |
| 9527 | \\ | 9541 | \\ |
| 9528 | , .{function_attributes.fmt(self)}); | 9542 | , .{function_attributes.fmt(self, .{})}); |
| 9529 | try w.print( | 9543 | try w.print( |
| 9530 | \\{s}{f}{f}{f}{f}{f}{f} {f} {f}( | 9544 | \\{s}{f}{f}{f}{f}{f}{f} {f} {f}( |
| 9531 | , .{ | 9545 | , .{ |
| ... | @@ -9535,7 +9549,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void | ... | @@ -9535,7 +9549,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 9535 | global.visibility, | 9549 | global.visibility, |
| 9536 | global.dll_storage_class, | 9550 | global.dll_storage_class, |
| 9537 | function.call_conv, | 9551 | function.call_conv, |
| 9538 | function.attributes.ret(self).fmt(self), | 9552 | function.attributes.ret(self).fmt(self, .{}), |
| 9539 | global.type.functionReturn(self).fmt(self, .percent), | 9553 | global.type.functionReturn(self).fmt(self, .percent), |
| 9540 | function.global.fmt(self), | 9554 | function.global.fmt(self), |
| 9541 | }); | 9555 | }); |
| ... | @@ -9545,7 +9559,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void | ... | @@ -9545,7 +9559,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 9545 | \\{f}{f} | 9559 | \\{f}{f} |
| 9546 | , .{ | 9560 | , .{ |
| 9547 | global.type.functionParameters(self)[arg].fmt(self, .percent), | 9561 | global.type.functionParameters(self)[arg].fmt(self, .percent), |
| 9548 | function.attributes.param(arg, self).fmt(self), | 9562 | function.attributes.param(arg, self).fmt(self, .{}), |
| 9549 | }); | 9563 | }); |
| 9550 | if (function.instructions.len > 0) | 9564 | if (function.instructions.len > 0) |
| 9551 | try w.print(" {f}", .{function.arg(@intCast(arg)).fmt(function_index, self, .{})}) | 9565 | try w.print(" {f}", .{function.arg(@intCast(arg)).fmt(function_index, self, .{})}) |
| ... | @@ -9790,7 +9804,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void | ... | @@ -9790,7 +9804,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 9790 | try w.print("{s}{f}{f}{f} {f} {f}(", .{ | 9804 | try w.print("{s}{f}{f}{f} {f} {f}(", .{ |
| 9791 | @tagName(tag), | 9805 | @tagName(tag), |
| 9792 | extra.data.info.call_conv, | 9806 | extra.data.info.call_conv, |
| 9793 | extra.data.attributes.ret(self).fmt(self), | 9807 | extra.data.attributes.ret(self).fmt(self, .{}), |
| 9794 | extra.data.callee.typeOf(function_index, self).pointerAddrSpace(self), | 9808 | extra.data.callee.typeOf(function_index, self).pointerAddrSpace(self), |
| 9795 | switch (extra.data.ty.functionKind(self)) { | 9809 | switch (extra.data.ty.functionKind(self)) { |
| 9796 | .normal => ret_ty, | 9810 | .normal => ret_ty, |
| ... | @@ -9804,7 +9818,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void | ... | @@ -9804,7 +9818,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 9804 | defer metadata_formatter.need_comma = undefined; | 9818 | defer metadata_formatter.need_comma = undefined; |
| 9805 | try w.print("{f}{f}{f}", .{ | 9819 | try w.print("{f}{f}{f}", .{ |
| 9806 | arg.typeOf(function_index, self).fmt(self, .percent), | 9820 | arg.typeOf(function_index, self).fmt(self, .percent), |
| 9807 | extra.data.attributes.param(arg_index, self).fmt(self), | 9821 | extra.data.attributes.param(arg_index, self).fmt(self, .{}), |
| 9808 | try metadata_formatter.fmtLocal(" ", arg, function_index), | 9822 | try metadata_formatter.fmtLocal(" ", arg, function_index), |
| 9809 | }); | 9823 | }); |
| 9810 | } | 9824 | } |
| ... | @@ -10074,9 +10088,9 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void | ... | @@ -10074,9 +10088,9 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 10074 | if (need_newline) try w.writeByte('\n') else need_newline = true; | 10088 | if (need_newline) try w.writeByte('\n') else need_newline = true; |
| 10075 | for (0.., attribute_groups.keys()) |attribute_group_index, attribute_group| | 10089 | for (0.., attribute_groups.keys()) |attribute_group_index, attribute_group| |
| 10076 | try w.print( | 10090 | try w.print( |
| 10077 | \\attributes #{d} = {{{f#"} }} | 10091 | \\attributes #{d} = {{{f} }} |
| 10078 | \\ | 10092 | \\ |
| 10079 | , .{ attribute_group_index, attribute_group.fmt(self) }); | 10093 | , .{ attribute_group_index, attribute_group.fmt(self, .{ .pound = true, .quote = true }) }); |
| 10080 | } | 10094 | } |
| 10081 | 10095 | ||
| 10082 | if (self.metadata_named.count() > 0) { | 10096 | if (self.metadata_named.count() > 0) { |
src/Air/Liveness.zig+5-3| ... | @@ -1323,7 +1323,7 @@ fn analyzeOperands( | ... | @@ -1323,7 +1323,7 @@ fn analyzeOperands( |
| 1323 | const mask = @as(Bpi, 1) << @as(OperandInt, @intCast(i)); | 1323 | const mask = @as(Bpi, 1) << @as(OperandInt, @intCast(i)); |
| 1324 | 1324 | ||
| 1325 | if ((try data.live_set.fetchPut(gpa, operand, {})) == null) { | 1325 | if ((try data.live_set.fetchPut(gpa, operand, {})) == null) { |
| 1326 | log.debug("[{}] %{f}: added %{d} to live set (operand dies here)", .{ pass, @intFromEnum(inst), operand }); | 1326 | log.debug("[{}] %{d}: added %{d} to live set (operand dies here)", .{ pass, @intFromEnum(inst), operand }); |
| 1327 | tomb_bits |= mask; | 1327 | tomb_bits |= mask; |
| 1328 | } | 1328 | } |
| 1329 | } | 1329 | } |
| ... | @@ -2036,7 +2036,8 @@ fn fmtInstSet(set: *const std.AutoHashMapUnmanaged(Air.Inst.Index, void)) FmtIns | ... | @@ -2036,7 +2036,8 @@ fn fmtInstSet(set: *const std.AutoHashMapUnmanaged(Air.Inst.Index, void)) FmtIns |
| 2036 | const FmtInstSet = struct { | 2036 | const FmtInstSet = struct { |
| 2037 | set: *const std.AutoHashMapUnmanaged(Air.Inst.Index, void), | 2037 | set: *const std.AutoHashMapUnmanaged(Air.Inst.Index, void), |
| 2038 | 2038 | ||
| 2039 | pub fn format(val: FmtInstSet, comptime _: []const u8, _: std.fmt.FormatOptions, w: anytype) !void { | 2039 | pub fn format(val: FmtInstSet, w: *std.io.Writer, comptime f: []const u8) std.io.Writer.Error!void { |
| 2040 | comptime assert(f.len == 0); | ||
| 2040 | if (val.set.count() == 0) { | 2041 | if (val.set.count() == 0) { |
| 2041 | try w.writeAll("[no instructions]"); | 2042 | try w.writeAll("[no instructions]"); |
| 2042 | return; | 2043 | return; |
| ... | @@ -2056,7 +2057,8 @@ fn fmtInstList(list: []const Air.Inst.Index) FmtInstList { | ... | @@ -2056,7 +2057,8 @@ fn fmtInstList(list: []const Air.Inst.Index) FmtInstList { |
| 2056 | const FmtInstList = struct { | 2057 | const FmtInstList = struct { |
| 2057 | list: []const Air.Inst.Index, | 2058 | list: []const Air.Inst.Index, |
| 2058 | 2059 | ||
| 2059 | pub fn format(val: FmtInstList, comptime _: []const u8, _: std.fmt.FormatOptions, w: anytype) !void { | 2060 | pub fn format(val: FmtInstList, w: *std.io.Writer, comptime f: []const u8) std.io.Writer.Error!void { |
| 2061 | comptime assert(f.len == 0); | ||
| 2060 | if (val.list.len == 0) { | 2062 | if (val.list.len == 0) { |
| 2061 | try w.writeAll("[no instructions]"); | 2063 | try w.writeAll("[no instructions]"); |
| 2062 | return; | 2064 | return; |
src/Air/Liveness/Verify.zig+12-10| ... | @@ -73,7 +73,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { | ... | @@ -73,7 +73,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 73 | .trap, .unreach => { | 73 | .trap, .unreach => { |
| 74 | try self.verifyInstOperands(inst, .{ .none, .none, .none }); | 74 | try self.verifyInstOperands(inst, .{ .none, .none, .none }); |
| 75 | // This instruction terminates the function, so everything should be dead | 75 | // This instruction terminates the function, so everything should be dead |
| 76 | if (self.live.count() > 0) return invalid("%{}: instructions still alive", .{inst}); | 76 | if (self.live.count() > 0) return invalid("%{f}: instructions still alive", .{inst}); |
| 77 | }, | 77 | }, |
| 78 | 78 | ||
| 79 | // unary | 79 | // unary |
| ... | @@ -166,7 +166,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { | ... | @@ -166,7 +166,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 166 | const un_op = data[@intFromEnum(inst)].un_op; | 166 | const un_op = data[@intFromEnum(inst)].un_op; |
| 167 | try self.verifyInstOperands(inst, .{ un_op, .none, .none }); | 167 | try self.verifyInstOperands(inst, .{ un_op, .none, .none }); |
| 168 | // This instruction terminates the function, so everything should be dead | 168 | // This instruction terminates the function, so everything should be dead |
| 169 | if (self.live.count() > 0) return invalid("%{}: instructions still alive", .{inst}); | 169 | if (self.live.count() > 0) return invalid("%{f}: instructions still alive", .{inst}); |
| 170 | }, | 170 | }, |
| 171 | .dbg_var_ptr, | 171 | .dbg_var_ptr, |
| 172 | .dbg_var_val, | 172 | .dbg_var_val, |
| ... | @@ -450,7 +450,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { | ... | @@ -450,7 +450,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 450 | .repeat => { | 450 | .repeat => { |
| 451 | const repeat = data[@intFromEnum(inst)].repeat; | 451 | const repeat = data[@intFromEnum(inst)].repeat; |
| 452 | const expected_live = self.loops.get(repeat.loop_inst) orelse | 452 | const expected_live = self.loops.get(repeat.loop_inst) orelse |
| 453 | return invalid("%{}: loop %{} not in scope", .{ @intFromEnum(inst), @intFromEnum(repeat.loop_inst) }); | 453 | return invalid("%{d}: loop %{d} not in scope", .{ @intFromEnum(inst), @intFromEnum(repeat.loop_inst) }); |
| 454 | 454 | ||
| 455 | try self.verifyMatchingLiveness(repeat.loop_inst, expected_live); | 455 | try self.verifyMatchingLiveness(repeat.loop_inst, expected_live); |
| 456 | }, | 456 | }, |
| ... | @@ -460,7 +460,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { | ... | @@ -460,7 +460,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 460 | try self.verifyOperand(inst, br.operand, self.liveness.operandDies(inst, 0)); | 460 | try self.verifyOperand(inst, br.operand, self.liveness.operandDies(inst, 0)); |
| 461 | 461 | ||
| 462 | const expected_live = self.loops.get(br.block_inst) orelse | 462 | const expected_live = self.loops.get(br.block_inst) orelse |
| 463 | return invalid("%{}: loop %{} not in scope", .{ @intFromEnum(inst), @intFromEnum(br.block_inst) }); | 463 | return invalid("%{d}: loop %{d} not in scope", .{ @intFromEnum(inst), @intFromEnum(br.block_inst) }); |
| 464 | 464 | ||
| 465 | try self.verifyMatchingLiveness(br.block_inst, expected_live); | 465 | try self.verifyMatchingLiveness(br.block_inst, expected_live); |
| 466 | }, | 466 | }, |
| ... | @@ -511,7 +511,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { | ... | @@ -511,7 +511,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 511 | 511 | ||
| 512 | // The same stuff should be alive after the loop as before it. | 512 | // The same stuff should be alive after the loop as before it. |
| 513 | const gop = try self.loops.getOrPut(self.gpa, inst); | 513 | const gop = try self.loops.getOrPut(self.gpa, inst); |
| 514 | if (gop.found_existing) return invalid("%{}: loop already exists", .{@intFromEnum(inst)}); | 514 | if (gop.found_existing) return invalid("%{d}: loop already exists", .{@intFromEnum(inst)}); |
| 515 | defer { | 515 | defer { |
| 516 | var live = self.loops.fetchRemove(inst).?; | 516 | var live = self.loops.fetchRemove(inst).?; |
| 517 | live.value.deinit(self.gpa); | 517 | live.value.deinit(self.gpa); |
| ... | @@ -560,7 +560,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { | ... | @@ -560,7 +560,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 560 | // after the loop as before it. | 560 | // after the loop as before it. |
| 561 | { | 561 | { |
| 562 | const gop = try self.loops.getOrPut(self.gpa, inst); | 562 | const gop = try self.loops.getOrPut(self.gpa, inst); |
| 563 | if (gop.found_existing) return invalid("%{}: loop already exists", .{@intFromEnum(inst)}); | 563 | if (gop.found_existing) return invalid("%{d}: loop already exists", .{@intFromEnum(inst)}); |
| 564 | gop.value_ptr.* = self.live.move(); | 564 | gop.value_ptr.* = self.live.move(); |
| 565 | } | 565 | } |
| 566 | defer { | 566 | defer { |
| ... | @@ -601,9 +601,11 @@ fn verifyOperand(self: *Verify, inst: Air.Inst.Index, op_ref: Air.Inst.Ref, dies | ... | @@ -601,9 +601,11 @@ fn verifyOperand(self: *Verify, inst: Air.Inst.Index, op_ref: Air.Inst.Ref, dies |
| 601 | return; | 601 | return; |
| 602 | }; | 602 | }; |
| 603 | if (dies) { | 603 | if (dies) { |
| 604 | if (!self.live.remove(operand)) return invalid("%{}: dead operand %{} reused and killed again", .{ inst, operand }); | 604 | if (!self.live.remove(operand)) return invalid("%{f}: dead operand %{f} reused and killed again", .{ |
| 605 | inst, operand, | ||
| 606 | }); | ||
| 605 | } else { | 607 | } else { |
| 606 | if (!self.live.contains(operand)) return invalid("%{}: dead operand %{} reused", .{ inst, operand }); | 608 | if (!self.live.contains(operand)) return invalid("%{f}: dead operand %{f} reused", .{ inst, operand }); |
| 607 | } | 609 | } |
| 608 | } | 610 | } |
| 609 | 611 | ||
| ... | @@ -628,9 +630,9 @@ fn verifyInst(self: *Verify, inst: Air.Inst.Index) Error!void { | ... | @@ -628,9 +630,9 @@ fn verifyInst(self: *Verify, inst: Air.Inst.Index) Error!void { |
| 628 | } | 630 | } |
| 629 | 631 | ||
| 630 | fn verifyMatchingLiveness(self: *Verify, block: Air.Inst.Index, live: LiveMap) Error!void { | 632 | fn verifyMatchingLiveness(self: *Verify, block: Air.Inst.Index, live: LiveMap) Error!void { |
| 631 | if (self.live.count() != live.count()) return invalid("%{}: different deaths across branches", .{block}); | 633 | if (self.live.count() != live.count()) return invalid("%{f}: different deaths across branches", .{block}); |
| 632 | var live_it = self.live.keyIterator(); | 634 | var live_it = self.live.keyIterator(); |
| 633 | while (live_it.next()) |live_inst| if (!live.contains(live_inst.*)) return invalid("%{}: different deaths across branches", .{block}); | 635 | while (live_it.next()) |live_inst| if (!live.contains(live_inst.*)) return invalid("%{f}: different deaths across branches", .{block}); |
| 634 | } | 636 | } |
| 635 | 637 | ||
| 636 | fn invalid(comptime fmt: []const u8, args: anytype) error{LivenessInvalid} { | 638 | fn invalid(comptime fmt: []const u8, args: anytype) error{LivenessInvalid} { |
src/Air/print.zig+2-2| ... | @@ -518,7 +518,7 @@ const Writer = struct { | ... | @@ -518,7 +518,7 @@ const Writer = struct { |
| 518 | if (mask_idx > 0) try s.writeAll(", "); | 518 | if (mask_idx > 0) try s.writeAll(", "); |
| 519 | switch (mask_elem.unwrap()) { | 519 | switch (mask_elem.unwrap()) { |
| 520 | .elem => |idx| try s.print("elem {d}", .{idx}), | 520 | .elem => |idx| try s.print("elem {d}", .{idx}), |
| 521 | .value => |val| try s.print("val {}", .{Value.fromInterned(val).fmtValue(w.pt)}), | 521 | .value => |val| try s.print("val {f}", .{Value.fromInterned(val).fmtValue(w.pt)}), |
| 522 | } | 522 | } |
| 523 | } | 523 | } |
| 524 | try s.writeByte(']'); | 524 | try s.writeByte(']'); |
| ... | @@ -590,7 +590,7 @@ const Writer = struct { | ... | @@ -590,7 +590,7 @@ const Writer = struct { |
| 590 | const ip = &w.pt.zcu.intern_pool; | 590 | const ip = &w.pt.zcu.intern_pool; |
| 591 | const ty_nav = w.air.instructions.items(.data)[@intFromEnum(inst)].ty_nav; | 591 | const ty_nav = w.air.instructions.items(.data)[@intFromEnum(inst)].ty_nav; |
| 592 | try w.writeType(s, .fromInterned(ty_nav.ty)); | 592 | try w.writeType(s, .fromInterned(ty_nav.ty)); |
| 593 | try s.print(", '{}'", .{ip.getNav(ty_nav.nav).fqn.fmt(ip)}); | 593 | try s.print(", '{f}'", .{ip.getNav(ty_nav.nav).fqn.fmt(ip)}); |
| 594 | } | 594 | } |
| 595 | 595 | ||
| 596 | fn writeAtomicLoad(w: *Writer, s: *std.io.Writer, inst: Air.Inst.Index) Error!void { | 596 | fn writeAtomicLoad(w: *Writer, s: *std.io.Writer, inst: Air.Inst.Index) Error!void { |
src/Compilation.zig+26-29| ... | @@ -729,10 +729,10 @@ pub const Directories = struct { | ... | @@ -729,10 +729,10 @@ pub const Directories = struct { |
| 729 | }; | 729 | }; |
| 730 | 730 | ||
| 731 | if (std.mem.eql(u8, zig_lib.path orelse "", global_cache.path orelse "")) { | 731 | if (std.mem.eql(u8, zig_lib.path orelse "", global_cache.path orelse "")) { |
| 732 | fatal("zig lib directory '{}' cannot be equal to global cache directory '{}'", .{ zig_lib, global_cache }); | 732 | fatal("zig lib directory '{f}' cannot be equal to global cache directory '{f}'", .{ zig_lib, global_cache }); |
| 733 | } | 733 | } |
| 734 | if (std.mem.eql(u8, zig_lib.path orelse "", local_cache.path orelse "")) { | 734 | if (std.mem.eql(u8, zig_lib.path orelse "", local_cache.path orelse "")) { |
| 735 | fatal("zig lib directory '{}' cannot be equal to local cache directory '{}'", .{ zig_lib, local_cache }); | 735 | fatal("zig lib directory '{f}' cannot be equal to local cache directory '{f}'", .{ zig_lib, local_cache }); |
| 736 | } | 736 | } |
| 737 | 737 | ||
| 738 | return .{ | 738 | return .{ |
| ... | @@ -2698,7 +2698,7 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) !void { | ... | @@ -2698,7 +2698,7 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) !void { |
| 2698 | const prefix = man.cache.prefixes()[pp.prefix]; | 2698 | const prefix = man.cache.prefixes()[pp.prefix]; |
| 2699 | return comp.setMiscFailure( | 2699 | return comp.setMiscFailure( |
| 2700 | .check_whole_cache, | 2700 | .check_whole_cache, |
| 2701 | "failed to check cache: '{}{s}' {s} {s}", | 2701 | "failed to check cache: '{f}{s}' {s} {s}", |
| 2702 | .{ prefix, pp.sub_path, @tagName(man.diagnostic), @errorName(op.err) }, | 2702 | .{ prefix, pp.sub_path, @tagName(man.diagnostic), @errorName(op.err) }, |
| 2703 | ); | 2703 | ); |
| 2704 | }, | 2704 | }, |
| ... | @@ -2915,7 +2915,7 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) !void { | ... | @@ -2915,7 +2915,7 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) !void { |
| 2915 | renameTmpIntoCache(comp.dirs.local_cache, tmp_dir_sub_path, o_sub_path) catch |err| { | 2915 | renameTmpIntoCache(comp.dirs.local_cache, tmp_dir_sub_path, o_sub_path) catch |err| { |
| 2916 | return comp.setMiscFailure( | 2916 | return comp.setMiscFailure( |
| 2917 | .rename_results, | 2917 | .rename_results, |
| 2918 | "failed to rename compilation results ('{}{s}') into local cache ('{}{s}'): {s}", | 2918 | "failed to rename compilation results ('{f}{s}') into local cache ('{f}{s}'): {s}", |
| 2919 | .{ | 2919 | .{ |
| 2920 | comp.dirs.local_cache, tmp_dir_sub_path, | 2920 | comp.dirs.local_cache, tmp_dir_sub_path, |
| 2921 | comp.dirs.local_cache, o_sub_path, | 2921 | comp.dirs.local_cache, o_sub_path, |
| ... | @@ -2982,7 +2982,7 @@ pub fn appendFileSystemInput(comp: *Compilation, path: Compilation.Path) Allocat | ... | @@ -2982,7 +2982,7 @@ pub fn appendFileSystemInput(comp: *Compilation, path: Compilation.Path) Allocat |
| 2982 | break @intCast(i); | 2982 | break @intCast(i); |
| 2983 | } | 2983 | } |
| 2984 | } else std.debug.panic( | 2984 | } else std.debug.panic( |
| 2985 | "missing prefix directory '{s}' ('{}') for '{s}'", | 2985 | "missing prefix directory '{s}' ('{f}') for '{s}'", |
| 2986 | .{ @tagName(path.root), want_prefix_dir, path.sub_path }, | 2986 | .{ @tagName(path.root), want_prefix_dir, path.sub_path }, |
| 2987 | ); | 2987 | ); |
| 2988 | 2988 | ||
| ... | @@ -3321,7 +3321,7 @@ fn emitFromCObject( | ... | @@ -3321,7 +3321,7 @@ fn emitFromCObject( |
| 3321 | emit_path.root_dir.handle, | 3321 | emit_path.root_dir.handle, |
| 3322 | emit_path.sub_path, | 3322 | emit_path.sub_path, |
| 3323 | .{}, | 3323 | .{}, |
| 3324 | ) catch |err| log.err("unable to copy '{}' to '{}': {s}", .{ | 3324 | ) catch |err| log.err("unable to copy '{f}' to '{f}': {s}", .{ |
| 3325 | src_path, | 3325 | src_path, |
| 3326 | emit_path, | 3326 | emit_path, |
| 3327 | @errorName(err), | 3327 | @errorName(err), |
| ... | @@ -3669,7 +3669,7 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle { | ... | @@ -3669,7 +3669,7 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle { |
| 3669 | .illegal_zig_import => try bundle.addString("this compiler implementation does not allow importing files from this directory"), | 3669 | .illegal_zig_import => try bundle.addString("this compiler implementation does not allow importing files from this directory"), |
| 3670 | }, | 3670 | }, |
| 3671 | .src_loc = try bundle.addSourceLocation(.{ | 3671 | .src_loc = try bundle.addSourceLocation(.{ |
| 3672 | .src_path = try bundle.printString("{}", .{file.path.fmt(comp)}), | 3672 | .src_path = try bundle.printString("{f}", .{file.path.fmt(comp)}), |
| 3673 | .span_start = start, | 3673 | .span_start = start, |
| 3674 | .span_main = start, | 3674 | .span_main = start, |
| 3675 | .span_end = @intCast(end), | 3675 | .span_end = @intCast(end), |
| ... | @@ -3716,7 +3716,7 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle { | ... | @@ -3716,7 +3716,7 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle { |
| 3716 | assert(!is_retryable); | 3716 | assert(!is_retryable); |
| 3717 | // AstGen/ZoirGen succeeded with errors. Note that this may include AST errors. | 3717 | // AstGen/ZoirGen succeeded with errors. Note that this may include AST errors. |
| 3718 | _ = try file.getTree(zcu); // Tree must be loaded. | 3718 | _ = try file.getTree(zcu); // Tree must be loaded. |
| 3719 | const path = try std.fmt.allocPrint(gpa, "{}", .{file.path.fmt(comp)}); | 3719 | const path = try std.fmt.allocPrint(gpa, "{f}", .{file.path.fmt(comp)}); |
| 3720 | defer gpa.free(path); | 3720 | defer gpa.free(path); |
| 3721 | if (file.zir != null) { | 3721 | if (file.zir != null) { |
| 3722 | try bundle.addZirErrorMessages(file.zir.?, file.tree.?, file.source.?, path); | 3722 | try bundle.addZirErrorMessages(file.zir.?, file.tree.?, file.source.?, path); |
| ... | @@ -3771,9 +3771,8 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle { | ... | @@ -3771,9 +3771,8 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle { |
| 3771 | if (!refs.contains(anal_unit)) continue; | 3771 | if (!refs.contains(anal_unit)) continue; |
| 3772 | } | 3772 | } |
| 3773 | 3773 | ||
| 3774 | std.log.scoped(.zcu).debug("analysis error '{s}' reported from unit '{}'", .{ | 3774 | std.log.scoped(.zcu).debug("analysis error '{s}' reported from unit '{f}'", .{ |
| 3775 | error_msg.msg, | 3775 | error_msg.msg, zcu.fmtAnalUnit(anal_unit), |
| 3776 | zcu.fmtAnalUnit(anal_unit), | ||
| 3777 | }); | 3776 | }); |
| 3778 | 3777 | ||
| 3779 | try addModuleErrorMsg(zcu, &bundle, error_msg.*, added_any_analysis_error); | 3778 | try addModuleErrorMsg(zcu, &bundle, error_msg.*, added_any_analysis_error); |
| ... | @@ -3933,9 +3932,9 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle { | ... | @@ -3933,9 +3932,9 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle { |
| 3933 | // This is a compiler bug. | 3932 | // This is a compiler bug. |
| 3934 | const stderr = std.fs.File.stderr().deprecatedWriter(); | 3933 | const stderr = std.fs.File.stderr().deprecatedWriter(); |
| 3935 | try stderr.writeAll("referenced transitive analysis errors, but none actually emitted\n"); | 3934 | try stderr.writeAll("referenced transitive analysis errors, but none actually emitted\n"); |
| 3936 | try stderr.print("{} [transitive failure]\n", .{zcu.fmtAnalUnit(failed_unit)}); | 3935 | try stderr.print("{f} [transitive failure]\n", .{zcu.fmtAnalUnit(failed_unit)}); |
| 3937 | while (ref) |r| { | 3936 | while (ref) |r| { |
| 3938 | try stderr.print("referenced by: {}{s}\n", .{ | 3937 | try stderr.print("referenced by: {f}{s}\n", .{ |
| 3939 | zcu.fmtAnalUnit(r.referencer), | 3938 | zcu.fmtAnalUnit(r.referencer), |
| 3940 | if (zcu.transitive_failed_analysis.contains(r.referencer)) " [transitive failure]" else "", | 3939 | if (zcu.transitive_failed_analysis.contains(r.referencer)) " [transitive failure]" else "", |
| 3941 | }); | 3940 | }); |
| ... | @@ -4034,7 +4033,7 @@ pub fn addModuleErrorMsg( | ... | @@ -4034,7 +4033,7 @@ pub fn addModuleErrorMsg( |
| 4034 | const err_src_loc = module_err_msg.src_loc.upgrade(zcu); | 4033 | const err_src_loc = module_err_msg.src_loc.upgrade(zcu); |
| 4035 | const err_source = err_src_loc.file_scope.getSource(zcu) catch |err| { | 4034 | const err_source = err_src_loc.file_scope.getSource(zcu) catch |err| { |
| 4036 | try eb.addRootErrorMessage(.{ | 4035 | try eb.addRootErrorMessage(.{ |
| 4037 | .msg = try eb.printString("unable to load '{}': {s}", .{ | 4036 | .msg = try eb.printString("unable to load '{f}': {s}", .{ |
| 4038 | err_src_loc.file_scope.path.fmt(zcu.comp), @errorName(err), | 4037 | err_src_loc.file_scope.path.fmt(zcu.comp), @errorName(err), |
| 4039 | }), | 4038 | }), |
| 4040 | }); | 4039 | }); |
| ... | @@ -4097,7 +4096,7 @@ pub fn addModuleErrorMsg( | ... | @@ -4097,7 +4096,7 @@ pub fn addModuleErrorMsg( |
| 4097 | } | 4096 | } |
| 4098 | 4097 | ||
| 4099 | const src_loc = try eb.addSourceLocation(.{ | 4098 | const src_loc = try eb.addSourceLocation(.{ |
| 4100 | .src_path = try eb.printString("{}", .{err_src_loc.file_scope.path.fmt(zcu.comp)}), | 4099 | .src_path = try eb.printString("{f}", .{err_src_loc.file_scope.path.fmt(zcu.comp)}), |
| 4101 | .span_start = err_span.start, | 4100 | .span_start = err_span.start, |
| 4102 | .span_main = err_span.main, | 4101 | .span_main = err_span.main, |
| 4103 | .span_end = err_span.end, | 4102 | .span_end = err_span.end, |
| ... | @@ -4129,7 +4128,7 @@ pub fn addModuleErrorMsg( | ... | @@ -4129,7 +4128,7 @@ pub fn addModuleErrorMsg( |
| 4129 | const gop = try notes.getOrPutContext(gpa, .{ | 4128 | const gop = try notes.getOrPutContext(gpa, .{ |
| 4130 | .msg = try eb.addString(module_note.msg), | 4129 | .msg = try eb.addString(module_note.msg), |
| 4131 | .src_loc = try eb.addSourceLocation(.{ | 4130 | .src_loc = try eb.addSourceLocation(.{ |
| 4132 | .src_path = try eb.printString("{}", .{note_src_loc.file_scope.path.fmt(zcu.comp)}), | 4131 | .src_path = try eb.printString("{f}", .{note_src_loc.file_scope.path.fmt(zcu.comp)}), |
| 4133 | .span_start = span.start, | 4132 | .span_start = span.start, |
| 4134 | .span_main = span.main, | 4133 | .span_main = span.main, |
| 4135 | .span_end = span.end, | 4134 | .span_end = span.end, |
| ... | @@ -4174,7 +4173,7 @@ fn addReferenceTraceFrame( | ... | @@ -4174,7 +4173,7 @@ fn addReferenceTraceFrame( |
| 4174 | try ref_traces.append(gpa, .{ | 4173 | try ref_traces.append(gpa, .{ |
| 4175 | .decl_name = try eb.printString("{s}{s}", .{ name, if (inlined) " [inlined]" else "" }), | 4174 | .decl_name = try eb.printString("{s}{s}", .{ name, if (inlined) " [inlined]" else "" }), |
| 4176 | .src_loc = try eb.addSourceLocation(.{ | 4175 | .src_loc = try eb.addSourceLocation(.{ |
| 4177 | .src_path = try eb.printString("{}", .{src.file_scope.path.fmt(zcu.comp)}), | 4176 | .src_path = try eb.printString("{f}", .{src.file_scope.path.fmt(zcu.comp)}), |
| 4178 | .span_start = span.start, | 4177 | .span_start = span.start, |
| 4179 | .span_main = span.main, | 4178 | .span_main = span.main, |
| 4180 | .span_end = span.end, | 4179 | .span_end = span.end, |
| ... | @@ -4835,7 +4834,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void { | ... | @@ -4835,7 +4834,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void { |
| 4835 | var out_dir = docs_path.root_dir.handle.makeOpenPath(docs_path.sub_path, .{}) catch |err| { | 4834 | var out_dir = docs_path.root_dir.handle.makeOpenPath(docs_path.sub_path, .{}) catch |err| { |
| 4836 | return comp.lockAndSetMiscFailure( | 4835 | return comp.lockAndSetMiscFailure( |
| 4837 | .docs_copy, | 4836 | .docs_copy, |
| 4838 | "unable to create output directory '{}': {s}", | 4837 | "unable to create output directory '{f}': {s}", |
| 4839 | .{ docs_path, @errorName(err) }, | 4838 | .{ docs_path, @errorName(err) }, |
| 4840 | ); | 4839 | ); |
| 4841 | }; | 4840 | }; |
| ... | @@ -4855,7 +4854,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void { | ... | @@ -4855,7 +4854,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void { |
| 4855 | var tar_file = out_dir.createFile("sources.tar", .{}) catch |err| { | 4854 | var tar_file = out_dir.createFile("sources.tar", .{}) catch |err| { |
| 4856 | return comp.lockAndSetMiscFailure( | 4855 | return comp.lockAndSetMiscFailure( |
| 4857 | .docs_copy, | 4856 | .docs_copy, |
| 4858 | "unable to create '{}/sources.tar': {s}", | 4857 | "unable to create '{f}/sources.tar': {s}", |
| 4859 | .{ docs_path, @errorName(err) }, | 4858 | .{ docs_path, @errorName(err) }, |
| 4860 | ); | 4859 | ); |
| 4861 | }; | 4860 | }; |
| ... | @@ -4884,7 +4883,7 @@ fn docsCopyModule(comp: *Compilation, module: *Package.Module, name: []const u8, | ... | @@ -4884,7 +4883,7 @@ fn docsCopyModule(comp: *Compilation, module: *Package.Module, name: []const u8, |
| 4884 | const root_dir, const sub_path = root.openInfo(comp.dirs); | 4883 | const root_dir, const sub_path = root.openInfo(comp.dirs); |
| 4885 | break :d root_dir.openDir(sub_path, .{ .iterate = true }); | 4884 | break :d root_dir.openDir(sub_path, .{ .iterate = true }); |
| 4886 | } catch |err| { | 4885 | } catch |err| { |
| 4887 | return comp.lockAndSetMiscFailure(.docs_copy, "unable to open directory '{}': {s}", .{ | 4886 | return comp.lockAndSetMiscFailure(.docs_copy, "unable to open directory '{f}': {s}", .{ |
| 4888 | root.fmt(comp), @errorName(err), | 4887 | root.fmt(comp), @errorName(err), |
| 4889 | }); | 4888 | }); |
| 4890 | }; | 4889 | }; |
| ... | @@ -4906,13 +4905,13 @@ fn docsCopyModule(comp: *Compilation, module: *Package.Module, name: []const u8, | ... | @@ -4906,13 +4905,13 @@ fn docsCopyModule(comp: *Compilation, module: *Package.Module, name: []const u8, |
| 4906 | else => continue, | 4905 | else => continue, |
| 4907 | } | 4906 | } |
| 4908 | var file = mod_dir.openFile(entry.path, .{}) catch |err| { | 4907 | var file = mod_dir.openFile(entry.path, .{}) catch |err| { |
| 4909 | return comp.lockAndSetMiscFailure(.docs_copy, "unable to open '{}{s}': {s}", .{ | 4908 | return comp.lockAndSetMiscFailure(.docs_copy, "unable to open '{f}{s}': {s}", .{ |
| 4910 | root.fmt(comp), entry.path, @errorName(err), | 4909 | root.fmt(comp), entry.path, @errorName(err), |
| 4911 | }); | 4910 | }); |
| 4912 | }; | 4911 | }; |
| 4913 | defer file.close(); | 4912 | defer file.close(); |
| 4914 | archiver.writeFile(entry.path, file) catch |err| { | 4913 | archiver.writeFile(entry.path, file) catch |err| { |
| 4915 | return comp.lockAndSetMiscFailure(.docs_copy, "unable to archive '{}{s}': {s}", .{ | 4914 | return comp.lockAndSetMiscFailure(.docs_copy, "unable to archive '{f}{s}': {s}", .{ |
| 4916 | root.fmt(comp), entry.path, @errorName(err), | 4915 | root.fmt(comp), entry.path, @errorName(err), |
| 4917 | }); | 4916 | }); |
| 4918 | }; | 4917 | }; |
| ... | @@ -5042,7 +5041,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) anye | ... | @@ -5042,7 +5041,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 5042 | var out_dir = docs_path.root_dir.handle.makeOpenPath(docs_path.sub_path, .{}) catch |err| { | 5041 | var out_dir = docs_path.root_dir.handle.makeOpenPath(docs_path.sub_path, .{}) catch |err| { |
| 5043 | return comp.lockAndSetMiscFailure( | 5042 | return comp.lockAndSetMiscFailure( |
| 5044 | .docs_copy, | 5043 | .docs_copy, |
| 5045 | "unable to create output directory '{}': {s}", | 5044 | "unable to create output directory '{f}': {s}", |
| 5046 | .{ docs_path, @errorName(err) }, | 5045 | .{ docs_path, @errorName(err) }, |
| 5047 | ); | 5046 | ); |
| 5048 | }; | 5047 | }; |
| ... | @@ -5054,10 +5053,8 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) anye | ... | @@ -5054,10 +5053,8 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 5054 | "main.wasm", | 5053 | "main.wasm", |
| 5055 | .{}, | 5054 | .{}, |
| 5056 | ) catch |err| { | 5055 | ) catch |err| { |
| 5057 | return comp.lockAndSetMiscFailure(.docs_copy, "unable to copy '{}' to '{}': {s}", .{ | 5056 | return comp.lockAndSetMiscFailure(.docs_copy, "unable to copy '{f}' to '{f}': {s}", .{ |
| 5058 | crt_file.full_object_path, | 5057 | crt_file.full_object_path, docs_path, @errorName(err), |
| 5059 | docs_path, | ||
| 5060 | @errorName(err), | ||
| 5061 | }); | 5058 | }); |
| 5062 | }; | 5059 | }; |
| 5063 | } | 5060 | } |
| ... | @@ -5130,7 +5127,7 @@ fn workerUpdateBuiltinFile(comp: *Compilation, file: *Zcu.File) void { | ... | @@ -5130,7 +5127,7 @@ fn workerUpdateBuiltinFile(comp: *Compilation, file: *Zcu.File) void { |
| 5130 | defer comp.mutex.unlock(); | 5127 | defer comp.mutex.unlock(); |
| 5131 | comp.setMiscFailure( | 5128 | comp.setMiscFailure( |
| 5132 | .write_builtin_zig, | 5129 | .write_builtin_zig, |
| 5133 | "unable to write '{}': {s}", | 5130 | "unable to write '{f}': {s}", |
| 5134 | .{ file.path.fmt(comp), @errorName(err) }, | 5131 | .{ file.path.fmt(comp), @errorName(err) }, |
| 5135 | ); | 5132 | ); |
| 5136 | }; | 5133 | }; |
| ... | @@ -6033,7 +6030,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 | ... | @@ -6033,7 +6030,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 |
| 6033 | // 24 is RT_MANIFEST | 6030 | // 24 is RT_MANIFEST |
| 6034 | const resource_type = 24; | 6031 | const resource_type = 24; |
| 6035 | 6032 | ||
| 6036 | const input = try std.fmt.allocPrint(arena, "{} {} \"{f}\"", .{ | 6033 | const input = try std.fmt.allocPrint(arena, "{d} {d} \"{f}\"", .{ |
| 6037 | resource_id, resource_type, fmtRcEscape(src_path), | 6034 | resource_id, resource_type, fmtRcEscape(src_path), |
| 6038 | }); | 6035 | }); |
| 6039 | 6036 |
src/IncrementalDebugServer.zig+4-4| ... | @@ -142,8 +142,8 @@ fn handleCommand(zcu: *Zcu, output: *std.ArrayListUnmanaged(u8), cmd_str: []cons | ... | @@ -142,8 +142,8 @@ fn handleCommand(zcu: *Zcu, output: *std.ArrayListUnmanaged(u8), cmd_str: []cons |
| 142 | const create_gen = zcu.incremental_debug_state.navs.get(nav_index) orelse return w.writeAll("unknown nav index"); | 142 | const create_gen = zcu.incremental_debug_state.navs.get(nav_index) orelse return w.writeAll("unknown nav index"); |
| 143 | const nav = ip.getNav(nav_index); | 143 | const nav = ip.getNav(nav_index); |
| 144 | try w.print( | 144 | try w.print( |
| 145 | \\name: '{}' | 145 | \\name: '{f}' |
| 146 | \\fqn: '{}' | 146 | \\fqn: '{f}' |
| 147 | \\status: {s} | 147 | \\status: {s} |
| 148 | \\created on generation: {d} | 148 | \\created on generation: {d} |
| 149 | \\ | 149 | \\ |
| ... | @@ -260,7 +260,7 @@ fn handleCommand(zcu: *Zcu, output: *std.ArrayListUnmanaged(u8), cmd_str: []cons | ... | @@ -260,7 +260,7 @@ fn handleCommand(zcu: *Zcu, output: *std.ArrayListUnmanaged(u8), cmd_str: []cons |
| 260 | const ip_index: InternPool.Index = @enumFromInt(parseIndex(arg_str) orelse return w.writeAll("malformed ip index")); | 260 | const ip_index: InternPool.Index = @enumFromInt(parseIndex(arg_str) orelse return w.writeAll("malformed ip index")); |
| 261 | const create_gen = zcu.incremental_debug_state.types.get(ip_index) orelse return w.writeAll("unknown type"); | 261 | const create_gen = zcu.incremental_debug_state.types.get(ip_index) orelse return w.writeAll("unknown type"); |
| 262 | try w.print( | 262 | try w.print( |
| 263 | \\name: '{}' | 263 | \\name: '{f}' |
| 264 | \\created on generation: {d} | 264 | \\created on generation: {d} |
| 265 | \\ | 265 | \\ |
| 266 | , .{ | 266 | , .{ |
| ... | @@ -365,7 +365,7 @@ fn printType(ty: Type, zcu: *const Zcu, w: anytype) !void { | ... | @@ -365,7 +365,7 @@ fn printType(ty: Type, zcu: *const Zcu, w: anytype) !void { |
| 365 | .union_type, | 365 | .union_type, |
| 366 | .enum_type, | 366 | .enum_type, |
| 367 | .opaque_type, | 367 | .opaque_type, |
| 368 | => try w.print("{}[{d}]", .{ ty.containerTypeName(ip).fmt(ip), @intFromEnum(ty.toIntern()) }), | 368 | => try w.print("{f}[{d}]", .{ ty.containerTypeName(ip).fmt(ip), @intFromEnum(ty.toIntern()) }), |
| 369 | 369 | ||
| 370 | else => unreachable, | 370 | else => unreachable, |
| 371 | } | 371 | } |
src/InternPool.zig+1-1| ... | @@ -11406,7 +11406,7 @@ pub fn dumpGenericInstancesFallible(ip: *const InternPool, allocator: Allocator) | ... | @@ -11406,7 +11406,7 @@ pub fn dumpGenericInstancesFallible(ip: *const InternPool, allocator: Allocator) |
| 11406 | var it = instances.iterator(); | 11406 | var it = instances.iterator(); |
| 11407 | while (it.next()) |entry| { | 11407 | while (it.next()) |entry| { |
| 11408 | const generic_fn_owner_nav = ip.getNav(ip.funcDeclInfo(entry.key_ptr.*).owner_nav); | 11408 | const generic_fn_owner_nav = ip.getNav(ip.funcDeclInfo(entry.key_ptr.*).owner_nav); |
| 11409 | try stderr_bw.print("{f} ({}): \n", .{ generic_fn_owner_nav.name.fmt(ip), entry.value_ptr.items.len }); | 11409 | try stderr_bw.print("{f} ({f}): \n", .{ generic_fn_owner_nav.name.fmt(ip), entry.value_ptr.items.len }); |
| 11410 | for (entry.value_ptr.items) |index| { | 11410 | for (entry.value_ptr.items) |index| { |
| 11411 | const unwrapped_index = index.unwrap(ip); | 11411 | const unwrapped_index = index.unwrap(ip); |
| 11412 | const func = ip.extraFuncInstance(unwrapped_index.tid, unwrapped_index.getExtra(ip), unwrapped_index.getData(ip)); | 11412 | const func = ip.extraFuncInstance(unwrapped_index.tid, unwrapped_index.getExtra(ip), unwrapped_index.getData(ip)); |
src/Package/Fetch.zig+11-11| ... | @@ -369,7 +369,7 @@ pub fn run(f: *Fetch) RunError!void { | ... | @@ -369,7 +369,7 @@ pub fn run(f: *Fetch) RunError!void { |
| 369 | if (!std.mem.startsWith(u8, pkg_root.sub_path, expected_prefix)) { | 369 | if (!std.mem.startsWith(u8, pkg_root.sub_path, expected_prefix)) { |
| 370 | return f.fail( | 370 | return f.fail( |
| 371 | f.location_tok, | 371 | f.location_tok, |
| 372 | try eb.printString("dependency path outside project: '{}'", .{pkg_root}), | 372 | try eb.printString("dependency path outside project: '{f}'", .{pkg_root}), |
| 373 | ); | 373 | ); |
| 374 | } | 374 | } |
| 375 | } | 375 | } |
| ... | @@ -436,14 +436,14 @@ pub fn run(f: *Fetch) RunError!void { | ... | @@ -436,14 +436,14 @@ pub fn run(f: *Fetch) RunError!void { |
| 436 | } | 436 | } |
| 437 | if (f.job_queue.read_only) return f.fail( | 437 | if (f.job_queue.read_only) return f.fail( |
| 438 | f.name_tok, | 438 | f.name_tok, |
| 439 | try eb.printString("package not found at '{}{s}'", .{ | 439 | try eb.printString("package not found at '{f}{s}'", .{ |
| 440 | cache_root, pkg_sub_path, | 440 | cache_root, pkg_sub_path, |
| 441 | }), | 441 | }), |
| 442 | ); | 442 | ); |
| 443 | }, | 443 | }, |
| 444 | else => |e| { | 444 | else => |e| { |
| 445 | try eb.addRootErrorMessage(.{ | 445 | try eb.addRootErrorMessage(.{ |
| 446 | .msg = try eb.printString("unable to open global package cache directory '{}{s}': {s}", .{ | 446 | .msg = try eb.printString("unable to open global package cache directory '{f}{s}': {s}", .{ |
| 447 | cache_root, pkg_sub_path, @errorName(e), | 447 | cache_root, pkg_sub_path, @errorName(e), |
| 448 | }), | 448 | }), |
| 449 | }); | 449 | }); |
| ... | @@ -620,7 +620,7 @@ pub fn computedPackageHash(f: *const Fetch) Package.Hash { | ... | @@ -620,7 +620,7 @@ pub fn computedPackageHash(f: *const Fetch) Package.Hash { |
| 620 | const saturated_size = std.math.cast(u32, f.computed_hash.total_size) orelse std.math.maxInt(u32); | 620 | const saturated_size = std.math.cast(u32, f.computed_hash.total_size) orelse std.math.maxInt(u32); |
| 621 | if (f.manifest) |man| { | 621 | if (f.manifest) |man| { |
| 622 | var version_buffer: [32]u8 = undefined; | 622 | var version_buffer: [32]u8 = undefined; |
| 623 | const version: []const u8 = std.fmt.bufPrint(&version_buffer, "{}", .{man.version}) catch &version_buffer; | 623 | const version: []const u8 = std.fmt.bufPrint(&version_buffer, "{f}", .{man.version}) catch &version_buffer; |
| 624 | return .init(f.computed_hash.digest, man.name, version, man.id, saturated_size); | 624 | return .init(f.computed_hash.digest, man.name, version, man.id, saturated_size); |
| 625 | } | 625 | } |
| 626 | // In the future build.zig.zon fields will be added to allow overriding these values | 626 | // In the future build.zig.zon fields will be added to allow overriding these values |
| ... | @@ -638,7 +638,7 @@ fn checkBuildFileExistence(f: *Fetch) RunError!void { | ... | @@ -638,7 +638,7 @@ fn checkBuildFileExistence(f: *Fetch) RunError!void { |
| 638 | error.FileNotFound => {}, | 638 | error.FileNotFound => {}, |
| 639 | else => |e| { | 639 | else => |e| { |
| 640 | try eb.addRootErrorMessage(.{ | 640 | try eb.addRootErrorMessage(.{ |
| 641 | .msg = try eb.printString("unable to access '{}{s}': {s}", .{ | 641 | .msg = try eb.printString("unable to access '{f}{s}': {s}", .{ |
| 642 | f.package_root, Package.build_zig_basename, @errorName(e), | 642 | f.package_root, Package.build_zig_basename, @errorName(e), |
| 643 | }), | 643 | }), |
| 644 | }); | 644 | }); |
| ... | @@ -663,7 +663,7 @@ fn loadManifest(f: *Fetch, pkg_root: Cache.Path) RunError!void { | ... | @@ -663,7 +663,7 @@ fn loadManifest(f: *Fetch, pkg_root: Cache.Path) RunError!void { |
| 663 | else => |e| { | 663 | else => |e| { |
| 664 | const file_path = try pkg_root.join(arena, Manifest.basename); | 664 | const file_path = try pkg_root.join(arena, Manifest.basename); |
| 665 | try eb.addRootErrorMessage(.{ | 665 | try eb.addRootErrorMessage(.{ |
| 666 | .msg = try eb.printString("unable to load package manifest '{}': {s}", .{ | 666 | .msg = try eb.printString("unable to load package manifest '{f}': {s}", .{ |
| 667 | file_path, @errorName(e), | 667 | file_path, @errorName(e), |
| 668 | }), | 668 | }), |
| 669 | }); | 669 | }); |
| ... | @@ -675,7 +675,7 @@ fn loadManifest(f: *Fetch, pkg_root: Cache.Path) RunError!void { | ... | @@ -675,7 +675,7 @@ fn loadManifest(f: *Fetch, pkg_root: Cache.Path) RunError!void { |
| 675 | ast.* = try std.zig.Ast.parse(arena, manifest_bytes, .zon); | 675 | ast.* = try std.zig.Ast.parse(arena, manifest_bytes, .zon); |
| 676 | 676 | ||
| 677 | if (ast.errors.len > 0) { | 677 | if (ast.errors.len > 0) { |
| 678 | const file_path = try std.fmt.allocPrint(arena, "{}" ++ fs.path.sep_str ++ Manifest.basename, .{pkg_root}); | 678 | const file_path = try std.fmt.allocPrint(arena, "{f}" ++ fs.path.sep_str ++ Manifest.basename, .{pkg_root}); |
| 679 | try std.zig.putAstErrorsIntoBundle(arena, ast.*, file_path, eb); | 679 | try std.zig.putAstErrorsIntoBundle(arena, ast.*, file_path, eb); |
| 680 | return error.FetchFailed; | 680 | return error.FetchFailed; |
| 681 | } | 681 | } |
| ... | @@ -688,7 +688,7 @@ fn loadManifest(f: *Fetch, pkg_root: Cache.Path) RunError!void { | ... | @@ -688,7 +688,7 @@ fn loadManifest(f: *Fetch, pkg_root: Cache.Path) RunError!void { |
| 688 | const manifest = &f.manifest.?; | 688 | const manifest = &f.manifest.?; |
| 689 | 689 | ||
| 690 | if (manifest.errors.len > 0) { | 690 | if (manifest.errors.len > 0) { |
| 691 | const src_path = try eb.printString("{}" ++ fs.path.sep_str ++ "{s}", .{ pkg_root, Manifest.basename }); | 691 | const src_path = try eb.printString("{f}" ++ fs.path.sep_str ++ "{s}", .{ pkg_root, Manifest.basename }); |
| 692 | try manifest.copyErrorsIntoBundle(ast.*, src_path, eb); | 692 | try manifest.copyErrorsIntoBundle(ast.*, src_path, eb); |
| 693 | return error.FetchFailed; | 693 | return error.FetchFailed; |
| 694 | } | 694 | } |
| ... | @@ -843,7 +843,7 @@ fn srcLoc( | ... | @@ -843,7 +843,7 @@ fn srcLoc( |
| 843 | const ast = f.parent_manifest_ast orelse return .none; | 843 | const ast = f.parent_manifest_ast orelse return .none; |
| 844 | const eb = &f.error_bundle; | 844 | const eb = &f.error_bundle; |
| 845 | const start_loc = ast.tokenLocation(0, tok); | 845 | const start_loc = ast.tokenLocation(0, tok); |
| 846 | const src_path = try eb.printString("{}" ++ fs.path.sep_str ++ Manifest.basename, .{f.parent_package_root}); | 846 | const src_path = try eb.printString("{f}" ++ fs.path.sep_str ++ Manifest.basename, .{f.parent_package_root}); |
| 847 | const msg_off = 0; | 847 | const msg_off = 0; |
| 848 | return eb.addSourceLocation(.{ | 848 | return eb.addSourceLocation(.{ |
| 849 | .src_path = src_path, | 849 | .src_path = src_path, |
| ... | @@ -977,7 +977,7 @@ fn initResource(f: *Fetch, uri: std.Uri, server_header_buffer: []u8) RunError!Re | ... | @@ -977,7 +977,7 @@ fn initResource(f: *Fetch, uri: std.Uri, server_header_buffer: []u8) RunError!Re |
| 977 | if (ascii.eqlIgnoreCase(uri.scheme, "file")) { | 977 | if (ascii.eqlIgnoreCase(uri.scheme, "file")) { |
| 978 | const path = try uri.path.toRawMaybeAlloc(arena); | 978 | const path = try uri.path.toRawMaybeAlloc(arena); |
| 979 | return .{ .file = f.parent_package_root.openFile(path, .{}) catch |err| { | 979 | return .{ .file = f.parent_package_root.openFile(path, .{}) catch |err| { |
| 980 | return f.fail(f.location_tok, try eb.printString("unable to open '{}{s}': {s}", .{ | 980 | return f.fail(f.location_tok, try eb.printString("unable to open '{f}{s}': {s}", .{ |
| 981 | f.parent_package_root, path, @errorName(err), | 981 | f.parent_package_root, path, @errorName(err), |
| 982 | })); | 982 | })); |
| 983 | } }; | 983 | } }; |
| ... | @@ -1524,7 +1524,7 @@ fn computeHash(f: *Fetch, pkg_path: Cache.Path, filter: Filter) RunError!Compute | ... | @@ -1524,7 +1524,7 @@ fn computeHash(f: *Fetch, pkg_path: Cache.Path, filter: Filter) RunError!Compute |
| 1524 | 1524 | ||
| 1525 | while (walker.next() catch |err| { | 1525 | while (walker.next() catch |err| { |
| 1526 | try eb.addRootErrorMessage(.{ .msg = try eb.printString( | 1526 | try eb.addRootErrorMessage(.{ .msg = try eb.printString( |
| 1527 | "unable to walk temporary directory '{}': {s}", | 1527 | "unable to walk temporary directory '{f}': {s}", |
| 1528 | .{ pkg_path, @errorName(err) }, | 1528 | .{ pkg_path, @errorName(err) }, |
| 1529 | ) }); | 1529 | ) }); |
| 1530 | return error.FetchFailed; | 1530 | return error.FetchFailed; |
src/Sema.zig+29-34| ... | @@ -1144,7 +1144,7 @@ fn analyzeBodyInner( | ... | @@ -1144,7 +1144,7 @@ fn analyzeBodyInner( |
| 1144 | 1144 | ||
| 1145 | // The hashmap lookup in here is a little expensive, and LLVM fails to optimize it away. | 1145 | // The hashmap lookup in here is a little expensive, and LLVM fails to optimize it away. |
| 1146 | if (build_options.enable_logging) { | 1146 | if (build_options.enable_logging) { |
| 1147 | std.log.scoped(.sema_zir).debug("sema ZIR {} %{d}", .{ path: { | 1147 | std.log.scoped(.sema_zir).debug("sema ZIR {f} %{d}", .{ path: { |
| 1148 | const file_index = block.src_base_inst.resolveFile(&zcu.intern_pool); | 1148 | const file_index = block.src_base_inst.resolveFile(&zcu.intern_pool); |
| 1149 | const file = zcu.fileByIndex(file_index); | 1149 | const file = zcu.fileByIndex(file_index); |
| 1150 | break :path file.path.fmt(zcu.comp); | 1150 | break :path file.path.fmt(zcu.comp); |
| ... | @@ -2763,7 +2763,7 @@ fn zirTupleDecl( | ... | @@ -2763,7 +2763,7 @@ fn zirTupleDecl( |
| 2763 | const coerced_field_init = try sema.coerce(block, field_type, uncoerced_field_init, init_src); | 2763 | const coerced_field_init = try sema.coerce(block, field_type, uncoerced_field_init, init_src); |
| 2764 | const field_init_val = try sema.resolveConstDefinedValue(block, init_src, coerced_field_init, .{ .simple = .tuple_field_default_value }); | 2764 | const field_init_val = try sema.resolveConstDefinedValue(block, init_src, coerced_field_init, .{ .simple = .tuple_field_default_value }); |
| 2765 | if (field_init_val.canMutateComptimeVarState(zcu)) { | 2765 | if (field_init_val.canMutateComptimeVarState(zcu)) { |
| 2766 | const field_name = try zcu.intern_pool.getOrPutStringFmt(gpa, pt.tid, "{}", .{field_index}, .no_embedded_nulls); | 2766 | const field_name = try zcu.intern_pool.getOrPutStringFmt(gpa, pt.tid, "{d}", .{field_index}, .no_embedded_nulls); |
| 2767 | return sema.failWithContainsReferenceToComptimeVar(block, init_src, field_name, "field default value", field_init_val); | 2767 | return sema.failWithContainsReferenceToComptimeVar(block, init_src, field_name, "field default value", field_init_val); |
| 2768 | } | 2768 | } |
| 2769 | break :init field_init_val.toIntern(); | 2769 | break :init field_init_val.toIntern(); |
| ... | @@ -5574,9 +5574,8 @@ fn zirValidateDestructure(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp | ... | @@ -5574,9 +5574,8 @@ fn zirValidateDestructure(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp |
| 5574 | 5574 | ||
| 5575 | if (operand_ty.arrayLen(zcu) != extra.expect_len) { | 5575 | if (operand_ty.arrayLen(zcu) != extra.expect_len) { |
| 5576 | return sema.failWithOwnedErrorMsg(block, msg: { | 5576 | return sema.failWithOwnedErrorMsg(block, msg: { |
| 5577 | const msg = try sema.errMsg(src, "expected {} elements for destructure, found {}", .{ | 5577 | const msg = try sema.errMsg(src, "expected {d} elements for destructure, found {d}", .{ |
| 5578 | extra.expect_len, | 5578 | extra.expect_len, operand_ty.arrayLen(zcu), |
| 5579 | operand_ty.arrayLen(zcu), | ||
| 5580 | }); | 5579 | }); |
| 5581 | errdefer msg.destroy(sema.gpa); | 5580 | errdefer msg.destroy(sema.gpa); |
| 5582 | try sema.errNote(destructure_src, msg, "result destructured here", .{}); | 5581 | try sema.errNote(destructure_src, msg, "result destructured here", .{}); |
| ... | @@ -14078,7 +14077,7 @@ fn zirShl( | ... | @@ -14078,7 +14077,7 @@ fn zirShl( |
| 14078 | }); | 14077 | }); |
| 14079 | } | 14078 | } |
| 14080 | } else if (scalar_rhs_ty.isSignedInt(zcu)) { | 14079 | } else if (scalar_rhs_ty.isSignedInt(zcu)) { |
| 14081 | return sema.fail(block, rhs_src, "shift by signed type '{}'", .{rhs_ty.fmt(pt)}); | 14080 | return sema.fail(block, rhs_src, "shift by signed type '{f}'", .{rhs_ty.fmt(pt)}); |
| 14082 | } | 14081 | } |
| 14083 | 14082 | ||
| 14084 | const runtime_src = if (maybe_lhs_val) |lhs_val| rs: { | 14083 | const runtime_src = if (maybe_lhs_val) |lhs_val| rs: { |
| ... | @@ -14383,7 +14382,7 @@ fn zirBitNot(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. | ... | @@ -14383,7 +14382,7 @@ fn zirBitNot(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 14383 | const scalar_tag = scalar_ty.zigTypeTag(zcu); | 14382 | const scalar_tag = scalar_ty.zigTypeTag(zcu); |
| 14384 | 14383 | ||
| 14385 | if (scalar_tag != .int and scalar_tag != .bool) | 14384 | if (scalar_tag != .int and scalar_tag != .bool) |
| 14386 | return sema.fail(block, operand_src, "bitwise not operation on type '{}'", .{operand_ty.fmt(pt)}); | 14385 | return sema.fail(block, operand_src, "bitwise not operation on type '{f}'", .{operand_ty.fmt(pt)}); |
| 14387 | 14386 | ||
| 14388 | return analyzeBitNot(sema, block, operand, src); | 14387 | return analyzeBitNot(sema, block, operand, src); |
| 14389 | } | 14388 | } |
| ... | @@ -16999,7 +16998,7 @@ fn zirClosureGet(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstDat | ... | @@ -16999,7 +16998,7 @@ fn zirClosureGet(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstDat |
| 16999 | const file, const src_base_node = Zcu.LazySrcLoc.resolveBaseNode(block.src_base_inst, zcu).?; | 16998 | const file, const src_base_node = Zcu.LazySrcLoc.resolveBaseNode(block.src_base_inst, zcu).?; |
| 17000 | const tree = file.getTree(zcu) catch |err| { | 16999 | const tree = file.getTree(zcu) catch |err| { |
| 17001 | // In this case we emit a warning + a less precise source location. | 17000 | // In this case we emit a warning + a less precise source location. |
| 17002 | log.warn("unable to load {}: {s}", .{ | 17001 | log.warn("unable to load {f}: {s}", .{ |
| 17003 | file.path.fmt(zcu.comp), @errorName(err), | 17002 | file.path.fmt(zcu.comp), @errorName(err), |
| 17004 | }); | 17003 | }); |
| 17005 | break :name null; | 17004 | break :name null; |
| ... | @@ -17027,7 +17026,7 @@ fn zirClosureGet(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstDat | ... | @@ -17027,7 +17026,7 @@ fn zirClosureGet(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstDat |
| 17027 | const file, const src_base_node = Zcu.LazySrcLoc.resolveBaseNode(block.src_base_inst, zcu).?; | 17026 | const file, const src_base_node = Zcu.LazySrcLoc.resolveBaseNode(block.src_base_inst, zcu).?; |
| 17028 | const tree = file.getTree(zcu) catch |err| { | 17027 | const tree = file.getTree(zcu) catch |err| { |
| 17029 | // In this case we emit a warning + a less precise source location. | 17028 | // In this case we emit a warning + a less precise source location. |
| 17030 | log.warn("unable to load {}: {s}", .{ | 17029 | log.warn("unable to load {f}: {s}", .{ |
| 17031 | file.path.fmt(zcu.comp), @errorName(err), | 17030 | file.path.fmt(zcu.comp), @errorName(err), |
| 17032 | }); | 17031 | }); |
| 17033 | break :name null; | 17032 | break :name null; |
| ... | @@ -18268,7 +18267,7 @@ fn zirBoolNot(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -18268,7 +18267,7 @@ fn zirBoolNot(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 18268 | const uncasted_ty = sema.typeOf(uncasted_operand); | 18267 | const uncasted_ty = sema.typeOf(uncasted_operand); |
| 18269 | if (uncasted_ty.isVector(zcu)) { | 18268 | if (uncasted_ty.isVector(zcu)) { |
| 18270 | if (uncasted_ty.scalarType(zcu).zigTypeTag(zcu) != .bool) { | 18269 | if (uncasted_ty.scalarType(zcu).zigTypeTag(zcu) != .bool) { |
| 18271 | return sema.fail(block, operand_src, "boolean not operation on type '{}'", .{ | 18270 | return sema.fail(block, operand_src, "boolean not operation on type '{f}'", .{ |
| 18272 | uncasted_ty.fmt(pt), | 18271 | uncasted_ty.fmt(pt), |
| 18273 | }); | 18272 | }); |
| 18274 | } | 18273 | } |
| ... | @@ -19299,13 +19298,13 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -19299,13 +19298,13 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 19299 | 19298 | ||
| 19300 | if (host_size != 0) { | 19299 | if (host_size != 0) { |
| 19301 | if (bit_offset >= host_size * 8) { | 19300 | if (bit_offset >= host_size * 8) { |
| 19302 | return sema.fail(block, bitoffset_src, "packed type '{f}' at bit offset {} starts {} bits after the end of a {} byte host integer", .{ | 19301 | return sema.fail(block, bitoffset_src, "packed type '{f}' at bit offset {d} starts {d} bits after the end of a {d} byte host integer", .{ |
| 19303 | elem_ty.fmt(pt), bit_offset, bit_offset - host_size * 8, host_size, | 19302 | elem_ty.fmt(pt), bit_offset, bit_offset - host_size * 8, host_size, |
| 19304 | }); | 19303 | }); |
| 19305 | } | 19304 | } |
| 19306 | const elem_bit_size = try elem_ty.bitSizeSema(pt); | 19305 | const elem_bit_size = try elem_ty.bitSizeSema(pt); |
| 19307 | if (elem_bit_size > host_size * 8 - bit_offset) { | 19306 | if (elem_bit_size > host_size * 8 - bit_offset) { |
| 19308 | return sema.fail(block, bitoffset_src, "packed type '{f}' at bit offset {} ends {} bits after the end of a {} byte host integer", .{ | 19307 | return sema.fail(block, bitoffset_src, "packed type '{f}' at bit offset {d} ends {d} bits after the end of a {d} byte host integer", .{ |
| 19309 | elem_ty.fmt(pt), bit_offset, elem_bit_size - (host_size * 8 - bit_offset), host_size, | 19308 | elem_ty.fmt(pt), bit_offset, elem_bit_size - (host_size * 8 - bit_offset), host_size, |
| 19310 | }); | 19309 | }); |
| 19311 | } | 19310 | } |
| ... | @@ -20466,7 +20465,7 @@ fn zirIntFromBool(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -20466,7 +20465,7 @@ fn zirIntFromBool(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 20466 | const is_vector = operand_ty.zigTypeTag(zcu) == .vector; | 20465 | const is_vector = operand_ty.zigTypeTag(zcu) == .vector; |
| 20467 | const operand_scalar_ty = operand_ty.scalarType(zcu); | 20466 | const operand_scalar_ty = operand_ty.scalarType(zcu); |
| 20468 | if (operand_scalar_ty.toIntern() != .bool_type) { | 20467 | if (operand_scalar_ty.toIntern() != .bool_type) { |
| 20469 | return sema.fail(block, src, "expected 'bool', found '{}'", .{operand_scalar_ty.zigTypeTag(zcu)}); | 20468 | return sema.fail(block, src, "expected 'bool', found '{s}'", .{operand_scalar_ty.zigTypeTag(zcu)}); |
| 20470 | } | 20469 | } |
| 20471 | const len = if (is_vector) operand_ty.vectorLen(zcu) else undefined; | 20470 | const len = if (is_vector) operand_ty.vectorLen(zcu) else undefined; |
| 20472 | const dest_ty: Type = if (is_vector) try pt.vectorType(.{ .child = .u1_type, .len = len }) else .u1; | 20471 | const dest_ty: Type = if (is_vector) try pt.vectorType(.{ .child = .u1_type, .len = len }) else .u1; |
| ... | @@ -20749,7 +20748,7 @@ fn zirReify( | ... | @@ -20749,7 +20748,7 @@ fn zirReify( |
| 20749 | 64 => .f64, | 20748 | 64 => .f64, |
| 20750 | 80 => .f80, | 20749 | 80 => .f80, |
| 20751 | 128 => .f128, | 20750 | 128 => .f128, |
| 20752 | else => return sema.fail(block, src, "{}-bit float unsupported", .{float.bits}), | 20751 | else => return sema.fail(block, src, "{d}-bit float unsupported", .{float.bits}), |
| 20753 | }; | 20752 | }; |
| 20754 | return Air.internedToRef(ty.toIntern()); | 20753 | return Air.internedToRef(ty.toIntern()); |
| 20755 | }, | 20754 | }, |
| ... | @@ -21640,7 +21639,7 @@ fn reifyTuple( | ... | @@ -21640,7 +21639,7 @@ fn reifyTuple( |
| 21640 | return sema.fail( | 21639 | return sema.fail( |
| 21641 | block, | 21640 | block, |
| 21642 | src, | 21641 | src, |
| 21643 | "tuple field name '{}' does not match field index {}", | 21642 | "tuple field name '{d}' does not match field index {d}", |
| 21644 | .{ field_name_index, field_idx }, | 21643 | .{ field_name_index, field_idx }, |
| 21645 | ); | 21644 | ); |
| 21646 | } | 21645 | } |
| ... | @@ -22658,7 +22657,7 @@ fn ptrCastFull( | ... | @@ -22658,7 +22657,7 @@ fn ptrCastFull( |
| 22658 | 22657 | ||
| 22659 | if (src_info.packed_offset.host_size != dest_info.packed_offset.host_size) { | 22658 | if (src_info.packed_offset.host_size != dest_info.packed_offset.host_size) { |
| 22660 | return sema.failWithOwnedErrorMsg(block, msg: { | 22659 | return sema.failWithOwnedErrorMsg(block, msg: { |
| 22661 | const msg = try sema.errMsg(src, "pointer host size '{}' cannot coerce into pointer host size '{}'", .{ | 22660 | const msg = try sema.errMsg(src, "pointer host size '{d}' cannot coerce into pointer host size '{d}'", .{ |
| 22662 | src_info.packed_offset.host_size, | 22661 | src_info.packed_offset.host_size, |
| 22663 | dest_info.packed_offset.host_size, | 22662 | dest_info.packed_offset.host_size, |
| 22664 | }); | 22663 | }); |
| ... | @@ -22670,7 +22669,7 @@ fn ptrCastFull( | ... | @@ -22670,7 +22669,7 @@ fn ptrCastFull( |
| 22670 | 22669 | ||
| 22671 | if (src_info.packed_offset.bit_offset != dest_info.packed_offset.bit_offset) { | 22670 | if (src_info.packed_offset.bit_offset != dest_info.packed_offset.bit_offset) { |
| 22672 | return sema.failWithOwnedErrorMsg(block, msg: { | 22671 | return sema.failWithOwnedErrorMsg(block, msg: { |
| 22673 | const msg = try sema.errMsg(src, "pointer bit offset '{}' cannot coerce into pointer bit offset '{}'", .{ | 22672 | const msg = try sema.errMsg(src, "pointer bit offset '{d}' cannot coerce into pointer bit offset '{d}'", .{ |
| 22674 | src_info.packed_offset.bit_offset, | 22673 | src_info.packed_offset.bit_offset, |
| 22675 | dest_info.packed_offset.bit_offset, | 22674 | dest_info.packed_offset.bit_offset, |
| 22676 | }); | 22675 | }); |
| ... | @@ -23240,7 +23239,7 @@ fn zirByteSwap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -23240,7 +23239,7 @@ fn zirByteSwap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 23240 | return sema.fail( | 23239 | return sema.fail( |
| 23241 | block, | 23240 | block, |
| 23242 | operand_src, | 23241 | operand_src, |
| 23243 | "@byteSwap requires the number of bits to be evenly divisible by 8, but {f} has {} bits", | 23242 | "@byteSwap requires the number of bits to be evenly divisible by 8, but {f} has {d} bits", |
| 23244 | .{ scalar_ty.fmt(pt), bits }, | 23243 | .{ scalar_ty.fmt(pt), bits }, |
| 23245 | ); | 23244 | ); |
| 23246 | } | 23245 | } |
| ... | @@ -23577,7 +23576,7 @@ fn checkNumericType( | ... | @@ -23577,7 +23576,7 @@ fn checkNumericType( |
| 23577 | .comptime_float, .float, .comptime_int, .int => {}, | 23576 | .comptime_float, .float, .comptime_int, .int => {}, |
| 23578 | .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) { | 23577 | .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) { |
| 23579 | .comptime_float, .float, .comptime_int, .int => {}, | 23578 | .comptime_float, .float, .comptime_int, .int => {}, |
| 23580 | else => |t| return sema.fail(block, ty_src, "expected number, found '{}'", .{t}), | 23579 | else => |t| return sema.fail(block, ty_src, "expected number, found '{s}'", .{t}), |
| 23581 | }, | 23580 | }, |
| 23582 | else => return sema.fail(block, ty_src, "expected number, found '{f}'", .{ty.fmt(pt)}), | 23581 | else => return sema.fail(block, ty_src, "expected number, found '{f}'", .{ty.fmt(pt)}), |
| 23583 | } | 23582 | } |
| ... | @@ -24254,7 +24253,7 @@ fn analyzeShuffle( | ... | @@ -24254,7 +24253,7 @@ fn analyzeShuffle( |
| 24254 | if (idx >= b_len) return sema.failWithOwnedErrorMsg(block, msg: { | 24253 | if (idx >= b_len) return sema.failWithOwnedErrorMsg(block, msg: { |
| 24255 | const msg = try sema.errMsg(mask_src, "mask element at index '{d}' selects out-of-bounds index", .{mask_idx}); | 24254 | const msg = try sema.errMsg(mask_src, "mask element at index '{d}' selects out-of-bounds index", .{mask_idx}); |
| 24256 | errdefer msg.destroy(sema.gpa); | 24255 | errdefer msg.destroy(sema.gpa); |
| 24257 | try sema.errNote(b_src, msg, "index '{d}' exceeds bounds of '{}' given here", .{ idx, b_ty.fmt(pt) }); | 24256 | try sema.errNote(b_src, msg, "index '{d}' exceeds bounds of '{f}' given here", .{ idx, b_ty.fmt(pt) }); |
| 24258 | break :msg msg; | 24257 | break :msg msg; |
| 24259 | }); | 24258 | }); |
| 24260 | } | 24259 | } |
| ... | @@ -25039,7 +25038,7 @@ fn analyzeMinMax( | ... | @@ -25039,7 +25038,7 @@ fn analyzeMinMax( |
| 25039 | try sema.checkNumericType(block, operand_src, operand_ty); | 25038 | try sema.checkNumericType(block, operand_src, operand_ty); |
| 25040 | if (operand_ty.zigTypeTag(zcu) != .vector) { | 25039 | if (operand_ty.zigTypeTag(zcu) != .vector) { |
| 25041 | return sema.failWithOwnedErrorMsg(block, msg: { | 25040 | return sema.failWithOwnedErrorMsg(block, msg: { |
| 25042 | const msg = try sema.errMsg(operand_src, "expected vector, found '{}'", .{operand_ty.fmt(pt)}); | 25041 | const msg = try sema.errMsg(operand_src, "expected vector, found '{f}'", .{operand_ty.fmt(pt)}); |
| 25043 | errdefer msg.destroy(zcu.gpa); | 25042 | errdefer msg.destroy(zcu.gpa); |
| 25044 | try sema.errNote(operand_srcs[0], msg, "vector operand here", .{}); | 25043 | try sema.errNote(operand_srcs[0], msg, "vector operand here", .{}); |
| 25045 | break :msg msg; | 25044 | break :msg msg; |
| ... | @@ -25047,7 +25046,7 @@ fn analyzeMinMax( | ... | @@ -25047,7 +25046,7 @@ fn analyzeMinMax( |
| 25047 | } | 25046 | } |
| 25048 | if (operand_ty.vectorLen(zcu) != vec_len) { | 25047 | if (operand_ty.vectorLen(zcu) != vec_len) { |
| 25049 | return sema.failWithOwnedErrorMsg(block, msg: { | 25048 | return sema.failWithOwnedErrorMsg(block, msg: { |
| 25050 | const msg = try sema.errMsg(operand_src, "expected vector of length '{d}', found '{}'", .{ vec_len, operand_ty.fmt(pt) }); | 25049 | const msg = try sema.errMsg(operand_src, "expected vector of length '{d}', found '{f}'", .{ vec_len, operand_ty.fmt(pt) }); |
| 25051 | errdefer msg.destroy(zcu.gpa); | 25050 | errdefer msg.destroy(zcu.gpa); |
| 25052 | try sema.errNote(operand_srcs[0], msg, "vector of length '{d}' here", .{vec_len}); | 25051 | try sema.errNote(operand_srcs[0], msg, "vector of length '{d}' here", .{vec_len}); |
| 25053 | break :msg msg; | 25052 | break :msg msg; |
| ... | @@ -25060,7 +25059,7 @@ fn analyzeMinMax( | ... | @@ -25060,7 +25059,7 @@ fn analyzeMinMax( |
| 25060 | const operand_ty = sema.typeOf(operand); | 25059 | const operand_ty = sema.typeOf(operand); |
| 25061 | if (operand_ty.zigTypeTag(zcu) == .vector) { | 25060 | if (operand_ty.zigTypeTag(zcu) == .vector) { |
| 25062 | return sema.failWithOwnedErrorMsg(block, msg: { | 25061 | return sema.failWithOwnedErrorMsg(block, msg: { |
| 25063 | const msg = try sema.errMsg(operand_srcs[0], "expected vector, found '{}'", .{first_operand_ty.fmt(pt)}); | 25062 | const msg = try sema.errMsg(operand_srcs[0], "expected vector, found '{f}'", .{first_operand_ty.fmt(pt)}); |
| 25064 | errdefer msg.destroy(zcu.gpa); | 25063 | errdefer msg.destroy(zcu.gpa); |
| 25065 | try sema.errNote(operand_src, msg, "vector operand here", .{}); | 25064 | try sema.errNote(operand_src, msg, "vector operand here", .{}); |
| 25066 | break :msg msg; | 25065 | break :msg msg; |
| ... | @@ -29163,7 +29162,7 @@ fn coerceExtra( | ... | @@ -29163,7 +29162,7 @@ fn coerceExtra( |
| 29163 | // return sema.fail( | 29162 | // return sema.fail( |
| 29164 | // block, | 29163 | // block, |
| 29165 | // inst_src, | 29164 | // inst_src, |
| 29166 | // "type '{f}' cannot represent integer value '{}'", | 29165 | // "type '{f}' cannot represent integer value '{f}'", |
| 29167 | // .{ dest_ty.fmt(pt), val }, | 29166 | // .{ dest_ty.fmt(pt), val }, |
| 29168 | // ); | 29167 | // ); |
| 29169 | //} | 29168 | //} |
| ... | @@ -29370,7 +29369,7 @@ fn coerceExtra( | ... | @@ -29370,7 +29369,7 @@ fn coerceExtra( |
| 29370 | try sema.errNote(param_src, msg, "parameter type declared here", .{}); | 29369 | try sema.errNote(param_src, msg, "parameter type declared here", .{}); |
| 29371 | } | 29370 | } |
| 29372 | 29371 | ||
| 29373 | // TODO maybe add "cannot store an error in type '{}'" note | 29372 | // TODO maybe add "cannot store an error in type '{f}'" note |
| 29374 | 29373 | ||
| 29375 | break :msg msg; | 29374 | break :msg msg; |
| 29376 | }; | 29375 | }; |
| ... | @@ -29718,12 +29717,12 @@ const InMemoryCoercionResult = union(enum) { | ... | @@ -29718,12 +29717,12 @@ const InMemoryCoercionResult = union(enum) { |
| 29718 | }, | 29717 | }, |
| 29719 | .ptr_bit_range => |bit_range| { | 29718 | .ptr_bit_range => |bit_range| { |
| 29720 | if (bit_range.actual_host != bit_range.wanted_host) { | 29719 | if (bit_range.actual_host != bit_range.wanted_host) { |
| 29721 | try sema.errNote(src, msg, "pointer host size '{}' cannot cast into pointer host size '{}'", .{ | 29720 | try sema.errNote(src, msg, "pointer host size '{d}' cannot cast into pointer host size '{d}'", .{ |
| 29722 | bit_range.actual_host, bit_range.wanted_host, | 29721 | bit_range.actual_host, bit_range.wanted_host, |
| 29723 | }); | 29722 | }); |
| 29724 | } | 29723 | } |
| 29725 | if (bit_range.actual_offset != bit_range.wanted_offset) { | 29724 | if (bit_range.actual_offset != bit_range.wanted_offset) { |
| 29726 | try sema.errNote(src, msg, "pointer bit offset '{}' cannot cast into pointer bit offset '{}'", .{ | 29725 | try sema.errNote(src, msg, "pointer bit offset '{d}' cannot cast into pointer bit offset '{d}'", .{ |
| 29727 | bit_range.actual_offset, bit_range.wanted_offset, | 29726 | bit_range.actual_offset, bit_range.wanted_offset, |
| 29728 | }); | 29727 | }); |
| 29729 | } | 29728 | } |
| ... | @@ -34840,7 +34839,7 @@ fn checkBackingIntType(sema: *Sema, block: *Block, src: LazySrcLoc, backing_int_ | ... | @@ -34840,7 +34839,7 @@ fn checkBackingIntType(sema: *Sema, block: *Block, src: LazySrcLoc, backing_int_ |
| 34840 | return sema.fail( | 34839 | return sema.fail( |
| 34841 | block, | 34840 | block, |
| 34842 | src, | 34841 | src, |
| 34843 | "backing integer type '{f}' has bit size {} but the struct fields have a total bit size of {}", | 34842 | "backing integer type '{f}' has bit size {d} but the struct fields have a total bit size of {d}", |
| 34844 | .{ backing_int_ty.fmt(pt), backing_int_ty.bitSize(zcu), fields_bit_sum }, | 34843 | .{ backing_int_ty.fmt(pt), backing_int_ty.bitSize(zcu), fields_bit_sum }, |
| 34845 | ); | 34844 | ); |
| 34846 | } | 34845 | } |
| ... | @@ -35183,11 +35182,7 @@ pub fn resolveUnionFieldTypes(sema: *Sema, ty: Type, union_type: InternPool.Load | ... | @@ -35183,11 +35182,7 @@ pub fn resolveUnionFieldTypes(sema: *Sema, ty: Type, union_type: InternPool.Load |
| 35183 | switch (union_type.flagsUnordered(ip).status) { | 35182 | switch (union_type.flagsUnordered(ip).status) { |
| 35184 | .none => {}, | 35183 | .none => {}, |
| 35185 | .field_types_wip => { | 35184 | .field_types_wip => { |
| 35186 | const msg = try sema.errMsg( | 35185 | const msg = try sema.errMsg(ty.srcLoc(zcu), "union '{f}' depends on itself", .{ty.fmt(pt)}); |
| 35187 | ty.srcLoc(zcu), | ||
| 35188 | "union '{f}' depends on itself", | ||
| 35189 | .{ty.fmt(pt)}, | ||
| 35190 | ); | ||
| 35191 | return sema.failWithOwnedErrorMsg(null, msg); | 35186 | return sema.failWithOwnedErrorMsg(null, msg); |
| 35192 | }, | 35187 | }, |
| 35193 | .have_field_types, | 35188 | .have_field_types, |
| ... | @@ -37194,7 +37189,7 @@ fn notePathToComptimeAllocPtr(sema: *Sema, msg: *Zcu.ErrorMsg, src: LazySrcLoc, | ... | @@ -37194,7 +37189,7 @@ fn notePathToComptimeAllocPtr(sema: *Sema, msg: *Zcu.ErrorMsg, src: LazySrcLoc, |
| 37194 | if (intermediate_value_count == 0) { | 37189 | if (intermediate_value_count == 0) { |
| 37195 | try first_path.print(arena, "{fi}", .{start_value_name.fmt(ip)}); | 37190 | try first_path.print(arena, "{fi}", .{start_value_name.fmt(ip)}); |
| 37196 | } else { | 37191 | } else { |
| 37197 | try first_path.print(arena, "v{}", .{intermediate_value_count - 1}); | 37192 | try first_path.print(arena, "v{d}", .{intermediate_value_count - 1}); |
| 37198 | } | 37193 | } |
| 37199 | 37194 | ||
| 37200 | const comptime_ptr = try sema.notePathToComptimeAllocPtrInner(val, &first_path); | 37195 | const comptime_ptr = try sema.notePathToComptimeAllocPtrInner(val, &first_path); |
src/Sema/LowerZon.zig+2-2| ... | @@ -513,7 +513,7 @@ fn lowerInt( | ... | @@ -513,7 +513,7 @@ fn lowerInt( |
| 513 | switch (big_int.setFloat(val, .trunc)) { | 513 | switch (big_int.setFloat(val, .trunc)) { |
| 514 | .inexact => return self.fail( | 514 | .inexact => return self.fail( |
| 515 | node, | 515 | node, |
| 516 | "fractional component prevents float value '{}' from coercion to type '{f}'", | 516 | "fractional component prevents float value '{d}' from coercion to type '{f}'", |
| 517 | .{ val, res_ty.fmt(self.sema.pt) }, | 517 | .{ val, res_ty.fmt(self.sema.pt) }, |
| 518 | ), | 518 | ), |
| 519 | .exact => {}, | 519 | .exact => {}, |
| ... | @@ -524,7 +524,7 @@ fn lowerInt( | ... | @@ -524,7 +524,7 @@ fn lowerInt( |
| 524 | if (!big_int.toConst().fitsInTwosComp(int_info.signedness, int_info.bits)) { | 524 | if (!big_int.toConst().fitsInTwosComp(int_info.signedness, int_info.bits)) { |
| 525 | return self.fail( | 525 | return self.fail( |
| 526 | node, | 526 | node, |
| 527 | "type '{f}' cannot represent integer value '{}'", | 527 | "type '{f}' cannot represent integer value '{d}'", |
| 528 | .{ res_ty.fmt(self.sema.pt), val }, | 528 | .{ res_ty.fmt(self.sema.pt), val }, |
| 529 | ); | 529 | ); |
| 530 | } | 530 | } |
src/Type.zig+10-10| ... | @@ -175,8 +175,8 @@ pub fn print(ty: Type, writer: *std.io.Writer, pt: Zcu.PerThread) std.io.Writer. | ... | @@ -175,8 +175,8 @@ pub fn print(ty: Type, writer: *std.io.Writer, pt: Zcu.PerThread) std.io.Writer. |
| 175 | 175 | ||
| 176 | if (info.sentinel != .none) switch (info.flags.size) { | 176 | if (info.sentinel != .none) switch (info.flags.size) { |
| 177 | .one, .c => unreachable, | 177 | .one, .c => unreachable, |
| 178 | .many => try writer.print("[*:{}]", .{Value.fromInterned(info.sentinel).fmtValue(pt)}), | 178 | .many => try writer.print("[*:{f}]", .{Value.fromInterned(info.sentinel).fmtValue(pt)}), |
| 179 | .slice => try writer.print("[:{}]", .{Value.fromInterned(info.sentinel).fmtValue(pt)}), | 179 | .slice => try writer.print("[:{f}]", .{Value.fromInterned(info.sentinel).fmtValue(pt)}), |
| 180 | } else switch (info.flags.size) { | 180 | } else switch (info.flags.size) { |
| 181 | .one => try writer.writeAll("*"), | 181 | .one => try writer.writeAll("*"), |
| 182 | .many => try writer.writeAll("[*]"), | 182 | .many => try writer.writeAll("[*]"), |
| ... | @@ -220,7 +220,7 @@ pub fn print(ty: Type, writer: *std.io.Writer, pt: Zcu.PerThread) std.io.Writer. | ... | @@ -220,7 +220,7 @@ pub fn print(ty: Type, writer: *std.io.Writer, pt: Zcu.PerThread) std.io.Writer. |
| 220 | try writer.print("[{d}]", .{array_type.len}); | 220 | try writer.print("[{d}]", .{array_type.len}); |
| 221 | try print(Type.fromInterned(array_type.child), writer, pt); | 221 | try print(Type.fromInterned(array_type.child), writer, pt); |
| 222 | } else { | 222 | } else { |
| 223 | try writer.print("[{d}:{}]", .{ | 223 | try writer.print("[{d}:{f}]", .{ |
| 224 | array_type.len, | 224 | array_type.len, |
| 225 | Value.fromInterned(array_type.sentinel).fmtValue(pt), | 225 | Value.fromInterned(array_type.sentinel).fmtValue(pt), |
| 226 | }); | 226 | }); |
| ... | @@ -250,7 +250,7 @@ pub fn print(ty: Type, writer: *std.io.Writer, pt: Zcu.PerThread) std.io.Writer. | ... | @@ -250,7 +250,7 @@ pub fn print(ty: Type, writer: *std.io.Writer, pt: Zcu.PerThread) std.io.Writer. |
| 250 | }, | 250 | }, |
| 251 | .inferred_error_set_type => |func_index| { | 251 | .inferred_error_set_type => |func_index| { |
| 252 | const func_nav = ip.getNav(zcu.funcInfo(func_index).owner_nav); | 252 | const func_nav = ip.getNav(zcu.funcInfo(func_index).owner_nav); |
| 253 | try writer.print("@typeInfo(@typeInfo(@TypeOf({})).@\"fn\".return_type.?).error_union.error_set", .{ | 253 | try writer.print("@typeInfo(@typeInfo(@TypeOf({f})).@\"fn\".return_type.?).error_union.error_set", .{ |
| 254 | func_nav.fqn.fmt(ip), | 254 | func_nav.fqn.fmt(ip), |
| 255 | }); | 255 | }); |
| 256 | }, | 256 | }, |
| ... | @@ -259,7 +259,7 @@ pub fn print(ty: Type, writer: *std.io.Writer, pt: Zcu.PerThread) std.io.Writer. | ... | @@ -259,7 +259,7 @@ pub fn print(ty: Type, writer: *std.io.Writer, pt: Zcu.PerThread) std.io.Writer. |
| 259 | try writer.writeAll("error{"); | 259 | try writer.writeAll("error{"); |
| 260 | for (names.get(ip), 0..) |name, i| { | 260 | for (names.get(ip), 0..) |name, i| { |
| 261 | if (i != 0) try writer.writeByte(','); | 261 | if (i != 0) try writer.writeByte(','); |
| 262 | try writer.print("{}", .{name.fmt(ip)}); | 262 | try writer.print("{f}", .{name.fmt(ip)}); |
| 263 | } | 263 | } |
| 264 | try writer.writeAll("}"); | 264 | try writer.writeAll("}"); |
| 265 | }, | 265 | }, |
| ... | @@ -302,7 +302,7 @@ pub fn print(ty: Type, writer: *std.io.Writer, pt: Zcu.PerThread) std.io.Writer. | ... | @@ -302,7 +302,7 @@ pub fn print(ty: Type, writer: *std.io.Writer, pt: Zcu.PerThread) std.io.Writer. |
| 302 | }, | 302 | }, |
| 303 | .struct_type => { | 303 | .struct_type => { |
| 304 | const name = ip.loadStructType(ty.toIntern()).name; | 304 | const name = ip.loadStructType(ty.toIntern()).name; |
| 305 | try writer.print("{}", .{name.fmt(ip)}); | 305 | try writer.print("{f}", .{name.fmt(ip)}); |
| 306 | }, | 306 | }, |
| 307 | .tuple_type => |tuple| { | 307 | .tuple_type => |tuple| { |
| 308 | if (tuple.types.len == 0) { | 308 | if (tuple.types.len == 0) { |
| ... | @@ -313,22 +313,22 @@ pub fn print(ty: Type, writer: *std.io.Writer, pt: Zcu.PerThread) std.io.Writer. | ... | @@ -313,22 +313,22 @@ pub fn print(ty: Type, writer: *std.io.Writer, pt: Zcu.PerThread) std.io.Writer. |
| 313 | try writer.writeAll(if (i == 0) " " else ", "); | 313 | try writer.writeAll(if (i == 0) " " else ", "); |
| 314 | if (val != .none) try writer.writeAll("comptime "); | 314 | if (val != .none) try writer.writeAll("comptime "); |
| 315 | try print(Type.fromInterned(field_ty), writer, pt); | 315 | try print(Type.fromInterned(field_ty), writer, pt); |
| 316 | if (val != .none) try writer.print(" = {}", .{Value.fromInterned(val).fmtValue(pt)}); | 316 | if (val != .none) try writer.print(" = {f}", .{Value.fromInterned(val).fmtValue(pt)}); |
| 317 | } | 317 | } |
| 318 | try writer.writeAll(" }"); | 318 | try writer.writeAll(" }"); |
| 319 | }, | 319 | }, |
| 320 | 320 | ||
| 321 | .union_type => { | 321 | .union_type => { |
| 322 | const name = ip.loadUnionType(ty.toIntern()).name; | 322 | const name = ip.loadUnionType(ty.toIntern()).name; |
| 323 | try writer.print("{}", .{name.fmt(ip)}); | 323 | try writer.print("{f}", .{name.fmt(ip)}); |
| 324 | }, | 324 | }, |
| 325 | .opaque_type => { | 325 | .opaque_type => { |
| 326 | const name = ip.loadOpaqueType(ty.toIntern()).name; | 326 | const name = ip.loadOpaqueType(ty.toIntern()).name; |
| 327 | try writer.print("{}", .{name.fmt(ip)}); | 327 | try writer.print("{f}", .{name.fmt(ip)}); |
| 328 | }, | 328 | }, |
| 329 | .enum_type => { | 329 | .enum_type => { |
| 330 | const name = ip.loadEnumType(ty.toIntern()).name; | 330 | const name = ip.loadEnumType(ty.toIntern()).name; |
| 331 | try writer.print("{}", .{name.fmt(ip)}); | 331 | try writer.print("{f}", .{name.fmt(ip)}); |
| 332 | }, | 332 | }, |
| 333 | .func_type => |fn_info| { | 333 | .func_type => |fn_info| { |
| 334 | if (fn_info.is_noinline) { | 334 | if (fn_info.is_noinline) { |
src/Zcu.zig+17-17| ... | @@ -1112,7 +1112,7 @@ pub const File = struct { | ... | @@ -1112,7 +1112,7 @@ pub const File = struct { |
| 1112 | eb: *std.zig.ErrorBundle.Wip, | 1112 | eb: *std.zig.ErrorBundle.Wip, |
| 1113 | ) !std.zig.ErrorBundle.SourceLocationIndex { | 1113 | ) !std.zig.ErrorBundle.SourceLocationIndex { |
| 1114 | return eb.addSourceLocation(.{ | 1114 | return eb.addSourceLocation(.{ |
| 1115 | .src_path = try eb.printString("{}", .{file.path.fmt(zcu.comp)}), | 1115 | .src_path = try eb.printString("{f}", .{file.path.fmt(zcu.comp)}), |
| 1116 | .span_start = 0, | 1116 | .span_start = 0, |
| 1117 | .span_main = 0, | 1117 | .span_main = 0, |
| 1118 | .span_end = 0, | 1118 | .span_end = 0, |
| ... | @@ -1133,7 +1133,7 @@ pub const File = struct { | ... | @@ -1133,7 +1133,7 @@ pub const File = struct { |
| 1133 | const end = start + tree.tokenSlice(tok).len; | 1133 | const end = start + tree.tokenSlice(tok).len; |
| 1134 | const loc = std.zig.findLineColumn(source.bytes, start); | 1134 | const loc = std.zig.findLineColumn(source.bytes, start); |
| 1135 | return eb.addSourceLocation(.{ | 1135 | return eb.addSourceLocation(.{ |
| 1136 | .src_path = try eb.printString("{}", .{file.path.fmt(zcu.comp)}), | 1136 | .src_path = try eb.printString("{f}", .{file.path.fmt(zcu.comp)}), |
| 1137 | .span_start = start, | 1137 | .span_start = start, |
| 1138 | .span_main = start, | 1138 | .span_main = start, |
| 1139 | .span_end = @intCast(end), | 1139 | .span_end = @intCast(end), |
| ... | @@ -4238,17 +4238,17 @@ fn formatAnalUnit(data: FormatAnalUnit, writer: *std.io.Writer) std.io.Writer.Er | ... | @@ -4238,17 +4238,17 @@ fn formatAnalUnit(data: FormatAnalUnit, writer: *std.io.Writer) std.io.Writer.Er |
| 4238 | const cu = ip.getComptimeUnit(cu_id); | 4238 | const cu = ip.getComptimeUnit(cu_id); |
| 4239 | if (cu.zir_index.resolveFull(ip)) |resolved| { | 4239 | if (cu.zir_index.resolveFull(ip)) |resolved| { |
| 4240 | const file_path = zcu.fileByIndex(resolved.file).path; | 4240 | const file_path = zcu.fileByIndex(resolved.file).path; |
| 4241 | return writer.print("comptime(inst=('{}', %{}) [{}])", .{ file_path.fmt(zcu.comp), @intFromEnum(resolved.inst), @intFromEnum(cu_id) }); | 4241 | return writer.print("comptime(inst=('{f}', %{}) [{}])", .{ file_path.fmt(zcu.comp), @intFromEnum(resolved.inst), @intFromEnum(cu_id) }); |
| 4242 | } else { | 4242 | } else { |
| 4243 | return writer.print("comptime(inst=<lost> [{}])", .{@intFromEnum(cu_id)}); | 4243 | return writer.print("comptime(inst=<lost> [{}])", .{@intFromEnum(cu_id)}); |
| 4244 | } | 4244 | } |
| 4245 | }, | 4245 | }, |
| 4246 | .nav_val => |nav| return writer.print("nav_val('{}' [{}])", .{ ip.getNav(nav).fqn.fmt(ip), @intFromEnum(nav) }), | 4246 | .nav_val => |nav| return writer.print("nav_val('{f}' [{}])", .{ ip.getNav(nav).fqn.fmt(ip), @intFromEnum(nav) }), |
| 4247 | .nav_ty => |nav| return writer.print("nav_ty('{}' [{}])", .{ ip.getNav(nav).fqn.fmt(ip), @intFromEnum(nav) }), | 4247 | .nav_ty => |nav| return writer.print("nav_ty('{f}' [{}])", .{ ip.getNav(nav).fqn.fmt(ip), @intFromEnum(nav) }), |
| 4248 | .type => |ty| return writer.print("ty('{}' [{}])", .{ Type.fromInterned(ty).containerTypeName(ip).fmt(ip), @intFromEnum(ty) }), | 4248 | .type => |ty| return writer.print("ty('{f}' [{}])", .{ Type.fromInterned(ty).containerTypeName(ip).fmt(ip), @intFromEnum(ty) }), |
| 4249 | .func => |func| { | 4249 | .func => |func| { |
| 4250 | const nav = zcu.funcInfo(func).owner_nav; | 4250 | const nav = zcu.funcInfo(func).owner_nav; |
| 4251 | return writer.print("func('{}' [{}])", .{ ip.getNav(nav).fqn.fmt(ip), @intFromEnum(func) }); | 4251 | return writer.print("func('{f}' [{}])", .{ ip.getNav(nav).fqn.fmt(ip), @intFromEnum(func) }); |
| 4252 | }, | 4252 | }, |
| 4253 | .memoized_state => return writer.writeAll("memoized_state"), | 4253 | .memoized_state => return writer.writeAll("memoized_state"), |
| 4254 | } | 4254 | } |
| ... | @@ -4265,42 +4265,42 @@ fn formatDependee(data: FormatDependee, writer: *std.io.Writer) std.io.Writer.Er | ... | @@ -4265,42 +4265,42 @@ fn formatDependee(data: FormatDependee, writer: *std.io.Writer) std.io.Writer.Er |
| 4265 | return writer.writeAll("inst(<lost>)"); | 4265 | return writer.writeAll("inst(<lost>)"); |
| 4266 | }; | 4266 | }; |
| 4267 | const file_path = zcu.fileByIndex(info.file).path; | 4267 | const file_path = zcu.fileByIndex(info.file).path; |
| 4268 | return writer.print("inst('{}', %{d})", .{ file_path.fmt(zcu.comp), @intFromEnum(info.inst) }); | 4268 | return writer.print("inst('{f}', %{d})", .{ file_path.fmt(zcu.comp), @intFromEnum(info.inst) }); |
| 4269 | }, | 4269 | }, |
| 4270 | .nav_val => |nav| { | 4270 | .nav_val => |nav| { |
| 4271 | const fqn = ip.getNav(nav).fqn; | 4271 | const fqn = ip.getNav(nav).fqn; |
| 4272 | return writer.print("nav_val('{}')", .{fqn.fmt(ip)}); | 4272 | return writer.print("nav_val('{f}')", .{fqn.fmt(ip)}); |
| 4273 | }, | 4273 | }, |
| 4274 | .nav_ty => |nav| { | 4274 | .nav_ty => |nav| { |
| 4275 | const fqn = ip.getNav(nav).fqn; | 4275 | const fqn = ip.getNav(nav).fqn; |
| 4276 | return writer.print("nav_ty('{}')", .{fqn.fmt(ip)}); | 4276 | return writer.print("nav_ty('{f}')", .{fqn.fmt(ip)}); |
| 4277 | }, | 4277 | }, |
| 4278 | .interned => |ip_index| switch (ip.indexToKey(ip_index)) { | 4278 | .interned => |ip_index| switch (ip.indexToKey(ip_index)) { |
| 4279 | .struct_type, .union_type, .enum_type => return writer.print("type('{}')", .{Type.fromInterned(ip_index).containerTypeName(ip).fmt(ip)}), | 4279 | .struct_type, .union_type, .enum_type => return writer.print("type('{f}')", .{Type.fromInterned(ip_index).containerTypeName(ip).fmt(ip)}), |
| 4280 | .func => |f| return writer.print("ies('{}')", .{ip.getNav(f.owner_nav).fqn.fmt(ip)}), | 4280 | .func => |f| return writer.print("ies('{f}')", .{ip.getNav(f.owner_nav).fqn.fmt(ip)}), |
| 4281 | else => unreachable, | 4281 | else => unreachable, |
| 4282 | }, | 4282 | }, |
| 4283 | .zon_file => |file| { | 4283 | .zon_file => |file| { |
| 4284 | const file_path = zcu.fileByIndex(file).path; | 4284 | const file_path = zcu.fileByIndex(file).path; |
| 4285 | return writer.print("zon_file('{}')", .{file_path.fmt(zcu.comp)}); | 4285 | return writer.print("zon_file('{f}')", .{file_path.fmt(zcu.comp)}); |
| 4286 | }, | 4286 | }, |
| 4287 | .embed_file => |ef_idx| { | 4287 | .embed_file => |ef_idx| { |
| 4288 | const ef = ef_idx.get(zcu); | 4288 | const ef = ef_idx.get(zcu); |
| 4289 | return writer.print("embed_file('{}')", .{ef.path.fmt(zcu.comp)}); | 4289 | return writer.print("embed_file('{f}')", .{ef.path.fmt(zcu.comp)}); |
| 4290 | }, | 4290 | }, |
| 4291 | .namespace => |ti| { | 4291 | .namespace => |ti| { |
| 4292 | const info = ti.resolveFull(ip) orelse { | 4292 | const info = ti.resolveFull(ip) orelse { |
| 4293 | return writer.writeAll("namespace(<lost>)"); | 4293 | return writer.writeAll("namespace(<lost>)"); |
| 4294 | }; | 4294 | }; |
| 4295 | const file_path = zcu.fileByIndex(info.file).path; | 4295 | const file_path = zcu.fileByIndex(info.file).path; |
| 4296 | return writer.print("namespace('{}', %{d})", .{ file_path.fmt(zcu.comp), @intFromEnum(info.inst) }); | 4296 | return writer.print("namespace('{f}', %{d})", .{ file_path.fmt(zcu.comp), @intFromEnum(info.inst) }); |
| 4297 | }, | 4297 | }, |
| 4298 | .namespace_name => |k| { | 4298 | .namespace_name => |k| { |
| 4299 | const info = k.namespace.resolveFull(ip) orelse { | 4299 | const info = k.namespace.resolveFull(ip) orelse { |
| 4300 | return writer.print("namespace(<lost>, '{}')", .{k.name.fmt(ip)}); | 4300 | return writer.print("namespace(<lost>, '{f}')", .{k.name.fmt(ip)}); |
| 4301 | }; | 4301 | }; |
| 4302 | const file_path = zcu.fileByIndex(info.file).path; | 4302 | const file_path = zcu.fileByIndex(info.file).path; |
| 4303 | return writer.print("namespace('{}', %{d}, '{}')", .{ file_path.fmt(zcu.comp), @intFromEnum(info.inst), k.name.fmt(ip) }); | 4303 | return writer.print("namespace('{f}', %{d}, '{f}')", .{ file_path.fmt(zcu.comp), @intFromEnum(info.inst), k.name.fmt(ip) }); |
| 4304 | }, | 4304 | }, |
| 4305 | .memoized_state => return writer.writeAll("memoized_state"), | 4305 | .memoized_state => return writer.writeAll("memoized_state"), |
| 4306 | } | 4306 | } |
src/Zcu/PerThread.zig+9-9| ... | @@ -53,7 +53,7 @@ fn deinitFile(pt: Zcu.PerThread, file_index: Zcu.File.Index) void { | ... | @@ -53,7 +53,7 @@ fn deinitFile(pt: Zcu.PerThread, file_index: Zcu.File.Index) void { |
| 53 | const zcu = pt.zcu; | 53 | const zcu = pt.zcu; |
| 54 | const gpa = zcu.gpa; | 54 | const gpa = zcu.gpa; |
| 55 | const file = zcu.fileByIndex(file_index); | 55 | const file = zcu.fileByIndex(file_index); |
| 56 | log.debug("deinit File {}", .{file.path.fmt(zcu.comp)}); | 56 | log.debug("deinit File {f}", .{file.path.fmt(zcu.comp)}); |
| 57 | file.path.deinit(gpa); | 57 | file.path.deinit(gpa); |
| 58 | file.unload(gpa); | 58 | file.unload(gpa); |
| 59 | if (file.prev_zir) |prev_zir| { | 59 | if (file.prev_zir) |prev_zir| { |
| ... | @@ -117,7 +117,7 @@ pub fn updateFile( | ... | @@ -117,7 +117,7 @@ pub fn updateFile( |
| 117 | var lock: std.fs.File.Lock = switch (file.status) { | 117 | var lock: std.fs.File.Lock = switch (file.status) { |
| 118 | .never_loaded, .retryable_failure => lock: { | 118 | .never_loaded, .retryable_failure => lock: { |
| 119 | // First, load the cached ZIR code, if any. | 119 | // First, load the cached ZIR code, if any. |
| 120 | log.debug("AstGen checking cache: {} (local={}, digest={s})", .{ | 120 | log.debug("AstGen checking cache: {f} (local={}, digest={s})", .{ |
| 121 | file.path.fmt(comp), want_local_cache, &hex_digest, | 121 | file.path.fmt(comp), want_local_cache, &hex_digest, |
| 122 | }); | 122 | }); |
| 123 | 123 | ||
| ... | @@ -130,11 +130,11 @@ pub fn updateFile( | ... | @@ -130,11 +130,11 @@ pub fn updateFile( |
| 130 | stat.inode == file.stat.inode; | 130 | stat.inode == file.stat.inode; |
| 131 | 131 | ||
| 132 | if (unchanged_metadata) { | 132 | if (unchanged_metadata) { |
| 133 | log.debug("unmodified metadata of file: {}", .{file.path.fmt(comp)}); | 133 | log.debug("unmodified metadata of file: {f}", .{file.path.fmt(comp)}); |
| 134 | return; | 134 | return; |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | log.debug("metadata changed: {}", .{file.path.fmt(comp)}); | 137 | log.debug("metadata changed: {f}", .{file.path.fmt(comp)}); |
| 138 | 138 | ||
| 139 | break :lock .exclusive; | 139 | break :lock .exclusive; |
| 140 | }, | 140 | }, |
| ... | @@ -221,12 +221,12 @@ pub fn updateFile( | ... | @@ -221,12 +221,12 @@ pub fn updateFile( |
| 221 | }; | 221 | }; |
| 222 | switch (result) { | 222 | switch (result) { |
| 223 | .success => { | 223 | .success => { |
| 224 | log.debug("AstGen cached success: {}", .{file.path.fmt(comp)}); | 224 | log.debug("AstGen cached success: {f}", .{file.path.fmt(comp)}); |
| 225 | break false; | 225 | break false; |
| 226 | }, | 226 | }, |
| 227 | .invalid => {}, | 227 | .invalid => {}, |
| 228 | .truncated => log.warn("unexpected EOF reading cached ZIR for {}", .{file.path.fmt(comp)}), | 228 | .truncated => log.warn("unexpected EOF reading cached ZIR for {f}", .{file.path.fmt(comp)}), |
| 229 | .stale => log.debug("AstGen cache stale: {}", .{file.path.fmt(comp)}), | 229 | .stale => log.debug("AstGen cache stale: {f}", .{file.path.fmt(comp)}), |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | // If we already have the exclusive lock then it is our job to update. | 232 | // If we already have the exclusive lock then it is our job to update. |
| ... | @@ -283,7 +283,7 @@ pub fn updateFile( | ... | @@ -283,7 +283,7 @@ pub fn updateFile( |
| 283 | }, | 283 | }, |
| 284 | } | 284 | } |
| 285 | 285 | ||
| 286 | log.debug("AstGen fresh success: {}", .{file.path.fmt(comp)}); | 286 | log.debug("AstGen fresh success: {f}", .{file.path.fmt(comp)}); |
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | file.stat = .{ | 289 | file.stat = .{ |
| ... | @@ -2303,7 +2303,7 @@ pub fn updateBuiltinModule(pt: Zcu.PerThread, opts: Builtin) Allocator.Error!voi | ... | @@ -2303,7 +2303,7 @@ pub fn updateBuiltinModule(pt: Zcu.PerThread, opts: Builtin) Allocator.Error!voi |
| 2303 | 2303 | ||
| 2304 | Builtin.updateFileOnDisk(file, comp) catch |err| comp.setMiscFailure( | 2304 | Builtin.updateFileOnDisk(file, comp) catch |err| comp.setMiscFailure( |
| 2305 | .write_builtin_zig, | 2305 | .write_builtin_zig, |
| 2306 | "unable to write '{}': {s}", | 2306 | "unable to write '{f}': {s}", |
| 2307 | .{ file.path.fmt(comp), @errorName(err) }, | 2307 | .{ file.path.fmt(comp), @errorName(err) }, |
| 2308 | ); | 2308 | ); |
| 2309 | } | 2309 | } |
src/arch/riscv64/CodeGen.zig+10-14| ... | @@ -566,13 +566,9 @@ const InstTracking = struct { | ... | @@ -566,13 +566,9 @@ const InstTracking = struct { |
| 566 | } | 566 | } |
| 567 | } | 567 | } |
| 568 | 568 | ||
| 569 | pub fn format( | 569 | pub fn format(inst_tracking: InstTracking, writer: *std.io.Writer, comptime f: []const u8) std.io.Writer.Error!void { |
| 570 | inst_tracking: InstTracking, | 570 | comptime assert(f.len == 0); |
| 571 | comptime _: []const u8, | 571 | if (!std.meta.eql(inst_tracking.long, inst_tracking.short)) try writer.print("|{}| ", .{inst_tracking.long}); |
| 572 | _: std.fmt.FormatOptions, | ||
| 573 | writer: anytype, | ||
| 574 | ) @TypeOf(writer).Error!void { | ||
| 575 | if (!std.meta.eql(inst_tracking.long, inst_tracking.short)) try writer.print("|{f}| ", .{inst_tracking.long}); | ||
| 576 | try writer.print("{}", .{inst_tracking.short}); | 572 | try writer.print("{}", .{inst_tracking.short}); |
| 577 | } | 573 | } |
| 578 | }; | 574 | }; |
| ... | @@ -973,7 +969,7 @@ fn formatWipMir(data: FormatWipMirData, writer: *std.io.Writer) std.io.Writer.Er | ... | @@ -973,7 +969,7 @@ fn formatWipMir(data: FormatWipMirData, writer: *std.io.Writer) std.io.Writer.Er |
| 973 | else => |e| return e, | 969 | else => |e| return e, |
| 974 | }).insts) |lowered_inst| { | 970 | }).insts) |lowered_inst| { |
| 975 | if (!first) try writer.writeAll("\ndebug(wip_mir): "); | 971 | if (!first) try writer.writeAll("\ndebug(wip_mir): "); |
| 976 | try writer.print(" | {f}", .{lowered_inst}); | 972 | try writer.print(" | {}", .{lowered_inst}); |
| 977 | first = false; | 973 | first = false; |
| 978 | } | 974 | } |
| 979 | } | 975 | } |
| ... | @@ -1156,7 +1152,7 @@ fn gen(func: *Func) !void { | ... | @@ -1156,7 +1152,7 @@ fn gen(func: *Func) !void { |
| 1156 | func.ret_mcv.long.address().offset(-func.ret_mcv.short.indirect.off), | 1152 | func.ret_mcv.long.address().offset(-func.ret_mcv.short.indirect.off), |
| 1157 | ); | 1153 | ); |
| 1158 | func.ret_mcv.long = .{ .load_frame = .{ .index = frame_index } }; | 1154 | func.ret_mcv.long = .{ .load_frame = .{ .index = frame_index } }; |
| 1159 | tracking_log.debug("spill {f} to {f}", .{ func.ret_mcv.long, frame_index }); | 1155 | tracking_log.debug("spill {} to {f}", .{ func.ret_mcv.long, frame_index }); |
| 1160 | }, | 1156 | }, |
| 1161 | else => unreachable, | 1157 | else => unreachable, |
| 1162 | } | 1158 | } |
| ... | @@ -1656,7 +1652,7 @@ fn genBody(func: *Func, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -1656,7 +1652,7 @@ fn genBody(func: *Func, body: []const Air.Inst.Index) InnerError!void { |
| 1656 | 1652 | ||
| 1657 | if (std.debug.runtime_safety) { | 1653 | if (std.debug.runtime_safety) { |
| 1658 | if (func.air_bookkeeping < old_air_bookkeeping + 1) { | 1654 | if (func.air_bookkeeping < old_air_bookkeeping + 1) { |
| 1659 | std.debug.panic("in codegen.zig, handling of AIR instruction %{d} ('{f}') did not do proper bookkeeping. Look for a missing call to finishAir.", .{ inst, air_tags[@intFromEnum(inst)] }); | 1655 | std.debug.panic("in codegen.zig, handling of AIR instruction %{d} ('{}') did not do proper bookkeeping. Look for a missing call to finishAir.", .{ inst, air_tags[@intFromEnum(inst)] }); |
| 1660 | } | 1656 | } |
| 1661 | 1657 | ||
| 1662 | { // check consistency of tracked registers | 1658 | { // check consistency of tracked registers |
| ... | @@ -1668,7 +1664,7 @@ fn genBody(func: *Func, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -1668,7 +1664,7 @@ fn genBody(func: *Func, body: []const Air.Inst.Index) InnerError!void { |
| 1668 | for (tracking.getRegs()) |reg| { | 1664 | for (tracking.getRegs()) |reg| { |
| 1669 | if (RegisterManager.indexOfRegIntoTracked(reg).? == index) break; | 1665 | if (RegisterManager.indexOfRegIntoTracked(reg).? == index) break; |
| 1670 | } else return std.debug.panic( | 1666 | } else return std.debug.panic( |
| 1671 | \\%{} takes up these regs: {any}, however this regs {any}, don't use it | 1667 | \\%{f} takes up these regs: {any}, however this regs {any}, don't use it |
| 1672 | , .{ tracked_inst, tracking.getRegs(), RegisterManager.regAtTrackedIndex(@intCast(index)) }); | 1668 | , .{ tracked_inst, tracking.getRegs(), RegisterManager.regAtTrackedIndex(@intCast(index)) }); |
| 1673 | } | 1669 | } |
| 1674 | } | 1670 | } |
| ... | @@ -1726,7 +1722,7 @@ fn finishAirResult(func: *Func, inst: Air.Inst.Index, result: MCValue) void { | ... | @@ -1726,7 +1722,7 @@ fn finishAirResult(func: *Func, inst: Air.Inst.Index, result: MCValue) void { |
| 1726 | else => {}, | 1722 | else => {}, |
| 1727 | } | 1723 | } |
| 1728 | 1724 | ||
| 1729 | tracking_log.debug("%{d} => {f} (birth)", .{ inst, result }); | 1725 | tracking_log.debug("%{d} => {} (birth)", .{ inst, result }); |
| 1730 | func.inst_tracking.putAssumeCapacityNoClobber(inst, InstTracking.init(result)); | 1726 | func.inst_tracking.putAssumeCapacityNoClobber(inst, InstTracking.init(result)); |
| 1731 | // In some cases, an operand may be reused as the result. | 1727 | // In some cases, an operand may be reused as the result. |
| 1732 | // If that operand died and was a register, it was freed by | 1728 | // If that operand died and was a register, it was freed by |
| ... | @@ -1827,7 +1823,7 @@ fn computeFrameLayout(func: *Func) !FrameLayout { | ... | @@ -1827,7 +1823,7 @@ fn computeFrameLayout(func: *Func) !FrameLayout { |
| 1827 | total_alloc_size + 64 + args_frame_size + spill_frame_size + call_frame_size, | 1823 | total_alloc_size + 64 + args_frame_size + spill_frame_size + call_frame_size, |
| 1828 | @intCast(frame_align[@intFromEnum(FrameIndex.base_ptr)].toByteUnits().?), | 1824 | @intCast(frame_align[@intFromEnum(FrameIndex.base_ptr)].toByteUnits().?), |
| 1829 | ); | 1825 | ); |
| 1830 | log.debug("frame size: {f}", .{acc_frame_size}); | 1826 | log.debug("frame size: {d}", .{acc_frame_size}); |
| 1831 | 1827 | ||
| 1832 | // store the ra at total_size - 8, so it's the very first thing in the stack | 1828 | // store the ra at total_size - 8, so it's the very first thing in the stack |
| 1833 | // relative to the fp | 1829 | // relative to the fp |
| ... | @@ -1888,7 +1884,7 @@ fn splitType(func: *Func, ty: Type) ![2]Type { | ... | @@ -1888,7 +1884,7 @@ fn splitType(func: *Func, ty: Type) ![2]Type { |
| 1888 | }, | 1884 | }, |
| 1889 | else => unreachable, | 1885 | else => unreachable, |
| 1890 | }, | 1886 | }, |
| 1891 | else => return func.fail("TODO: splitType class {f}", .{class}), | 1887 | else => return func.fail("TODO: splitType class {}", .{class}), |
| 1892 | }; | 1888 | }; |
| 1893 | } else if (parts[0].abiSize(zcu) + parts[1].abiSize(zcu) == ty.abiSize(zcu)) return parts; | 1889 | } else if (parts[0].abiSize(zcu) + parts[1].abiSize(zcu) == ty.abiSize(zcu)) return parts; |
| 1894 | return func.fail("TODO implement splitType for {f}", .{ty.fmt(func.pt)}); | 1890 | return func.fail("TODO implement splitType for {f}", .{ty.fmt(func.pt)}); |
src/arch/riscv64/Mir.zig+1-6| ... | @@ -92,12 +92,7 @@ pub const Inst = struct { | ... | @@ -92,12 +92,7 @@ pub const Inst = struct { |
| 92 | }, | 92 | }, |
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | pub fn format( | 95 | pub fn format(inst: Inst, writer: *std.io.Writer, comptime fmt: []const u8) std.io.Writer.Error!void { |
| 96 | inst: Inst, | ||
| 97 | comptime fmt: []const u8, | ||
| 98 | _: std.fmt.FormatOptions, | ||
| 99 | writer: anytype, | ||
| 100 | ) !void { | ||
| 101 | assert(fmt.len == 0); | 96 | assert(fmt.len == 0); |
| 102 | try writer.print("Tag: {s}, Data: {s}", .{ @tagName(inst.tag), @tagName(inst.data) }); | 97 | try writer.print("Tag: {s}, Data: {s}", .{ @tagName(inst.tag), @tagName(inst.data) }); |
| 103 | } | 98 | } |
src/arch/riscv64/bits.zig+2-7| ... | @@ -256,19 +256,14 @@ pub const FrameIndex = enum(u32) { | ... | @@ -256,19 +256,14 @@ pub const FrameIndex = enum(u32) { |
| 256 | return @intFromEnum(fi) < named_count; | 256 | return @intFromEnum(fi) < named_count; |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | pub fn format( | 259 | pub fn format(fi: FrameIndex, writer: *std.io.Writer, comptime fmt: []const u8) std.io.Writer.Error!void { |
| 260 | fi: FrameIndex, | ||
| 261 | comptime fmt: []const u8, | ||
| 262 | options: std.fmt.FormatOptions, | ||
| 263 | writer: anytype, | ||
| 264 | ) @TypeOf(writer).Error!void { | ||
| 265 | try writer.writeAll("FrameIndex"); | 260 | try writer.writeAll("FrameIndex"); |
| 266 | if (fi.isNamed()) { | 261 | if (fi.isNamed()) { |
| 267 | try writer.writeByte('.'); | 262 | try writer.writeByte('.'); |
| 268 | try writer.writeAll(@tagName(fi)); | 263 | try writer.writeAll(@tagName(fi)); |
| 269 | } else { | 264 | } else { |
| 270 | try writer.writeByte('('); | 265 | try writer.writeByte('('); |
| 271 | try std.fmt.formatType(@intFromEnum(fi), fmt, options, writer, 0); | 266 | try writer.printInt(fmt, .{}, @intFromEnum(fi)); |
| 272 | try writer.writeByte(')'); | 267 | try writer.writeByte(')'); |
| 273 | } | 268 | } |
| 274 | } | 269 | } |
src/arch/sparc64/CodeGen.zig+6-6| ... | @@ -723,7 +723,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -723,7 +723,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { |
| 723 | 723 | ||
| 724 | if (std.debug.runtime_safety) { | 724 | if (std.debug.runtime_safety) { |
| 725 | if (self.air_bookkeeping < old_air_bookkeeping + 1) { | 725 | if (self.air_bookkeeping < old_air_bookkeeping + 1) { |
| 726 | std.debug.panic("in codegen.zig, handling of AIR instruction %{d} ('{}') did not do proper bookkeeping. Look for a missing call to finishAir.", .{ inst, air_tags[@intFromEnum(inst)] }); | 726 | std.debug.panic("in codegen.zig, handling of AIR instruction %{d} ('{s}') did not do proper bookkeeping. Look for a missing call to finishAir.", .{ inst, air_tags[@intFromEnum(inst)] }); |
| 727 | } | 727 | } |
| 728 | } | 728 | } |
| 729 | } | 729 | } |
| ... | @@ -1001,7 +1001,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) InnerError!void { | ... | @@ -1001,7 +1001,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) InnerError!void { |
| 1001 | switch (self.args[arg_index]) { | 1001 | switch (self.args[arg_index]) { |
| 1002 | .stack_offset => |off| { | 1002 | .stack_offset => |off| { |
| 1003 | const abi_size = math.cast(u32, ty.abiSize(zcu)) orelse { | 1003 | const abi_size = math.cast(u32, ty.abiSize(zcu)) orelse { |
| 1004 | return self.fail("type '{}' too big to fit into stack frame", .{ty.fmt(pt)}); | 1004 | return self.fail("type '{f}' too big to fit into stack frame", .{ty.fmt(pt)}); |
| 1005 | }; | 1005 | }; |
| 1006 | const offset = off + abi_size; | 1006 | const offset = off + abi_size; |
| 1007 | break :blk .{ .stack_offset = offset }; | 1007 | break :blk .{ .stack_offset = offset }; |
| ... | @@ -2748,7 +2748,7 @@ fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { | ... | @@ -2748,7 +2748,7 @@ fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { |
| 2748 | } | 2748 | } |
| 2749 | 2749 | ||
| 2750 | const abi_size = math.cast(u32, elem_ty.abiSize(zcu)) orelse { | 2750 | const abi_size = math.cast(u32, elem_ty.abiSize(zcu)) orelse { |
| 2751 | return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(pt)}); | 2751 | return self.fail("type '{f}' too big to fit into stack frame", .{elem_ty.fmt(pt)}); |
| 2752 | }; | 2752 | }; |
| 2753 | // TODO swap this for inst.ty.ptrAlign | 2753 | // TODO swap this for inst.ty.ptrAlign |
| 2754 | const abi_align = elem_ty.abiAlignment(zcu); | 2754 | const abi_align = elem_ty.abiAlignment(zcu); |
| ... | @@ -2760,7 +2760,7 @@ fn allocRegOrMem(self: *Self, inst: Air.Inst.Index, reg_ok: bool) !MCValue { | ... | @@ -2760,7 +2760,7 @@ fn allocRegOrMem(self: *Self, inst: Air.Inst.Index, reg_ok: bool) !MCValue { |
| 2760 | const zcu = pt.zcu; | 2760 | const zcu = pt.zcu; |
| 2761 | const elem_ty = self.typeOfIndex(inst); | 2761 | const elem_ty = self.typeOfIndex(inst); |
| 2762 | const abi_size = math.cast(u32, elem_ty.abiSize(zcu)) orelse { | 2762 | const abi_size = math.cast(u32, elem_ty.abiSize(zcu)) orelse { |
| 2763 | return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(pt)}); | 2763 | return self.fail("type '{f}' too big to fit into stack frame", .{elem_ty.fmt(pt)}); |
| 2764 | }; | 2764 | }; |
| 2765 | const abi_align = elem_ty.abiAlignment(zcu); | 2765 | const abi_align = elem_ty.abiAlignment(zcu); |
| 2766 | self.stack_align = self.stack_align.max(abi_align); | 2766 | self.stack_align = self.stack_align.max(abi_align); |
| ... | @@ -4111,7 +4111,7 @@ fn getResolvedInstValue(self: *Self, inst: Air.Inst.Index) MCValue { | ... | @@ -4111,7 +4111,7 @@ fn getResolvedInstValue(self: *Self, inst: Air.Inst.Index) MCValue { |
| 4111 | while (true) { | 4111 | while (true) { |
| 4112 | i -= 1; | 4112 | i -= 1; |
| 4113 | if (self.branch_stack.items[i].inst_table.get(inst)) |mcv| { | 4113 | if (self.branch_stack.items[i].inst_table.get(inst)) |mcv| { |
| 4114 | log.debug("getResolvedInstValue %{} => {}", .{ inst, mcv }); | 4114 | log.debug("getResolvedInstValue %{f} => {}", .{ inst, mcv }); |
| 4115 | assert(mcv != .dead); | 4115 | assert(mcv != .dead); |
| 4116 | return mcv; | 4116 | return mcv; |
| 4117 | } | 4117 | } |
| ... | @@ -4382,7 +4382,7 @@ fn processDeath(self: *Self, inst: Air.Inst.Index) void { | ... | @@ -4382,7 +4382,7 @@ fn processDeath(self: *Self, inst: Air.Inst.Index) void { |
| 4382 | const prev_value = self.getResolvedInstValue(inst); | 4382 | const prev_value = self.getResolvedInstValue(inst); |
| 4383 | const branch = &self.branch_stack.items[self.branch_stack.items.len - 1]; | 4383 | const branch = &self.branch_stack.items[self.branch_stack.items.len - 1]; |
| 4384 | branch.inst_table.putAssumeCapacity(inst, .dead); | 4384 | branch.inst_table.putAssumeCapacity(inst, .dead); |
| 4385 | log.debug("%{} death: {} -> .dead", .{ inst, prev_value }); | 4385 | log.debug("%{f} death: {} -> .dead", .{ inst, prev_value }); |
| 4386 | switch (prev_value) { | 4386 | switch (prev_value) { |
| 4387 | .register => |reg| { | 4387 | .register => |reg| { |
| 4388 | self.register_manager.freeReg(reg); | 4388 | self.register_manager.freeReg(reg); |
src/arch/wasm/CodeGen.zig+18-24| ... | @@ -1463,7 +1463,7 @@ fn allocStack(cg: *CodeGen, ty: Type) !WValue { | ... | @@ -1463,7 +1463,7 @@ fn allocStack(cg: *CodeGen, ty: Type) !WValue { |
| 1463 | } | 1463 | } |
| 1464 | 1464 | ||
| 1465 | const abi_size = std.math.cast(u32, ty.abiSize(zcu)) orelse { | 1465 | const abi_size = std.math.cast(u32, ty.abiSize(zcu)) orelse { |
| 1466 | return cg.fail("Type {} with ABI size of {d} exceeds stack frame size", .{ | 1466 | return cg.fail("Type {f} with ABI size of {d} exceeds stack frame size", .{ |
| 1467 | ty.fmt(pt), ty.abiSize(zcu), | 1467 | ty.fmt(pt), ty.abiSize(zcu), |
| 1468 | }); | 1468 | }); |
| 1469 | }; | 1469 | }; |
| ... | @@ -1497,7 +1497,7 @@ fn allocStackPtr(cg: *CodeGen, inst: Air.Inst.Index) !WValue { | ... | @@ -1497,7 +1497,7 @@ fn allocStackPtr(cg: *CodeGen, inst: Air.Inst.Index) !WValue { |
| 1497 | 1497 | ||
| 1498 | const abi_alignment = ptr_ty.ptrAlignment(zcu); | 1498 | const abi_alignment = ptr_ty.ptrAlignment(zcu); |
| 1499 | const abi_size = std.math.cast(u32, pointee_ty.abiSize(zcu)) orelse { | 1499 | const abi_size = std.math.cast(u32, pointee_ty.abiSize(zcu)) orelse { |
| 1500 | return cg.fail("Type {} with ABI size of {d} exceeds stack frame size", .{ | 1500 | return cg.fail("Type {f} with ABI size of {d} exceeds stack frame size", .{ |
| 1501 | pointee_ty.fmt(pt), pointee_ty.abiSize(zcu), | 1501 | pointee_ty.fmt(pt), pointee_ty.abiSize(zcu), |
| 1502 | }); | 1502 | }); |
| 1503 | }; | 1503 | }; |
| ... | @@ -2046,7 +2046,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -2046,7 +2046,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 2046 | try cg.genInst(inst); | 2046 | try cg.genInst(inst); |
| 2047 | 2047 | ||
| 2048 | if (std.debug.runtime_safety and cg.air_bookkeeping < old_bookkeeping_value + 1) { | 2048 | if (std.debug.runtime_safety and cg.air_bookkeeping < old_bookkeeping_value + 1) { |
| 2049 | std.debug.panic("Missing call to `finishAir` in AIR instruction %{d} ('{}')", .{ | 2049 | std.debug.panic("Missing call to `finishAir` in AIR instruction %{d} ('{s}')", .{ |
| 2050 | inst, | 2050 | inst, |
| 2051 | cg.air.instructions.items(.tag)[@intFromEnum(inst)], | 2051 | cg.air.instructions.items(.tag)[@intFromEnum(inst)], |
| 2052 | }); | 2052 | }); |
| ... | @@ -2404,10 +2404,7 @@ fn store(cg: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerErr | ... | @@ -2404,10 +2404,7 @@ fn store(cg: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerErr |
| 2404 | try cg.memcpy(lhs, rhs, .{ .imm32 = @as(u32, @intCast(ty.abiSize(zcu))) }); | 2404 | try cg.memcpy(lhs, rhs, .{ .imm32 = @as(u32, @intCast(ty.abiSize(zcu))) }); |
| 2405 | }, | 2405 | }, |
| 2406 | else => if (abi_size > 8) { | 2406 | else => if (abi_size > 8) { |
| 2407 | return cg.fail("TODO: `store` for type `{}` with abisize `{d}`", .{ | 2407 | return cg.fail("TODO: `store` for type `{f}` with abisize `{d}`", .{ ty.fmt(pt), abi_size }); |
| 2408 | ty.fmt(pt), | ||
| 2409 | abi_size, | ||
| 2410 | }); | ||
| 2411 | }, | 2408 | }, |
| 2412 | } | 2409 | } |
| 2413 | try cg.emitWValue(lhs); | 2410 | try cg.emitWValue(lhs); |
| ... | @@ -2596,10 +2593,7 @@ fn binOp(cg: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: Op) InnerError!WV | ... | @@ -2596,10 +2593,7 @@ fn binOp(cg: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: Op) InnerError!WV |
| 2596 | if (ty.zigTypeTag(zcu) == .int) { | 2593 | if (ty.zigTypeTag(zcu) == .int) { |
| 2597 | return cg.binOpBigInt(lhs, rhs, ty, op); | 2594 | return cg.binOpBigInt(lhs, rhs, ty, op); |
| 2598 | } else { | 2595 | } else { |
| 2599 | return cg.fail( | 2596 | return cg.fail("TODO: Implement binary operation for type: {f}", .{ty.fmt(pt)}); |
| 2600 | "TODO: Implement binary operation for type: {}", | ||
| 2601 | .{ty.fmt(pt)}, | ||
| 2602 | ); | ||
| 2603 | } | 2597 | } |
| 2604 | } | 2598 | } |
| 2605 | 2599 | ||
| ... | @@ -2817,7 +2811,7 @@ fn airAbs(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -2817,7 +2811,7 @@ fn airAbs(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2817 | 2811 | ||
| 2818 | switch (scalar_ty.zigTypeTag(zcu)) { | 2812 | switch (scalar_ty.zigTypeTag(zcu)) { |
| 2819 | .int => if (ty.zigTypeTag(zcu) == .vector) { | 2813 | .int => if (ty.zigTypeTag(zcu) == .vector) { |
| 2820 | return cg.fail("TODO implement airAbs for {}", .{ty.fmt(pt)}); | 2814 | return cg.fail("TODO implement airAbs for {f}", .{ty.fmt(pt)}); |
| 2821 | } else { | 2815 | } else { |
| 2822 | const int_bits = ty.intInfo(zcu).bits; | 2816 | const int_bits = ty.intInfo(zcu).bits; |
| 2823 | const wasm_bits = toWasmBits(int_bits) orelse { | 2817 | const wasm_bits = toWasmBits(int_bits) orelse { |
| ... | @@ -3244,7 +3238,7 @@ fn lowerConstant(cg: *CodeGen, val: Value, ty: Type) InnerError!WValue { | ... | @@ -3244,7 +3238,7 @@ fn lowerConstant(cg: *CodeGen, val: Value, ty: Type) InnerError!WValue { |
| 3244 | return .{ .imm32 = @intFromBool(!val.isNull(zcu)) }; | 3238 | return .{ .imm32 = @intFromBool(!val.isNull(zcu)) }; |
| 3245 | }, | 3239 | }, |
| 3246 | .aggregate => switch (ip.indexToKey(ty.ip_index)) { | 3240 | .aggregate => switch (ip.indexToKey(ty.ip_index)) { |
| 3247 | .array_type => return cg.fail("Wasm TODO: LowerConstant for {}", .{ty.fmt(pt)}), | 3241 | .array_type => return cg.fail("Wasm TODO: LowerConstant for {f}", .{ty.fmt(pt)}), |
| 3248 | .vector_type => { | 3242 | .vector_type => { |
| 3249 | assert(determineSimdStoreStrategy(ty, zcu, cg.target) == .direct); | 3243 | assert(determineSimdStoreStrategy(ty, zcu, cg.target) == .direct); |
| 3250 | var buf: [16]u8 = undefined; | 3244 | var buf: [16]u8 = undefined; |
| ... | @@ -3332,7 +3326,7 @@ fn emitUndefined(cg: *CodeGen, ty: Type) InnerError!WValue { | ... | @@ -3332,7 +3326,7 @@ fn emitUndefined(cg: *CodeGen, ty: Type) InnerError!WValue { |
| 3332 | }, | 3326 | }, |
| 3333 | else => unreachable, | 3327 | else => unreachable, |
| 3334 | }, | 3328 | }, |
| 3335 | else => return cg.fail("Wasm TODO: emitUndefined for type: {}\n", .{ty.zigTypeTag(zcu)}), | 3329 | else => return cg.fail("Wasm TODO: emitUndefined for type: {s}\n", .{ty.zigTypeTag(zcu)}), |
| 3336 | } | 3330 | } |
| 3337 | } | 3331 | } |
| 3338 | 3332 | ||
| ... | @@ -3608,7 +3602,7 @@ fn airNot(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -3608,7 +3602,7 @@ fn airNot(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3608 | } else { | 3602 | } else { |
| 3609 | const int_info = operand_ty.intInfo(zcu); | 3603 | const int_info = operand_ty.intInfo(zcu); |
| 3610 | const wasm_bits = toWasmBits(int_info.bits) orelse { | 3604 | const wasm_bits = toWasmBits(int_info.bits) orelse { |
| 3611 | return cg.fail("TODO: Implement binary NOT for {}", .{operand_ty.fmt(pt)}); | 3605 | return cg.fail("TODO: Implement binary NOT for {f}", .{operand_ty.fmt(pt)}); |
| 3612 | }; | 3606 | }; |
| 3613 | 3607 | ||
| 3614 | switch (wasm_bits) { | 3608 | switch (wasm_bits) { |
| ... | @@ -3874,7 +3868,7 @@ fn airStructFieldVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -3874,7 +3868,7 @@ fn airStructFieldVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3874 | }, | 3868 | }, |
| 3875 | else => result: { | 3869 | else => result: { |
| 3876 | const offset = std.math.cast(u32, struct_ty.structFieldOffset(field_index, zcu)) orelse { | 3870 | const offset = std.math.cast(u32, struct_ty.structFieldOffset(field_index, zcu)) orelse { |
| 3877 | return cg.fail("Field type '{}' too big to fit into stack frame", .{field_ty.fmt(pt)}); | 3871 | return cg.fail("Field type '{f}' too big to fit into stack frame", .{field_ty.fmt(pt)}); |
| 3878 | }; | 3872 | }; |
| 3879 | if (isByRef(field_ty, zcu, cg.target)) { | 3873 | if (isByRef(field_ty, zcu, cg.target)) { |
| 3880 | switch (operand) { | 3874 | switch (operand) { |
| ... | @@ -4360,7 +4354,7 @@ fn isNull(cg: *CodeGen, operand: WValue, optional_ty: Type, opcode: std.wasm.Opc | ... | @@ -4360,7 +4354,7 @@ fn isNull(cg: *CodeGen, operand: WValue, optional_ty: Type, opcode: std.wasm.Opc |
| 4360 | // a pointer to the stack value | 4354 | // a pointer to the stack value |
| 4361 | if (payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) { | 4355 | if (payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) { |
| 4362 | const offset = std.math.cast(u32, payload_ty.abiSize(zcu)) orelse { | 4356 | const offset = std.math.cast(u32, payload_ty.abiSize(zcu)) orelse { |
| 4363 | return cg.fail("Optional type {} too big to fit into stack frame", .{optional_ty.fmt(pt)}); | 4357 | return cg.fail("Optional type {f} too big to fit into stack frame", .{optional_ty.fmt(pt)}); |
| 4364 | }; | 4358 | }; |
| 4365 | try cg.addMemArg(.i32_load8_u, .{ .offset = operand.offset() + offset, .alignment = 1 }); | 4359 | try cg.addMemArg(.i32_load8_u, .{ .offset = operand.offset() + offset, .alignment = 1 }); |
| 4366 | } | 4360 | } |
| ... | @@ -4430,7 +4424,7 @@ fn airOptionalPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void | ... | @@ -4430,7 +4424,7 @@ fn airOptionalPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void |
| 4430 | } | 4424 | } |
| 4431 | 4425 | ||
| 4432 | const offset = std.math.cast(u32, payload_ty.abiSize(zcu)) orelse { | 4426 | const offset = std.math.cast(u32, payload_ty.abiSize(zcu)) orelse { |
| 4433 | return cg.fail("Optional type {} too big to fit into stack frame", .{opt_ty.fmt(pt)}); | 4427 | return cg.fail("Optional type {f} too big to fit into stack frame", .{opt_ty.fmt(pt)}); |
| 4434 | }; | 4428 | }; |
| 4435 | 4429 | ||
| 4436 | try cg.emitWValue(operand); | 4430 | try cg.emitWValue(operand); |
| ... | @@ -4462,7 +4456,7 @@ fn airWrapOptional(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4462,7 +4456,7 @@ fn airWrapOptional(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4462 | break :result cg.reuseOperand(ty_op.operand, operand); | 4456 | break :result cg.reuseOperand(ty_op.operand, operand); |
| 4463 | } | 4457 | } |
| 4464 | const offset = std.math.cast(u32, payload_ty.abiSize(zcu)) orelse { | 4458 | const offset = std.math.cast(u32, payload_ty.abiSize(zcu)) orelse { |
| 4465 | return cg.fail("Optional type {} too big to fit into stack frame", .{op_ty.fmt(pt)}); | 4459 | return cg.fail("Optional type {f} too big to fit into stack frame", .{op_ty.fmt(pt)}); |
| 4466 | }; | 4460 | }; |
| 4467 | 4461 | ||
| 4468 | // Create optional type, set the non-null bit, and store the operand inside the optional type | 4462 | // Create optional type, set the non-null bit, and store the operand inside the optional type |
| ... | @@ -6196,7 +6190,7 @@ fn airMulWithOverflow(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6196,7 +6190,7 @@ fn airMulWithOverflow(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6196 | _ = try cg.load(overflow_ret, Type.i32, 0); | 6190 | _ = try cg.load(overflow_ret, Type.i32, 0); |
| 6197 | try cg.addLocal(.local_set, overflow_bit.local.value); | 6191 | try cg.addLocal(.local_set, overflow_bit.local.value); |
| 6198 | break :blk res; | 6192 | break :blk res; |
| 6199 | } else return cg.fail("TODO: @mulWithOverflow for {}", .{ty.fmt(pt)}); | 6193 | } else return cg.fail("TODO: @mulWithOverflow for {f}", .{ty.fmt(pt)}); |
| 6200 | var bin_op_local = try mul.toLocal(cg, ty); | 6194 | var bin_op_local = try mul.toLocal(cg, ty); |
| 6201 | defer bin_op_local.free(cg); | 6195 | defer bin_op_local.free(cg); |
| 6202 | 6196 | ||
| ... | @@ -6749,7 +6743,7 @@ fn airMod(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6749,7 +6743,7 @@ fn airMod(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6749 | const add = try cg.binOp(rem, rhs, ty, .add); | 6743 | const add = try cg.binOp(rem, rhs, ty, .add); |
| 6750 | break :result try cg.binOp(add, rhs, ty, .rem); | 6744 | break :result try cg.binOp(add, rhs, ty, .rem); |
| 6751 | } | 6745 | } |
| 6752 | return cg.fail("TODO: @mod for {}", .{ty.fmt(pt)}); | 6746 | return cg.fail("TODO: @mod for {f}", .{ty.fmt(pt)}); |
| 6753 | }; | 6747 | }; |
| 6754 | 6748 | ||
| 6755 | return cg.finishAir(inst, result, &.{ bin_op.lhs, bin_op.rhs }); | 6749 | return cg.finishAir(inst, result, &.{ bin_op.lhs, bin_op.rhs }); |
| ... | @@ -6767,7 +6761,7 @@ fn airSatMul(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6767,7 +6761,7 @@ fn airSatMul(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6767 | const lhs = try cg.resolveInst(bin_op.lhs); | 6761 | const lhs = try cg.resolveInst(bin_op.lhs); |
| 6768 | const rhs = try cg.resolveInst(bin_op.rhs); | 6762 | const rhs = try cg.resolveInst(bin_op.rhs); |
| 6769 | const wasm_bits = toWasmBits(int_info.bits) orelse { | 6763 | const wasm_bits = toWasmBits(int_info.bits) orelse { |
| 6770 | return cg.fail("TODO: mul_sat for {}", .{ty.fmt(pt)}); | 6764 | return cg.fail("TODO: mul_sat for {f}", .{ty.fmt(pt)}); |
| 6771 | }; | 6765 | }; |
| 6772 | 6766 | ||
| 6773 | switch (wasm_bits) { | 6767 | switch (wasm_bits) { |
| ... | @@ -6804,7 +6798,7 @@ fn airSatMul(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6804,7 +6798,7 @@ fn airSatMul(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6804 | }, | 6798 | }, |
| 6805 | 64 => { | 6799 | 64 => { |
| 6806 | if (!(int_info.bits == 64 and int_info.signedness == .signed)) { | 6800 | if (!(int_info.bits == 64 and int_info.signedness == .signed)) { |
| 6807 | return cg.fail("TODO: mul_sat for {}", .{ty.fmt(pt)}); | 6801 | return cg.fail("TODO: mul_sat for {f}", .{ty.fmt(pt)}); |
| 6808 | } | 6802 | } |
| 6809 | const overflow_ret = try cg.allocStack(Type.i32); | 6803 | const overflow_ret = try cg.allocStack(Type.i32); |
| 6810 | _ = try cg.callIntrinsic( | 6804 | _ = try cg.callIntrinsic( |
| ... | @@ -6822,7 +6816,7 @@ fn airSatMul(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6822,7 +6816,7 @@ fn airSatMul(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6822 | }, | 6816 | }, |
| 6823 | 128 => { | 6817 | 128 => { |
| 6824 | if (!(int_info.bits == 128 and int_info.signedness == .signed)) { | 6818 | if (!(int_info.bits == 128 and int_info.signedness == .signed)) { |
| 6825 | return cg.fail("TODO: mul_sat for {}", .{ty.fmt(pt)}); | 6819 | return cg.fail("TODO: mul_sat for {f}", .{ty.fmt(pt)}); |
| 6826 | } | 6820 | } |
| 6827 | const overflow_ret = try cg.allocStack(Type.i32); | 6821 | const overflow_ret = try cg.allocStack(Type.i32); |
| 6828 | const ret = try cg.callIntrinsic( | 6822 | const ret = try cg.callIntrinsic( |
src/arch/x86_64/Encoding.zig+2-9| ... | @@ -158,15 +158,8 @@ pub fn modRmExt(encoding: Encoding) u3 { | ... | @@ -158,15 +158,8 @@ pub fn modRmExt(encoding: Encoding) u3 { |
| 158 | }; | 158 | }; |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | pub fn format( | 161 | pub fn format(encoding: Encoding, writer: *std.io.Writer, comptime fmt: []const u8) std.io.Writer.Error!void { |
| 162 | encoding: Encoding, | 162 | comptime assert(fmt.len == 0); |
| 163 | comptime fmt: []const u8, | ||
| 164 | options: std.fmt.FormatOptions, | ||
| 165 | writer: anytype, | ||
| 166 | ) !void { | ||
| 167 | _ = options; | ||
| 168 | _ = fmt; | ||
| 169 | |||
| 170 | var opc = encoding.opcode(); | 163 | var opc = encoding.opcode(); |
| 171 | if (encoding.data.mode.isVex()) { | 164 | if (encoding.data.mode.isVex()) { |
| 172 | try writer.writeAll("VEX."); | 165 | try writer.writeAll("VEX."); |
src/arch/x86_64/bits.zig+6-19| ... | @@ -728,19 +728,14 @@ pub const FrameIndex = enum(u32) { | ... | @@ -728,19 +728,14 @@ pub const FrameIndex = enum(u32) { |
| 728 | return @intFromEnum(fi) < named_count; | 728 | return @intFromEnum(fi) < named_count; |
| 729 | } | 729 | } |
| 730 | 730 | ||
| 731 | pub fn format( | 731 | pub fn format(fi: FrameIndex, writer: *std.io.Writer, comptime fmt: []const u8) std.io.Writer.Error!void { |
| 732 | fi: FrameIndex, | ||
| 733 | comptime fmt: []const u8, | ||
| 734 | options: std.fmt.FormatOptions, | ||
| 735 | writer: anytype, | ||
| 736 | ) @TypeOf(writer).Error!void { | ||
| 737 | try writer.writeAll("FrameIndex"); | 732 | try writer.writeAll("FrameIndex"); |
| 738 | if (fi.isNamed()) { | 733 | if (fi.isNamed()) { |
| 739 | try writer.writeByte('.'); | 734 | try writer.writeByte('.'); |
| 740 | try writer.writeAll(@tagName(fi)); | 735 | try writer.writeAll(@tagName(fi)); |
| 741 | } else { | 736 | } else { |
| 742 | try writer.writeByte('('); | 737 | try writer.writeByte('('); |
| 743 | try std.fmt.formatType(@intFromEnum(fi), fmt, options, writer, 0); | 738 | try writer.printInt(fmt, .{}, @intFromEnum(fi)); |
| 744 | try writer.writeByte(')'); | 739 | try writer.writeByte(')'); |
| 745 | } | 740 | } |
| 746 | } | 741 | } |
| ... | @@ -844,12 +839,8 @@ pub const Memory = struct { | ... | @@ -844,12 +839,8 @@ pub const Memory = struct { |
| 844 | }; | 839 | }; |
| 845 | } | 840 | } |
| 846 | 841 | ||
| 847 | pub fn format( | 842 | pub fn format(s: Size, writer: *std.io.Writer, comptime f: []const u8) std.io.Writer.Error!void { |
| 848 | s: Size, | 843 | comptime assert(f.len == 0); |
| 849 | comptime _: []const u8, | ||
| 850 | _: std.fmt.FormatOptions, | ||
| 851 | writer: anytype, | ||
| 852 | ) @TypeOf(writer).Error!void { | ||
| 853 | if (s == .none) return; | 844 | if (s == .none) return; |
| 854 | try writer.writeAll(@tagName(s)); | 845 | try writer.writeAll(@tagName(s)); |
| 855 | switch (s) { | 846 | switch (s) { |
| ... | @@ -914,12 +905,8 @@ pub const Immediate = union(enum) { | ... | @@ -914,12 +905,8 @@ pub const Immediate = union(enum) { |
| 914 | return .{ .signed = x }; | 905 | return .{ .signed = x }; |
| 915 | } | 906 | } |
| 916 | 907 | ||
| 917 | pub fn format( | 908 | pub fn format(imm: Immediate, writer: *std.io.Writer, comptime f: []const u8) std.io.Writer.Error!void { |
| 918 | imm: Immediate, | 909 | comptime assert(f.len == 0); |
| 919 | comptime _: []const u8, | ||
| 920 | _: std.fmt.FormatOptions, | ||
| 921 | writer: anytype, | ||
| 922 | ) @TypeOf(writer).Error!void { | ||
| 923 | switch (imm) { | 910 | switch (imm) { |
| 924 | inline else => |int| try writer.print("{d}", .{int}), | 911 | inline else => |int| try writer.print("{d}", .{int}), |
| 925 | .nav => |nav_off| try writer.print("Nav({d}) + {d}", .{ @intFromEnum(nav_off.nav), nav_off.off }), | 912 | .nav => |nav_off| try writer.print("Nav({d}) + {d}", .{ @intFromEnum(nav_off.nav), nav_off.off }), |
src/codegen.zig+6-6| ... | @@ -237,7 +237,7 @@ pub fn generateLazySymbol( | ... | @@ -237,7 +237,7 @@ pub fn generateLazySymbol( |
| 237 | const target = &comp.root_mod.resolved_target.result; | 237 | const target = &comp.root_mod.resolved_target.result; |
| 238 | const endian = target.cpu.arch.endian(); | 238 | const endian = target.cpu.arch.endian(); |
| 239 | 239 | ||
| 240 | log.debug("generateLazySymbol: kind = {s}, ty = {}", .{ | 240 | log.debug("generateLazySymbol: kind = {s}, ty = {f}", .{ |
| 241 | @tagName(lazy_sym.kind), | 241 | @tagName(lazy_sym.kind), |
| 242 | Type.fromInterned(lazy_sym.ty).fmt(pt), | 242 | Type.fromInterned(lazy_sym.ty).fmt(pt), |
| 243 | }); | 243 | }); |
| ... | @@ -277,7 +277,7 @@ pub fn generateLazySymbol( | ... | @@ -277,7 +277,7 @@ pub fn generateLazySymbol( |
| 277 | code.appendAssumeCapacity(0); | 277 | code.appendAssumeCapacity(0); |
| 278 | } | 278 | } |
| 279 | } else { | 279 | } else { |
| 280 | return zcu.codegenFailType(lazy_sym.ty, "TODO implement generateLazySymbol for {s} {}", .{ | 280 | return zcu.codegenFailType(lazy_sym.ty, "TODO implement generateLazySymbol for {s} {f}", .{ |
| 281 | @tagName(lazy_sym.kind), Type.fromInterned(lazy_sym.ty).fmt(pt), | 281 | @tagName(lazy_sym.kind), Type.fromInterned(lazy_sym.ty).fmt(pt), |
| 282 | }); | 282 | }); |
| 283 | } | 283 | } |
| ... | @@ -310,7 +310,7 @@ pub fn generateSymbol( | ... | @@ -310,7 +310,7 @@ pub fn generateSymbol( |
| 310 | const target = zcu.getTarget(); | 310 | const target = zcu.getTarget(); |
| 311 | const endian = target.cpu.arch.endian(); | 311 | const endian = target.cpu.arch.endian(); |
| 312 | 312 | ||
| 313 | log.debug("generateSymbol: val = {}", .{val.fmtValue(pt)}); | 313 | log.debug("generateSymbol: val = {f}", .{val.fmtValue(pt)}); |
| 314 | 314 | ||
| 315 | if (val.isUndefDeep(zcu)) { | 315 | if (val.isUndefDeep(zcu)) { |
| 316 | const abi_size = math.cast(usize, ty.abiSize(zcu)) orelse return error.Overflow; | 316 | const abi_size = math.cast(usize, ty.abiSize(zcu)) orelse return error.Overflow; |
| ... | @@ -767,7 +767,7 @@ fn lowerUavRef( | ... | @@ -767,7 +767,7 @@ fn lowerUavRef( |
| 767 | const uav_ty = Type.fromInterned(ip.typeOf(uav_val)); | 767 | const uav_ty = Type.fromInterned(ip.typeOf(uav_val)); |
| 768 | const is_fn_body = uav_ty.zigTypeTag(zcu) == .@"fn"; | 768 | const is_fn_body = uav_ty.zigTypeTag(zcu) == .@"fn"; |
| 769 | 769 | ||
| 770 | log.debug("lowerUavRef: ty = {}", .{uav_ty.fmt(pt)}); | 770 | log.debug("lowerUavRef: ty = {f}", .{uav_ty.fmt(pt)}); |
| 771 | try code.ensureUnusedCapacity(gpa, ptr_width_bytes); | 771 | try code.ensureUnusedCapacity(gpa, ptr_width_bytes); |
| 772 | 772 | ||
| 773 | if (!is_fn_body and !uav_ty.hasRuntimeBits(zcu)) { | 773 | if (!is_fn_body and !uav_ty.hasRuntimeBits(zcu)) { |
| ... | @@ -913,7 +913,7 @@ pub fn genNavRef( | ... | @@ -913,7 +913,7 @@ pub fn genNavRef( |
| 913 | const zcu = pt.zcu; | 913 | const zcu = pt.zcu; |
| 914 | const ip = &zcu.intern_pool; | 914 | const ip = &zcu.intern_pool; |
| 915 | const nav = ip.getNav(nav_index); | 915 | const nav = ip.getNav(nav_index); |
| 916 | log.debug("genNavRef({})", .{nav.fqn.fmt(ip)}); | 916 | log.debug("genNavRef({f})", .{nav.fqn.fmt(ip)}); |
| 917 | 917 | ||
| 918 | const lib_name, const linkage, const is_threadlocal = if (nav.getExtern(ip)) |e| | 918 | const lib_name, const linkage, const is_threadlocal = if (nav.getExtern(ip)) |e| |
| 919 | .{ e.lib_name, e.linkage, e.is_threadlocal and zcu.comp.config.any_non_single_threaded } | 919 | .{ e.lib_name, e.linkage, e.is_threadlocal and zcu.comp.config.any_non_single_threaded } |
| ... | @@ -1065,7 +1065,7 @@ pub fn lowerValue(pt: Zcu.PerThread, val: Value, target: *const std.Target) Allo | ... | @@ -1065,7 +1065,7 @@ pub fn lowerValue(pt: Zcu.PerThread, val: Value, target: *const std.Target) Allo |
| 1065 | const ip = &zcu.intern_pool; | 1065 | const ip = &zcu.intern_pool; |
| 1066 | const ty = val.typeOf(zcu); | 1066 | const ty = val.typeOf(zcu); |
| 1067 | 1067 | ||
| 1068 | log.debug("lowerValue(@as({}, {}))", .{ ty.fmt(pt), val.fmtValue(pt) }); | 1068 | log.debug("lowerValue(@as({f}, {f}))", .{ ty.fmt(pt), val.fmtValue(pt) }); |
| 1069 | 1069 | ||
| 1070 | if (val.isUndef(zcu)) return .undef; | 1070 | if (val.isUndef(zcu)) return .undef; |
| 1071 | 1071 |
src/codegen/c.zig+2-10| ... | @@ -388,7 +388,7 @@ fn formatCTypePoolString(data: CTypePoolStringFormatData, w: *std.io.Writer) std | ... | @@ -388,7 +388,7 @@ fn formatCTypePoolString(data: CTypePoolStringFormatData, w: *std.io.Writer) std |
| 388 | if (data.ctype_pool_string.toSlice(data.ctype_pool)) |slice| | 388 | if (data.ctype_pool_string.toSlice(data.ctype_pool)) |slice| |
| 389 | try formatIdentOptions(slice, w, data.solo) | 389 | try formatIdentOptions(slice, w, data.solo) |
| 390 | else | 390 | else |
| 391 | try w.print("{}", .{data.ctype_pool_string.fmt(data.ctype_pool)}); | 391 | try w.print("{f}", .{data.ctype_pool_string.fmt(data.ctype_pool)}); |
| 392 | } | 392 | } |
| 393 | pub fn fmtCTypePoolString( | 393 | pub fn fmtCTypePoolString( |
| 394 | ctype_pool_string: CType.Pool.String, | 394 | ctype_pool_string: CType.Pool.String, |
| ... | @@ -2471,15 +2471,7 @@ const RenderCTypeTrailing = enum { | ... | @@ -2471,15 +2471,7 @@ const RenderCTypeTrailing = enum { |
| 2471 | no_space, | 2471 | no_space, |
| 2472 | maybe_space, | 2472 | maybe_space, |
| 2473 | 2473 | ||
| 2474 | pub fn format( | 2474 | pub fn format(self: @This(), w: *Writer, comptime fmt: []const u8) Writer.Error!void { |
| 2475 | self: @This(), | ||
| 2476 | comptime fmt: []const u8, | ||
| 2477 | _: std.fmt.FormatOptions, | ||
| 2478 | w: *Writer, | ||
| 2479 | ) @TypeOf(w).Error!void { | ||
| 2480 | if (fmt.len != 0) | ||
| 2481 | @compileError("invalid format string '" ++ fmt ++ "' for type '" ++ | ||
| 2482 | @typeName(@This()) ++ "'"); | ||
| 2483 | comptime assert(fmt.len == 0); | 2475 | comptime assert(fmt.len == 0); |
| 2484 | switch (self) { | 2476 | switch (self) { |
| 2485 | .no_space => {}, | 2477 | .no_space => {}, |
src/codegen/spirv.zig+4-4| ... | @@ -817,7 +817,7 @@ const NavGen = struct { | ... | @@ -817,7 +817,7 @@ const NavGen = struct { |
| 817 | const result_ty_id = try self.resolveType(ty, repr); | 817 | const result_ty_id = try self.resolveType(ty, repr); |
| 818 | const ip = &zcu.intern_pool; | 818 | const ip = &zcu.intern_pool; |
| 819 | 819 | ||
| 820 | log.debug("lowering constant: ty = {}, val = {}, key = {s}", .{ ty.fmt(pt), val.fmtValue(pt), @tagName(ip.indexToKey(val.toIntern())) }); | 820 | log.debug("lowering constant: ty = {f}, val = {f}, key = {s}", .{ ty.fmt(pt), val.fmtValue(pt), @tagName(ip.indexToKey(val.toIntern())) }); |
| 821 | if (val.isUndefDeep(zcu)) { | 821 | if (val.isUndefDeep(zcu)) { |
| 822 | return self.spv.constUndef(result_ty_id); | 822 | return self.spv.constUndef(result_ty_id); |
| 823 | } | 823 | } |
| ... | @@ -1147,7 +1147,7 @@ const NavGen = struct { | ... | @@ -1147,7 +1147,7 @@ const NavGen = struct { |
| 1147 | return result_ptr_id; | 1147 | return result_ptr_id; |
| 1148 | } | 1148 | } |
| 1149 | 1149 | ||
| 1150 | return self.fail("cannot perform pointer cast: '{}' to '{}'", .{ | 1150 | return self.fail("cannot perform pointer cast: '{f}' to '{f}'", .{ |
| 1151 | parent_ptr_ty.fmt(pt), | 1151 | parent_ptr_ty.fmt(pt), |
| 1152 | oac.new_ptr_ty.fmt(pt), | 1152 | oac.new_ptr_ty.fmt(pt), |
| 1153 | }); | 1153 | }); |
| ... | @@ -1464,7 +1464,7 @@ const NavGen = struct { | ... | @@ -1464,7 +1464,7 @@ const NavGen = struct { |
| 1464 | const pt = self.pt; | 1464 | const pt = self.pt; |
| 1465 | const zcu = pt.zcu; | 1465 | const zcu = pt.zcu; |
| 1466 | const ip = &zcu.intern_pool; | 1466 | const ip = &zcu.intern_pool; |
| 1467 | log.debug("resolveType: ty = {}", .{ty.fmt(pt)}); | 1467 | log.debug("resolveType: ty = {f}", .{ty.fmt(pt)}); |
| 1468 | const target = self.spv.target; | 1468 | const target = self.spv.target; |
| 1469 | 1469 | ||
| 1470 | const section = &self.spv.sections.types_globals_constants; | 1470 | const section = &self.spv.sections.types_globals_constants; |
| ... | @@ -3070,7 +3070,7 @@ const NavGen = struct { | ... | @@ -3070,7 +3070,7 @@ const NavGen = struct { |
| 3070 | try self.func.body.emit(self.spv.gpa, .OpFunctionEnd, {}); | 3070 | try self.func.body.emit(self.spv.gpa, .OpFunctionEnd, {}); |
| 3071 | try self.spv.addFunction(spv_decl_index, self.func); | 3071 | try self.spv.addFunction(spv_decl_index, self.func); |
| 3072 | 3072 | ||
| 3073 | try self.spv.debugNameFmt(initializer_id, "initializer of {}", .{nav.fqn.fmt(ip)}); | 3073 | try self.spv.debugNameFmt(initializer_id, "initializer of {f}", .{nav.fqn.fmt(ip)}); |
| 3074 | 3074 | ||
| 3075 | try self.spv.sections.types_globals_constants.emit(self.spv.gpa, .OpExtInst, .{ | 3075 | try self.spv.sections.types_globals_constants.emit(self.spv.gpa, .OpExtInst, .{ |
| 3076 | .id_result_type = ptr_ty_id, | 3076 | .id_result_type = ptr_ty_id, |
src/codegen/spirv/spec.zig+4-7| ... | @@ -1,6 +1,7 @@ | ... | @@ -1,6 +1,7 @@ |
| 1 | //! This file is auto-generated by tools/gen_spirv_spec.zig. | 1 | //! This file is auto-generated by tools/gen_spirv_spec.zig. |
| 2 | 2 | ||
| 3 | const std = @import("std"); | 3 | const std = @import("std"); |
| 4 | const assert = std.debug.assert; | ||
| 4 | 5 | ||
| 5 | pub const Version = packed struct(Word) { | 6 | pub const Version = packed struct(Word) { |
| 6 | padding: u8 = 0, | 7 | padding: u8 = 0, |
| ... | @@ -18,15 +19,11 @@ pub const IdResult = enum(Word) { | ... | @@ -18,15 +19,11 @@ pub const IdResult = enum(Word) { |
| 18 | none, | 19 | none, |
| 19 | _, | 20 | _, |
| 20 | 21 | ||
| 21 | pub fn format( | 22 | pub fn format(self: IdResult, writer: *std.io.Writer, comptime f: []const u8) std.io.Writer.Error!void { |
| 22 | self: IdResult, | 23 | comptime assert(f.len == 0); |
| 23 | comptime _: []const u8, | ||
| 24 | _: std.fmt.FormatOptions, | ||
| 25 | writer: anytype, | ||
| 26 | ) @TypeOf(writer).Error!void { | ||
| 27 | switch (self) { | 24 | switch (self) { |
| 28 | .none => try writer.writeAll("(none)"), | 25 | .none => try writer.writeAll("(none)"), |
| 29 | else => try writer.print("%{}", .{@intFromEnum(self)}), | 26 | else => try writer.print("%{d}", .{@intFromEnum(self)}), |
| 30 | } | 27 | } |
| 31 | } | 28 | } |
| 32 | }; | 29 | }; |
src/link.zig+16-16| ... | @@ -323,7 +323,7 @@ pub const Diags = struct { | ... | @@ -323,7 +323,7 @@ pub const Diags = struct { |
| 323 | const main_msg = try m; | 323 | const main_msg = try m; |
| 324 | errdefer gpa.free(main_msg); | 324 | errdefer gpa.free(main_msg); |
| 325 | try diags.msgs.ensureUnusedCapacity(gpa, 1); | 325 | try diags.msgs.ensureUnusedCapacity(gpa, 1); |
| 326 | const note = try std.fmt.allocPrint(gpa, "while parsing {}", .{path}); | 326 | const note = try std.fmt.allocPrint(gpa, "while parsing {f}", .{path}); |
| 327 | errdefer gpa.free(note); | 327 | errdefer gpa.free(note); |
| 328 | const notes = try gpa.create([1]Msg); | 328 | const notes = try gpa.create([1]Msg); |
| 329 | errdefer gpa.destroy(notes); | 329 | errdefer gpa.destroy(notes); |
| ... | @@ -1351,7 +1351,7 @@ pub fn doPrelinkTask(comp: *Compilation, task: PrelinkTask) void { | ... | @@ -1351,7 +1351,7 @@ pub fn doPrelinkTask(comp: *Compilation, task: PrelinkTask) void { |
| 1351 | .search_strategy = .paths_first, | 1351 | .search_strategy = .paths_first, |
| 1352 | }) catch |archive_err| switch (archive_err) { | 1352 | }) catch |archive_err| switch (archive_err) { |
| 1353 | error.LinkFailure => return, // error reported via diags | 1353 | error.LinkFailure => return, // error reported via diags |
| 1354 | else => |e| diags.addParseError(dso_path, "failed to parse archive {}: {s}", .{ archive_path, @errorName(e) }), | 1354 | else => |e| diags.addParseError(dso_path, "failed to parse archive {f}: {s}", .{ archive_path, @errorName(e) }), |
| 1355 | }; | 1355 | }; |
| 1356 | }, | 1356 | }, |
| 1357 | error.LinkFailure => return, // error reported via diags | 1357 | error.LinkFailure => return, // error reported via diags |
| ... | @@ -1874,7 +1874,7 @@ pub fn resolveInputs( | ... | @@ -1874,7 +1874,7 @@ pub fn resolveInputs( |
| 1874 | )) |lib_result| { | 1874 | )) |lib_result| { |
| 1875 | switch (lib_result) { | 1875 | switch (lib_result) { |
| 1876 | .ok => {}, | 1876 | .ok => {}, |
| 1877 | .no_match => fatal("{}: file not found", .{pq.path}), | 1877 | .no_match => fatal("{f}: file not found", .{pq.path}), |
| 1878 | } | 1878 | } |
| 1879 | } | 1879 | } |
| 1880 | continue; | 1880 | continue; |
| ... | @@ -1928,10 +1928,10 @@ fn resolveLibInput( | ... | @@ -1928,10 +1928,10 @@ fn resolveLibInput( |
| 1928 | .root_dir = lib_directory, | 1928 | .root_dir = lib_directory, |
| 1929 | .sub_path = try std.fmt.allocPrint(arena, "lib{s}.tbd", .{lib_name}), | 1929 | .sub_path = try std.fmt.allocPrint(arena, "lib{s}.tbd", .{lib_name}), |
| 1930 | }; | 1930 | }; |
| 1931 | try checked_paths.writer(gpa).print("\n {}", .{test_path}); | 1931 | try checked_paths.writer(gpa).print("\n {f}", .{test_path}); |
| 1932 | var file = test_path.root_dir.handle.openFile(test_path.sub_path, .{}) catch |err| switch (err) { | 1932 | var file = test_path.root_dir.handle.openFile(test_path.sub_path, .{}) catch |err| switch (err) { |
| 1933 | error.FileNotFound => break :tbd, | 1933 | error.FileNotFound => break :tbd, |
| 1934 | else => |e| fatal("unable to search for tbd library '{}': {s}", .{ test_path, @errorName(e) }), | 1934 | else => |e| fatal("unable to search for tbd library '{f}': {s}", .{ test_path, @errorName(e) }), |
| 1935 | }; | 1935 | }; |
| 1936 | errdefer file.close(); | 1936 | errdefer file.close(); |
| 1937 | return finishResolveLibInput(resolved_inputs, test_path, file, link_mode, name_query.query); | 1937 | return finishResolveLibInput(resolved_inputs, test_path, file, link_mode, name_query.query); |
| ... | @@ -1947,7 +1947,7 @@ fn resolveLibInput( | ... | @@ -1947,7 +1947,7 @@ fn resolveLibInput( |
| 1947 | }, | 1947 | }, |
| 1948 | }), | 1948 | }), |
| 1949 | }; | 1949 | }; |
| 1950 | try checked_paths.writer(gpa).print("\n {}", .{test_path}); | 1950 | try checked_paths.writer(gpa).print("\n {f}", .{test_path}); |
| 1951 | switch (try resolvePathInputLib(gpa, arena, unresolved_inputs, resolved_inputs, ld_script_bytes, target, .{ | 1951 | switch (try resolvePathInputLib(gpa, arena, unresolved_inputs, resolved_inputs, ld_script_bytes, target, .{ |
| 1952 | .path = test_path, | 1952 | .path = test_path, |
| 1953 | .query = name_query.query, | 1953 | .query = name_query.query, |
| ... | @@ -1964,10 +1964,10 @@ fn resolveLibInput( | ... | @@ -1964,10 +1964,10 @@ fn resolveLibInput( |
| 1964 | .root_dir = lib_directory, | 1964 | .root_dir = lib_directory, |
| 1965 | .sub_path = try std.fmt.allocPrint(arena, "lib{s}.so", .{lib_name}), | 1965 | .sub_path = try std.fmt.allocPrint(arena, "lib{s}.so", .{lib_name}), |
| 1966 | }; | 1966 | }; |
| 1967 | try checked_paths.writer(gpa).print("\n {}", .{test_path}); | 1967 | try checked_paths.writer(gpa).print("\n {f}", .{test_path}); |
| 1968 | var file = test_path.root_dir.handle.openFile(test_path.sub_path, .{}) catch |err| switch (err) { | 1968 | var file = test_path.root_dir.handle.openFile(test_path.sub_path, .{}) catch |err| switch (err) { |
| 1969 | error.FileNotFound => break :so, | 1969 | error.FileNotFound => break :so, |
| 1970 | else => |e| fatal("unable to search for so library '{}': {s}", .{ | 1970 | else => |e| fatal("unable to search for so library '{f}': {s}", .{ |
| 1971 | test_path, @errorName(e), | 1971 | test_path, @errorName(e), |
| 1972 | }), | 1972 | }), |
| 1973 | }; | 1973 | }; |
| ... | @@ -1982,10 +1982,10 @@ fn resolveLibInput( | ... | @@ -1982,10 +1982,10 @@ fn resolveLibInput( |
| 1982 | .root_dir = lib_directory, | 1982 | .root_dir = lib_directory, |
| 1983 | .sub_path = try std.fmt.allocPrint(arena, "lib{s}.a", .{lib_name}), | 1983 | .sub_path = try std.fmt.allocPrint(arena, "lib{s}.a", .{lib_name}), |
| 1984 | }; | 1984 | }; |
| 1985 | try checked_paths.writer(gpa).print("\n {}", .{test_path}); | 1985 | try checked_paths.writer(gpa).print("\n {f}", .{test_path}); |
| 1986 | var file = test_path.root_dir.handle.openFile(test_path.sub_path, .{}) catch |err| switch (err) { | 1986 | var file = test_path.root_dir.handle.openFile(test_path.sub_path, .{}) catch |err| switch (err) { |
| 1987 | error.FileNotFound => break :mingw, | 1987 | error.FileNotFound => break :mingw, |
| 1988 | else => |e| fatal("unable to search for static library '{}': {s}", .{ test_path, @errorName(e) }), | 1988 | else => |e| fatal("unable to search for static library '{f}': {s}", .{ test_path, @errorName(e) }), |
| 1989 | }; | 1989 | }; |
| 1990 | errdefer file.close(); | 1990 | errdefer file.close(); |
| 1991 | return finishResolveLibInput(resolved_inputs, test_path, file, link_mode, name_query.query); | 1991 | return finishResolveLibInput(resolved_inputs, test_path, file, link_mode, name_query.query); |
| ... | @@ -2037,7 +2037,7 @@ fn resolvePathInput( | ... | @@ -2037,7 +2037,7 @@ fn resolvePathInput( |
| 2037 | .shared_library => return try resolvePathInputLib(gpa, arena, unresolved_inputs, resolved_inputs, ld_script_bytes, target, pq, .dynamic, color), | 2037 | .shared_library => return try resolvePathInputLib(gpa, arena, unresolved_inputs, resolved_inputs, ld_script_bytes, target, pq, .dynamic, color), |
| 2038 | .object => { | 2038 | .object => { |
| 2039 | var file = pq.path.root_dir.handle.openFile(pq.path.sub_path, .{}) catch |err| | 2039 | var file = pq.path.root_dir.handle.openFile(pq.path.sub_path, .{}) catch |err| |
| 2040 | fatal("failed to open object {}: {s}", .{ pq.path, @errorName(err) }); | 2040 | fatal("failed to open object {f}: {s}", .{ pq.path, @errorName(err) }); |
| 2041 | errdefer file.close(); | 2041 | errdefer file.close(); |
| 2042 | try resolved_inputs.append(gpa, .{ .object = .{ | 2042 | try resolved_inputs.append(gpa, .{ .object = .{ |
| 2043 | .path = pq.path, | 2043 | .path = pq.path, |
| ... | @@ -2049,7 +2049,7 @@ fn resolvePathInput( | ... | @@ -2049,7 +2049,7 @@ fn resolvePathInput( |
| 2049 | }, | 2049 | }, |
| 2050 | .res => { | 2050 | .res => { |
| 2051 | var file = pq.path.root_dir.handle.openFile(pq.path.sub_path, .{}) catch |err| | 2051 | var file = pq.path.root_dir.handle.openFile(pq.path.sub_path, .{}) catch |err| |
| 2052 | fatal("failed to open windows resource {}: {s}", .{ pq.path, @errorName(err) }); | 2052 | fatal("failed to open windows resource {f}: {s}", .{ pq.path, @errorName(err) }); |
| 2053 | errdefer file.close(); | 2053 | errdefer file.close(); |
| 2054 | try resolved_inputs.append(gpa, .{ .res = .{ | 2054 | try resolved_inputs.append(gpa, .{ .res = .{ |
| 2055 | .path = pq.path, | 2055 | .path = pq.path, |
| ... | @@ -2057,7 +2057,7 @@ fn resolvePathInput( | ... | @@ -2057,7 +2057,7 @@ fn resolvePathInput( |
| 2057 | } }); | 2057 | } }); |
| 2058 | return null; | 2058 | return null; |
| 2059 | }, | 2059 | }, |
| 2060 | else => fatal("{}: unrecognized file extension", .{pq.path}), | 2060 | else => fatal("{f}: unrecognized file extension", .{pq.path}), |
| 2061 | } | 2061 | } |
| 2062 | } | 2062 | } |
| 2063 | 2063 | ||
| ... | @@ -2192,19 +2192,19 @@ pub fn openDso(path: Path, needed: bool, weak: bool, reexport: bool) !Input.Dso | ... | @@ -2192,19 +2192,19 @@ pub fn openDso(path: Path, needed: bool, weak: bool, reexport: bool) !Input.Dso |
| 2192 | 2192 | ||
| 2193 | pub fn openObjectInput(diags: *Diags, path: Path) error{LinkFailure}!Input { | 2193 | pub fn openObjectInput(diags: *Diags, path: Path) error{LinkFailure}!Input { |
| 2194 | return .{ .object = openObject(path, false, false) catch |err| { | 2194 | return .{ .object = openObject(path, false, false) catch |err| { |
| 2195 | return diags.failParse(path, "failed to open {}: {s}", .{ path, @errorName(err) }); | 2195 | return diags.failParse(path, "failed to open {f}: {s}", .{ path, @errorName(err) }); |
| 2196 | } }; | 2196 | } }; |
| 2197 | } | 2197 | } |
| 2198 | 2198 | ||
| 2199 | pub fn openArchiveInput(diags: *Diags, path: Path, must_link: bool, hidden: bool) error{LinkFailure}!Input { | 2199 | pub fn openArchiveInput(diags: *Diags, path: Path, must_link: bool, hidden: bool) error{LinkFailure}!Input { |
| 2200 | return .{ .archive = openObject(path, must_link, hidden) catch |err| { | 2200 | return .{ .archive = openObject(path, must_link, hidden) catch |err| { |
| 2201 | return diags.failParse(path, "failed to open {}: {s}", .{ path, @errorName(err) }); | 2201 | return diags.failParse(path, "failed to open {f}: {s}", .{ path, @errorName(err) }); |
| 2202 | } }; | 2202 | } }; |
| 2203 | } | 2203 | } |
| 2204 | 2204 | ||
| 2205 | pub fn openDsoInput(diags: *Diags, path: Path, needed: bool, weak: bool, reexport: bool) error{LinkFailure}!Input { | 2205 | pub fn openDsoInput(diags: *Diags, path: Path, needed: bool, weak: bool, reexport: bool) error{LinkFailure}!Input { |
| 2206 | return .{ .dso = openDso(path, needed, weak, reexport) catch |err| { | 2206 | return .{ .dso = openDso(path, needed, weak, reexport) catch |err| { |
| 2207 | return diags.failParse(path, "failed to open {}: {s}", .{ path, @errorName(err) }); | 2207 | return diags.failParse(path, "failed to open {f}: {s}", .{ path, @errorName(err) }); |
| 2208 | } }; | 2208 | } }; |
| 2209 | } | 2209 | } |
| 2210 | 2210 |
src/link/Coff.zig+8-8| ... | @@ -1213,7 +1213,7 @@ fn updateLazySymbolAtom( | ... | @@ -1213,7 +1213,7 @@ fn updateLazySymbolAtom( |
| 1213 | var code_buffer: std.ArrayListUnmanaged(u8) = .empty; | 1213 | var code_buffer: std.ArrayListUnmanaged(u8) = .empty; |
| 1214 | defer code_buffer.deinit(gpa); | 1214 | defer code_buffer.deinit(gpa); |
| 1215 | 1215 | ||
| 1216 | const name = try allocPrint(gpa, "__lazy_{s}_{}", .{ | 1216 | const name = try allocPrint(gpa, "__lazy_{s}_{f}", .{ |
| 1217 | @tagName(sym.kind), | 1217 | @tagName(sym.kind), |
| 1218 | Type.fromInterned(sym.ty).fmt(pt), | 1218 | Type.fromInterned(sym.ty).fmt(pt), |
| 1219 | }); | 1219 | }); |
| ... | @@ -1333,7 +1333,7 @@ fn updateNavCode( | ... | @@ -1333,7 +1333,7 @@ fn updateNavCode( |
| 1333 | const ip = &zcu.intern_pool; | 1333 | const ip = &zcu.intern_pool; |
| 1334 | const nav = ip.getNav(nav_index); | 1334 | const nav = ip.getNav(nav_index); |
| 1335 | 1335 | ||
| 1336 | log.debug("updateNavCode {} 0x{x}", .{ nav.fqn.fmt(ip), nav_index }); | 1336 | log.debug("updateNavCode {f} 0x{x}", .{ nav.fqn.fmt(ip), nav_index }); |
| 1337 | 1337 | ||
| 1338 | const target = &zcu.navFileScope(nav_index).mod.?.resolved_target.result; | 1338 | const target = &zcu.navFileScope(nav_index).mod.?.resolved_target.result; |
| 1339 | const required_alignment = switch (pt.navAlignment(nav_index)) { | 1339 | const required_alignment = switch (pt.navAlignment(nav_index)) { |
| ... | @@ -1361,7 +1361,7 @@ fn updateNavCode( | ... | @@ -1361,7 +1361,7 @@ fn updateNavCode( |
| 1361 | error.OutOfMemory => return error.OutOfMemory, | 1361 | error.OutOfMemory => return error.OutOfMemory, |
| 1362 | else => |e| return coff.base.cgFail(nav_index, "failed to grow atom: {s}", .{@errorName(e)}), | 1362 | else => |e| return coff.base.cgFail(nav_index, "failed to grow atom: {s}", .{@errorName(e)}), |
| 1363 | }; | 1363 | }; |
| 1364 | log.debug("growing {} from 0x{x} to 0x{x}", .{ nav.fqn.fmt(ip), sym.value, vaddr }); | 1364 | log.debug("growing {f} from 0x{x} to 0x{x}", .{ nav.fqn.fmt(ip), sym.value, vaddr }); |
| 1365 | log.debug(" (required alignment 0x{x}", .{required_alignment}); | 1365 | log.debug(" (required alignment 0x{x}", .{required_alignment}); |
| 1366 | 1366 | ||
| 1367 | if (vaddr != sym.value) { | 1367 | if (vaddr != sym.value) { |
| ... | @@ -1389,7 +1389,7 @@ fn updateNavCode( | ... | @@ -1389,7 +1389,7 @@ fn updateNavCode( |
| 1389 | else => |e| return coff.base.cgFail(nav_index, "failed to allocate atom: {s}", .{@errorName(e)}), | 1389 | else => |e| return coff.base.cgFail(nav_index, "failed to allocate atom: {s}", .{@errorName(e)}), |
| 1390 | }; | 1390 | }; |
| 1391 | errdefer coff.freeAtom(atom_index); | 1391 | errdefer coff.freeAtom(atom_index); |
| 1392 | log.debug("allocated atom for {} at 0x{x}", .{ nav.fqn.fmt(ip), vaddr }); | 1392 | log.debug("allocated atom for {f} at 0x{x}", .{ nav.fqn.fmt(ip), vaddr }); |
| 1393 | coff.getAtomPtr(atom_index).size = code_len; | 1393 | coff.getAtomPtr(atom_index).size = code_len; |
| 1394 | sym.value = vaddr; | 1394 | sym.value = vaddr; |
| 1395 | 1395 | ||
| ... | @@ -1454,7 +1454,7 @@ pub fn updateExports( | ... | @@ -1454,7 +1454,7 @@ pub fn updateExports( |
| 1454 | 1454 | ||
| 1455 | for (export_indices) |export_idx| { | 1455 | for (export_indices) |export_idx| { |
| 1456 | const exp = export_idx.ptr(zcu); | 1456 | const exp = export_idx.ptr(zcu); |
| 1457 | log.debug("adding new export '{}'", .{exp.opts.name.fmt(&zcu.intern_pool)}); | 1457 | log.debug("adding new export '{f}'", .{exp.opts.name.fmt(&zcu.intern_pool)}); |
| 1458 | 1458 | ||
| 1459 | if (exp.opts.section.toSlice(&zcu.intern_pool)) |section_name| { | 1459 | if (exp.opts.section.toSlice(&zcu.intern_pool)) |section_name| { |
| 1460 | if (!mem.eql(u8, section_name, ".text")) { | 1460 | if (!mem.eql(u8, section_name, ".text")) { |
| ... | @@ -1530,7 +1530,7 @@ pub fn deleteExport( | ... | @@ -1530,7 +1530,7 @@ pub fn deleteExport( |
| 1530 | const gpa = coff.base.comp.gpa; | 1530 | const gpa = coff.base.comp.gpa; |
| 1531 | const sym_loc = SymbolWithLoc{ .sym_index = sym_index.*, .file = null }; | 1531 | const sym_loc = SymbolWithLoc{ .sym_index = sym_index.*, .file = null }; |
| 1532 | const sym = coff.getSymbolPtr(sym_loc); | 1532 | const sym = coff.getSymbolPtr(sym_loc); |
| 1533 | log.debug("deleting export '{}'", .{name.fmt(&zcu.intern_pool)}); | 1533 | log.debug("deleting export '{f}'", .{name.fmt(&zcu.intern_pool)}); |
| 1534 | assert(sym.storage_class == .EXTERNAL and sym.section_number != .UNDEFINED); | 1534 | assert(sym.storage_class == .EXTERNAL and sym.section_number != .UNDEFINED); |
| 1535 | sym.* = .{ | 1535 | sym.* = .{ |
| 1536 | .name = [_]u8{0} ** 8, | 1536 | .name = [_]u8{0} ** 8, |
| ... | @@ -1748,7 +1748,7 @@ pub fn getNavVAddr( | ... | @@ -1748,7 +1748,7 @@ pub fn getNavVAddr( |
| 1748 | const zcu = pt.zcu; | 1748 | const zcu = pt.zcu; |
| 1749 | const ip = &zcu.intern_pool; | 1749 | const ip = &zcu.intern_pool; |
| 1750 | const nav = ip.getNav(nav_index); | 1750 | const nav = ip.getNav(nav_index); |
| 1751 | log.debug("getNavVAddr {}({d})", .{ nav.fqn.fmt(ip), nav_index }); | 1751 | log.debug("getNavVAddr {f}({d})", .{ nav.fqn.fmt(ip), nav_index }); |
| 1752 | const sym_index = if (nav.getExtern(ip)) |e| | 1752 | const sym_index = if (nav.getExtern(ip)) |e| |
| 1753 | try coff.getGlobalSymbol(nav.name.toSlice(ip), e.lib_name.toSlice(ip)) | 1753 | try coff.getGlobalSymbol(nav.name.toSlice(ip), e.lib_name.toSlice(ip)) |
| 1754 | else | 1754 | else |
| ... | @@ -2605,7 +2605,7 @@ fn logSymtab(coff: *Coff) void { | ... | @@ -2605,7 +2605,7 @@ fn logSymtab(coff: *Coff) void { |
| 2605 | } | 2605 | } |
| 2606 | 2606 | ||
| 2607 | log.debug("GOT entries:", .{}); | 2607 | log.debug("GOT entries:", .{}); |
| 2608 | log.debug("{}", .{coff.got_table}); | 2608 | log.debug("{f}", .{coff.got_table}); |
| 2609 | } | 2609 | } |
| 2610 | 2610 | ||
| 2611 | fn logSections(coff: *Coff) void { | 2611 | fn logSections(coff: *Coff) void { |
src/link/Dwarf.zig+12-12| ... | @@ -973,7 +973,7 @@ const Entry = struct { | ... | @@ -973,7 +973,7 @@ const Entry = struct { |
| 973 | else | 973 | else |
| 974 | .main; | 974 | .main; |
| 975 | if (sec.getUnit(ty_unit) == unit and unit.getEntry(other_entry) == entry) | 975 | if (sec.getUnit(ty_unit) == unit and unit.getEntry(other_entry) == entry) |
| 976 | log.err("missing Type({}({d}))", .{ | 976 | log.err("missing Type({f}({d}))", .{ |
| 977 | Type.fromInterned(ty).fmt(.{ .tid = .main, .zcu = zcu }), | 977 | Type.fromInterned(ty).fmt(.{ .tid = .main, .zcu = zcu }), |
| 978 | @intFromEnum(ty), | 978 | @intFromEnum(ty), |
| 979 | }); | 979 | }); |
| ... | @@ -981,7 +981,7 @@ const Entry = struct { | ... | @@ -981,7 +981,7 @@ const Entry = struct { |
| 981 | for (dwarf.navs.keys(), dwarf.navs.values()) |nav, other_entry| { | 981 | for (dwarf.navs.keys(), dwarf.navs.values()) |nav, other_entry| { |
| 982 | const nav_unit = dwarf.getUnit(zcu.fileByIndex(ip.getNav(nav).srcInst(ip).resolveFile(ip)).mod.?) catch unreachable; | 982 | const nav_unit = dwarf.getUnit(zcu.fileByIndex(ip.getNav(nav).srcInst(ip).resolveFile(ip)).mod.?) catch unreachable; |
| 983 | if (sec.getUnit(nav_unit) == unit and unit.getEntry(other_entry) == entry) | 983 | if (sec.getUnit(nav_unit) == unit and unit.getEntry(other_entry) == entry) |
| 984 | log.err("missing Nav({}({d}))", .{ ip.getNav(nav).fqn.fmt(ip), @intFromEnum(nav) }); | 984 | log.err("missing Nav({f}({d}))", .{ ip.getNav(nav).fqn.fmt(ip), @intFromEnum(nav) }); |
| 985 | } | 985 | } |
| 986 | } | 986 | } |
| 987 | @panic("missing dwarf relocation target"); | 987 | @panic("missing dwarf relocation target"); |
| ... | @@ -1957,7 +1957,7 @@ pub const WipNav = struct { | ... | @@ -1957,7 +1957,7 @@ pub const WipNav = struct { |
| 1957 | .{ .debug_output = .{ .dwarf = wip_nav } }, | 1957 | .{ .debug_output = .{ .dwarf = wip_nav } }, |
| 1958 | ); | 1958 | ); |
| 1959 | if (old_len + bytes != wip_nav.debug_info.items.len) { | 1959 | if (old_len + bytes != wip_nav.debug_info.items.len) { |
| 1960 | std.debug.print("{} [{}]: {} != {}\n", .{ ty.fmt(wip_nav.pt), ty.toIntern(), bytes, wip_nav.debug_info.items.len - old_len }); | 1960 | std.debug.print("{f} [{}]: {} != {}\n", .{ ty.fmt(wip_nav.pt), ty.toIntern(), bytes, wip_nav.debug_info.items.len - old_len }); |
| 1961 | unreachable; | 1961 | unreachable; |
| 1962 | } | 1962 | } |
| 1963 | } | 1963 | } |
| ... | @@ -2427,7 +2427,7 @@ fn initWipNavInner( | ... | @@ -2427,7 +2427,7 @@ fn initWipNavInner( |
| 2427 | const inst_info = nav.srcInst(ip).resolveFull(ip).?; | 2427 | const inst_info = nav.srcInst(ip).resolveFull(ip).?; |
| 2428 | const file = zcu.fileByIndex(inst_info.file); | 2428 | const file = zcu.fileByIndex(inst_info.file); |
| 2429 | const decl = file.zir.?.getDeclaration(inst_info.inst); | 2429 | const decl = file.zir.?.getDeclaration(inst_info.inst); |
| 2430 | log.debug("initWipNav({s}:{d}:{d} %{d} = {})", .{ | 2430 | log.debug("initWipNav({s}:{d}:{d} %{d} = {f})", .{ |
| 2431 | file.sub_file_path, | 2431 | file.sub_file_path, |
| 2432 | decl.src_line + 1, | 2432 | decl.src_line + 1, |
| 2433 | decl.src_column + 1, | 2433 | decl.src_column + 1, |
| ... | @@ -2632,7 +2632,7 @@ pub fn finishWipNavFunc( | ... | @@ -2632,7 +2632,7 @@ pub fn finishWipNavFunc( |
| 2632 | const ip = &zcu.intern_pool; | 2632 | const ip = &zcu.intern_pool; |
| 2633 | const nav = ip.getNav(nav_index); | 2633 | const nav = ip.getNav(nav_index); |
| 2634 | assert(wip_nav.func != .none); | 2634 | assert(wip_nav.func != .none); |
| 2635 | log.debug("finishWipNavFunc({})", .{nav.fqn.fmt(ip)}); | 2635 | log.debug("finishWipNavFunc({f})", .{nav.fqn.fmt(ip)}); |
| 2636 | 2636 | ||
| 2637 | { | 2637 | { |
| 2638 | const external_relocs = &dwarf.debug_aranges.section.getUnit(wip_nav.unit).getEntry(wip_nav.entry).external_relocs; | 2638 | const external_relocs = &dwarf.debug_aranges.section.getUnit(wip_nav.unit).getEntry(wip_nav.entry).external_relocs; |
| ... | @@ -2733,7 +2733,7 @@ pub fn finishWipNav( | ... | @@ -2733,7 +2733,7 @@ pub fn finishWipNav( |
| 2733 | const zcu = pt.zcu; | 2733 | const zcu = pt.zcu; |
| 2734 | const ip = &zcu.intern_pool; | 2734 | const ip = &zcu.intern_pool; |
| 2735 | const nav = ip.getNav(nav_index); | 2735 | const nav = ip.getNav(nav_index); |
| 2736 | log.debug("finishWipNav({})", .{nav.fqn.fmt(ip)}); | 2736 | log.debug("finishWipNav({f})", .{nav.fqn.fmt(ip)}); |
| 2737 | 2737 | ||
| 2738 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.items); | 2738 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.items); |
| 2739 | if (wip_nav.debug_line.items.len > 0) { | 2739 | if (wip_nav.debug_line.items.len > 0) { |
| ... | @@ -2765,7 +2765,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo | ... | @@ -2765,7 +2765,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo |
| 2765 | const inst_info = nav.srcInst(ip).resolveFull(ip).?; | 2765 | const inst_info = nav.srcInst(ip).resolveFull(ip).?; |
| 2766 | const file = zcu.fileByIndex(inst_info.file); | 2766 | const file = zcu.fileByIndex(inst_info.file); |
| 2767 | const decl = file.zir.?.getDeclaration(inst_info.inst); | 2767 | const decl = file.zir.?.getDeclaration(inst_info.inst); |
| 2768 | log.debug("updateComptimeNav({s}:{d}:{d} %{d} = {})", .{ | 2768 | log.debug("updateComptimeNav({s}:{d}:{d} %{d} = {f})", .{ |
| 2769 | file.sub_file_path, | 2769 | file.sub_file_path, |
| 2770 | decl.src_line + 1, | 2770 | decl.src_line + 1, |
| 2771 | decl.src_column + 1, | 2771 | decl.src_column + 1, |
| ... | @@ -3215,7 +3215,7 @@ fn updateLazyType( | ... | @@ -3215,7 +3215,7 @@ fn updateLazyType( |
| 3215 | const ty: Type = .fromInterned(type_index); | 3215 | const ty: Type = .fromInterned(type_index); |
| 3216 | switch (type_index) { | 3216 | switch (type_index) { |
| 3217 | .generic_poison_type => log.debug("updateLazyType({s})", .{"anytype"}), | 3217 | .generic_poison_type => log.debug("updateLazyType({s})", .{"anytype"}), |
| 3218 | else => log.debug("updateLazyType({})", .{ty.fmt(pt)}), | 3218 | else => log.debug("updateLazyType({f})", .{ty.fmt(pt)}), |
| 3219 | } | 3219 | } |
| 3220 | 3220 | ||
| 3221 | var wip_nav: WipNav = .{ | 3221 | var wip_nav: WipNav = .{ |
| ... | @@ -3243,7 +3243,7 @@ fn updateLazyType( | ... | @@ -3243,7 +3243,7 @@ fn updateLazyType( |
| 3243 | const diw = wip_nav.debug_info.writer(dwarf.gpa); | 3243 | const diw = wip_nav.debug_info.writer(dwarf.gpa); |
| 3244 | const name = switch (type_index) { | 3244 | const name = switch (type_index) { |
| 3245 | .generic_poison_type => "", | 3245 | .generic_poison_type => "", |
| 3246 | else => try std.fmt.allocPrint(dwarf.gpa, "{}", .{ty.fmt(pt)}), | 3246 | else => try std.fmt.allocPrint(dwarf.gpa, "{f}", .{ty.fmt(pt)}), |
| 3247 | }; | 3247 | }; |
| 3248 | defer dwarf.gpa.free(name); | 3248 | defer dwarf.gpa.free(name); |
| 3249 | 3249 | ||
| ... | @@ -3718,7 +3718,7 @@ fn updateLazyValue( | ... | @@ -3718,7 +3718,7 @@ fn updateLazyValue( |
| 3718 | const zcu = pt.zcu; | 3718 | const zcu = pt.zcu; |
| 3719 | const ip = &zcu.intern_pool; | 3719 | const ip = &zcu.intern_pool; |
| 3720 | assert(ip.typeOf(value_index) != .type_type); | 3720 | assert(ip.typeOf(value_index) != .type_type); |
| 3721 | log.debug("updateLazyValue(@as({}, {}))", .{ | 3721 | log.debug("updateLazyValue(@as({f}, {f}))", .{ |
| 3722 | Value.fromInterned(value_index).typeOf(zcu).fmt(pt), | 3722 | Value.fromInterned(value_index).typeOf(zcu).fmt(pt), |
| 3723 | Value.fromInterned(value_index).fmtValue(pt), | 3723 | Value.fromInterned(value_index).fmtValue(pt), |
| 3724 | }); | 3724 | }); |
| ... | @@ -4110,7 +4110,7 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP | ... | @@ -4110,7 +4110,7 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP |
| 4110 | const ip = &zcu.intern_pool; | 4110 | const ip = &zcu.intern_pool; |
| 4111 | const ty: Type = .fromInterned(type_index); | 4111 | const ty: Type = .fromInterned(type_index); |
| 4112 | const ty_src_loc = ty.srcLoc(zcu); | 4112 | const ty_src_loc = ty.srcLoc(zcu); |
| 4113 | log.debug("updateContainerType({})", .{ty.fmt(pt)}); | 4113 | log.debug("updateContainerType({f})", .{ty.fmt(pt)}); |
| 4114 | 4114 | ||
| 4115 | const inst_info = ty.typeDeclInst(zcu).?.resolveFull(ip).?; | 4115 | const inst_info = ty.typeDeclInst(zcu).?.resolveFull(ip).?; |
| 4116 | const file = zcu.fileByIndex(inst_info.file); | 4116 | const file = zcu.fileByIndex(inst_info.file); |
| ... | @@ -4239,7 +4239,7 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP | ... | @@ -4239,7 +4239,7 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP |
| 4239 | }; | 4239 | }; |
| 4240 | defer wip_nav.deinit(); | 4240 | defer wip_nav.deinit(); |
| 4241 | const diw = wip_nav.debug_info.writer(dwarf.gpa); | 4241 | const diw = wip_nav.debug_info.writer(dwarf.gpa); |
| 4242 | const name = try std.fmt.allocPrint(dwarf.gpa, "{}", .{ty.fmt(pt)}); | 4242 | const name = try std.fmt.allocPrint(dwarf.gpa, "{f}", .{ty.fmt(pt)}); |
| 4243 | defer dwarf.gpa.free(name); | 4243 | defer dwarf.gpa.free(name); |
| 4244 | 4244 | ||
| 4245 | switch (ip.indexToKey(type_index)) { | 4245 | switch (ip.indexToKey(type_index)) { |
src/link/Elf.zig+19-25| ... | @@ -702,7 +702,7 @@ pub fn allocateChunk(self: *Elf, args: struct { | ... | @@ -702,7 +702,7 @@ pub fn allocateChunk(self: *Elf, args: struct { |
| 702 | shdr.sh_addr + res.value, | 702 | shdr.sh_addr + res.value, |
| 703 | shdr.sh_offset + res.value, | 703 | shdr.sh_offset + res.value, |
| 704 | }); | 704 | }); |
| 705 | log.debug(" placement {}, {s}", .{ | 705 | log.debug(" placement {f}, {s}", .{ |
| 706 | res.placement, | 706 | res.placement, |
| 707 | if (self.atom(res.placement)) |atom_ptr| atom_ptr.name(self) else "", | 707 | if (self.atom(res.placement)) |atom_ptr| atom_ptr.name(self) else "", |
| 708 | }); | 708 | }); |
| ... | @@ -869,7 +869,7 @@ fn flushInner(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id) !void { | ... | @@ -869,7 +869,7 @@ fn flushInner(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id) !void { |
| 869 | // Dump the state for easy debugging. | 869 | // Dump the state for easy debugging. |
| 870 | // State can be dumped via `--debug-log link_state`. | 870 | // State can be dumped via `--debug-log link_state`. |
| 871 | if (build_options.enable_logging) { | 871 | if (build_options.enable_logging) { |
| 872 | state_log.debug("{}", .{self.dumpState()}); | 872 | state_log.debug("{f}", .{self.dumpState()}); |
| 873 | } | 873 | } |
| 874 | 874 | ||
| 875 | // Beyond this point, everything has been allocated a virtual address and we can resolve | 875 | // Beyond this point, everything has been allocated a virtual address and we can resolve |
| ... | @@ -3813,12 +3813,12 @@ fn reportDuplicates(self: *Elf, dupes: anytype) error{ HasDuplicates, OutOfMemor | ... | @@ -3813,12 +3813,12 @@ fn reportDuplicates(self: *Elf, dupes: anytype) error{ HasDuplicates, OutOfMemor |
| 3813 | 3813 | ||
| 3814 | var err = try diags.addErrorWithNotes(nnotes + 1); | 3814 | var err = try diags.addErrorWithNotes(nnotes + 1); |
| 3815 | try err.addMsg("duplicate symbol definition: {s}", .{sym.name(self)}); | 3815 | try err.addMsg("duplicate symbol definition: {s}", .{sym.name(self)}); |
| 3816 | err.addNote("defined by {}", .{sym.file(self).?.fmtPath()}); | 3816 | err.addNote("defined by {f}", .{sym.file(self).?.fmtPath()}); |
| 3817 | 3817 | ||
| 3818 | var inote: usize = 0; | 3818 | var inote: usize = 0; |
| 3819 | while (inote < @min(notes.items.len, max_notes)) : (inote += 1) { | 3819 | while (inote < @min(notes.items.len, max_notes)) : (inote += 1) { |
| 3820 | const file_ptr = self.file(notes.items[inote]).?; | 3820 | const file_ptr = self.file(notes.items[inote]).?; |
| 3821 | err.addNote("defined by {}", .{file_ptr.fmtPath()}); | 3821 | err.addNote("defined by {f}", .{file_ptr.fmtPath()}); |
| 3822 | } | 3822 | } |
| 3823 | 3823 | ||
| 3824 | if (notes.items.len > max_notes) { | 3824 | if (notes.items.len > max_notes) { |
| ... | @@ -3847,7 +3847,7 @@ pub fn addFileError( | ... | @@ -3847,7 +3847,7 @@ pub fn addFileError( |
| 3847 | const diags = &self.base.comp.link_diags; | 3847 | const diags = &self.base.comp.link_diags; |
| 3848 | var err = try diags.addErrorWithNotes(1); | 3848 | var err = try diags.addErrorWithNotes(1); |
| 3849 | try err.addMsg(format, args); | 3849 | try err.addMsg(format, args); |
| 3850 | err.addNote("while parsing {}", .{self.file(file_index).?.fmtPath()}); | 3850 | err.addNote("while parsing {f}", .{self.file(file_index).?.fmtPath()}); |
| 3851 | } | 3851 | } |
| 3852 | 3852 | ||
| 3853 | pub fn failFile( | 3853 | pub fn failFile( |
| ... | @@ -3874,7 +3874,7 @@ fn fmtShdr(self: *Elf, shdr: elf.Elf64_Shdr) std.fmt.Formatter(FormatShdr, forma | ... | @@ -3874,7 +3874,7 @@ fn fmtShdr(self: *Elf, shdr: elf.Elf64_Shdr) std.fmt.Formatter(FormatShdr, forma |
| 3874 | 3874 | ||
| 3875 | fn formatShdr(ctx: FormatShdr, writer: *std.io.Writer) std.io.Writer.Error!void { | 3875 | fn formatShdr(ctx: FormatShdr, writer: *std.io.Writer) std.io.Writer.Error!void { |
| 3876 | const shdr = ctx.shdr; | 3876 | const shdr = ctx.shdr; |
| 3877 | try writer.print("{s} : @{x} ({x}) : align({x}) : size({x}) : entsize({x}) : flags({})", .{ | 3877 | try writer.print("{s} : @{x} ({x}) : align({x}) : size({x}) : entsize({x}) : flags({f})", .{ |
| 3878 | ctx.elf_file.getShString(shdr.sh_name), shdr.sh_offset, | 3878 | ctx.elf_file.getShString(shdr.sh_name), shdr.sh_offset, |
| 3879 | shdr.sh_addr, shdr.sh_addralign, | 3879 | shdr.sh_addr, shdr.sh_addralign, |
| 3880 | shdr.sh_size, shdr.sh_entsize, | 3880 | shdr.sh_size, shdr.sh_entsize, |
| ... | @@ -3979,7 +3979,7 @@ fn fmtDumpState(self: *Elf, writer: *std.io.Writer) std.io.Writer.Error!void { | ... | @@ -3979,7 +3979,7 @@ fn fmtDumpState(self: *Elf, writer: *std.io.Writer) std.io.Writer.Error!void { |
| 3979 | 3979 | ||
| 3980 | if (self.zigObjectPtr()) |zig_object| { | 3980 | if (self.zigObjectPtr()) |zig_object| { |
| 3981 | try writer.print("zig_object({d}) : {s}\n", .{ zig_object.index, zig_object.basename }); | 3981 | try writer.print("zig_object({d}) : {s}\n", .{ zig_object.index, zig_object.basename }); |
| 3982 | try writer.print("{}{}", .{ | 3982 | try writer.print("{f}{f}", .{ |
| 3983 | zig_object.fmtAtoms(self), | 3983 | zig_object.fmtAtoms(self), |
| 3984 | zig_object.fmtSymtab(self), | 3984 | zig_object.fmtSymtab(self), |
| 3985 | }); | 3985 | }); |
| ... | @@ -3988,10 +3988,10 @@ fn fmtDumpState(self: *Elf, writer: *std.io.Writer) std.io.Writer.Error!void { | ... | @@ -3988,10 +3988,10 @@ fn fmtDumpState(self: *Elf, writer: *std.io.Writer) std.io.Writer.Error!void { |
| 3988 | 3988 | ||
| 3989 | for (self.objects.items) |index| { | 3989 | for (self.objects.items) |index| { |
| 3990 | const object = self.file(index).?.object; | 3990 | const object = self.file(index).?.object; |
| 3991 | try writer.print("object({d}) : {}", .{ index, object.fmtPath() }); | 3991 | try writer.print("object({d}) : {f}", .{ index, object.fmtPath() }); |
| 3992 | if (!object.alive) try writer.writeAll(" : [*]"); | 3992 | if (!object.alive) try writer.writeAll(" : [*]"); |
| 3993 | try writer.writeByte('\n'); | 3993 | try writer.writeByte('\n'); |
| 3994 | try writer.print("{}{}{}{}{}\n", .{ | 3994 | try writer.print("{f}{f}{f}{f}{f}\n", .{ |
| 3995 | object.fmtAtoms(self), | 3995 | object.fmtAtoms(self), |
| 3996 | object.fmtCies(self), | 3996 | object.fmtCies(self), |
| 3997 | object.fmtFdes(self), | 3997 | object.fmtFdes(self), |
| ... | @@ -4002,18 +4002,18 @@ fn fmtDumpState(self: *Elf, writer: *std.io.Writer) std.io.Writer.Error!void { | ... | @@ -4002,18 +4002,18 @@ fn fmtDumpState(self: *Elf, writer: *std.io.Writer) std.io.Writer.Error!void { |
| 4002 | 4002 | ||
| 4003 | for (shared_objects) |index| { | 4003 | for (shared_objects) |index| { |
| 4004 | const shared_object = self.file(index).?.shared_object; | 4004 | const shared_object = self.file(index).?.shared_object; |
| 4005 | try writer.print("shared_object({d}) : {} : needed({})", .{ | 4005 | try writer.print("shared_object({d}) : {f} : needed({})", .{ |
| 4006 | index, shared_object.path, shared_object.needed, | 4006 | index, shared_object.path, shared_object.needed, |
| 4007 | }); | 4007 | }); |
| 4008 | if (!shared_object.alive) try writer.writeAll(" : [*]"); | 4008 | if (!shared_object.alive) try writer.writeAll(" : [*]"); |
| 4009 | try writer.writeByte('\n'); | 4009 | try writer.writeByte('\n'); |
| 4010 | try writer.print("{}\n", .{shared_object.fmtSymtab(self)}); | 4010 | try writer.print("{f}\n", .{shared_object.fmtSymtab(self)}); |
| 4011 | } | 4011 | } |
| 4012 | 4012 | ||
| 4013 | if (self.linker_defined_index) |index| { | 4013 | if (self.linker_defined_index) |index| { |
| 4014 | const linker_defined = self.file(index).?.linker_defined; | 4014 | const linker_defined = self.file(index).?.linker_defined; |
| 4015 | try writer.print("linker_defined({d}) : (linker defined)\n", .{index}); | 4015 | try writer.print("linker_defined({d}) : (linker defined)\n", .{index}); |
| 4016 | try writer.print("{}\n", .{linker_defined.fmtSymtab(self)}); | 4016 | try writer.print("{f}\n", .{linker_defined.fmtSymtab(self)}); |
| 4017 | } | 4017 | } |
| 4018 | 4018 | ||
| 4019 | const slice = self.sections.slice(); | 4019 | const slice = self.sections.slice(); |
| ... | @@ -4036,7 +4036,7 @@ fn fmtDumpState(self: *Elf, writer: *std.io.Writer) std.io.Writer.Error!void { | ... | @@ -4036,7 +4036,7 @@ fn fmtDumpState(self: *Elf, writer: *std.io.Writer) std.io.Writer.Error!void { |
| 4036 | 4036 | ||
| 4037 | try writer.writeAll("Output groups\n"); | 4037 | try writer.writeAll("Output groups\n"); |
| 4038 | for (self.group_sections.items) |cg| { | 4038 | for (self.group_sections.items) |cg| { |
| 4039 | try writer.print(" shdr({d}) : GROUP({})\n", .{ cg.shndx, cg.cg_ref }); | 4039 | try writer.print(" shdr({d}) : GROUP({f})\n", .{ cg.shndx, cg.cg_ref }); |
| 4040 | } | 4040 | } |
| 4041 | 4041 | ||
| 4042 | try writer.writeAll("\nOutput merge sections\n"); | 4042 | try writer.writeAll("\nOutput merge sections\n"); |
| ... | @@ -4046,7 +4046,7 @@ fn fmtDumpState(self: *Elf, writer: *std.io.Writer) std.io.Writer.Error!void { | ... | @@ -4046,7 +4046,7 @@ fn fmtDumpState(self: *Elf, writer: *std.io.Writer) std.io.Writer.Error!void { |
| 4046 | 4046 | ||
| 4047 | try writer.writeAll("\nOutput shdrs\n"); | 4047 | try writer.writeAll("\nOutput shdrs\n"); |
| 4048 | for (slice.items(.shdr), slice.items(.phndx), 0..) |shdr, phndx, shndx| { | 4048 | for (slice.items(.shdr), slice.items(.phndx), 0..) |shdr, phndx, shndx| { |
| 4049 | try writer.print(" shdr({d}) : phdr({?d}) : {}\n", .{ | 4049 | try writer.print(" shdr({d}) : phdr({d}) : {f}\n", .{ |
| 4050 | shndx, | 4050 | shndx, |
| 4051 | phndx, | 4051 | phndx, |
| 4052 | self.fmtShdr(shdr), | 4052 | self.fmtShdr(shdr), |
| ... | @@ -4054,7 +4054,7 @@ fn fmtDumpState(self: *Elf, writer: *std.io.Writer) std.io.Writer.Error!void { | ... | @@ -4054,7 +4054,7 @@ fn fmtDumpState(self: *Elf, writer: *std.io.Writer) std.io.Writer.Error!void { |
| 4054 | } | 4054 | } |
| 4055 | try writer.writeAll("\nOutput phdrs\n"); | 4055 | try writer.writeAll("\nOutput phdrs\n"); |
| 4056 | for (self.phdrs.items, 0..) |phdr, phndx| { | 4056 | for (self.phdrs.items, 0..) |phdr, phndx| { |
| 4057 | try writer.print(" phdr({d}) : {}\n", .{ phndx, self.fmtPhdr(phdr) }); | 4057 | try writer.print(" phdr({d}) : {f}\n", .{ phndx, self.fmtPhdr(phdr) }); |
| 4058 | } | 4058 | } |
| 4059 | } | 4059 | } |
| 4060 | 4060 | ||
| ... | @@ -4192,15 +4192,9 @@ pub const Ref = struct { | ... | @@ -4192,15 +4192,9 @@ pub const Ref = struct { |
| 4192 | return ref.index == other.index and ref.file == other.file; | 4192 | return ref.index == other.index and ref.file == other.file; |
| 4193 | } | 4193 | } |
| 4194 | 4194 | ||
| 4195 | pub fn format( | 4195 | pub fn format(ref: Ref, writer: *std.io.Writer, comptime f: []const u8) std.io.Writer.Error!void { |
| 4196 | ref: Ref, | 4196 | comptime assert(f.len == 0); |
| 4197 | comptime unused_fmt_string: []const u8, | 4197 | try writer.print("ref({d},{d})", .{ ref.index, ref.file }); |
| 4198 | options: std.fmt.FormatOptions, | ||
| 4199 | writer: anytype, | ||
| 4200 | ) !void { | ||
| 4201 | _ = unused_fmt_string; | ||
| 4202 | _ = options; | ||
| 4203 | try writer.print("ref({},{})", .{ ref.index, ref.file }); | ||
| 4204 | } | 4198 | } |
| 4205 | }; | 4199 | }; |
| 4206 | 4200 | ||
| ... | @@ -4395,7 +4389,7 @@ fn createThunks(elf_file: *Elf, atom_list: *AtomList) !void { | ... | @@ -4395,7 +4389,7 @@ fn createThunks(elf_file: *Elf, atom_list: *AtomList) !void { |
| 4395 | for (atom_list.atoms.keys()[start..i]) |ref| { | 4389 | for (atom_list.atoms.keys()[start..i]) |ref| { |
| 4396 | const atom_ptr = elf_file.atom(ref).?; | 4390 | const atom_ptr = elf_file.atom(ref).?; |
| 4397 | const file_ptr = atom_ptr.file(elf_file).?; | 4391 | const file_ptr = atom_ptr.file(elf_file).?; |
| 4398 | log.debug("atom({}) {s}", .{ ref, atom_ptr.name(elf_file) }); | 4392 | log.debug("atom({f}) {s}", .{ ref, atom_ptr.name(elf_file) }); |
| 4399 | for (atom_ptr.relocs(elf_file)) |rel| { | 4393 | for (atom_ptr.relocs(elf_file)) |rel| { |
| 4400 | const is_reachable = switch (cpu_arch) { | 4394 | const is_reachable = switch (cpu_arch) { |
| 4401 | .aarch64 => r: { | 4395 | .aarch64 => r: { |
src/link/Elf/Archive.zig+4-23| ... | @@ -83,7 +83,7 @@ pub fn parse( | ... | @@ -83,7 +83,7 @@ pub fn parse( |
| 83 | .alive = false, | 83 | .alive = false, |
| 84 | }; | 84 | }; |
| 85 | 85 | ||
| 86 | log.debug("extracting object '{}' from archive '{}'", .{ | 86 | log.debug("extracting object '{f}' from archive '{f}'", .{ |
| 87 | @as(Path, object.path), @as(Path, path), | 87 | @as(Path, object.path), @as(Path, path), |
| 88 | }); | 88 | }); |
| 89 | 89 | ||
| ... | @@ -201,19 +201,6 @@ pub const ArSymtab = struct { | ... | @@ -201,19 +201,6 @@ pub const ArSymtab = struct { |
| 201 | } | 201 | } |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | pub fn format( | ||
| 205 | ar: ArSymtab, | ||
| 206 | comptime unused_fmt_string: []const u8, | ||
| 207 | options: std.fmt.FormatOptions, | ||
| 208 | writer: anytype, | ||
| 209 | ) !void { | ||
| 210 | _ = ar; | ||
| 211 | _ = unused_fmt_string; | ||
| 212 | _ = options; | ||
| 213 | _ = writer; | ||
| 214 | @compileError("do not format ar symtab directly; use fmt instead"); | ||
| 215 | } | ||
| 216 | |||
| 217 | const Format = struct { | 204 | const Format = struct { |
| 218 | ar: ArSymtab, | 205 | ar: ArSymtab, |
| 219 | elf_file: *Elf, | 206 | elf_file: *Elf, |
| ... | @@ -224,7 +211,7 @@ pub const ArSymtab = struct { | ... | @@ -224,7 +211,7 @@ pub const ArSymtab = struct { |
| 224 | for (ar.symtab.items, 0..) |entry, i| { | 211 | for (ar.symtab.items, 0..) |entry, i| { |
| 225 | const name = ar.strtab.getAssumeExists(entry.off); | 212 | const name = ar.strtab.getAssumeExists(entry.off); |
| 226 | const file = elf_file.file(entry.file_index).?; | 213 | const file = elf_file.file(entry.file_index).?; |
| 227 | try writer.print(" {d}: {s} in file({d})({})\n", .{ i, name, entry.file_index, file.fmtPath() }); | 214 | try writer.print(" {d}: {s} in file({d})({f})\n", .{ i, name, entry.file_index, file.fmtPath() }); |
| 228 | } | 215 | } |
| 229 | } | 216 | } |
| 230 | }; | 217 | }; |
| ... | @@ -273,14 +260,8 @@ pub const ArStrtab = struct { | ... | @@ -273,14 +260,8 @@ pub const ArStrtab = struct { |
| 273 | try writer.writeAll(ar.buffer.items); | 260 | try writer.writeAll(ar.buffer.items); |
| 274 | } | 261 | } |
| 275 | 262 | ||
| 276 | pub fn format( | 263 | pub fn format(ar: ArStrtab, writer: *std.io.Writer, comptime fmt: []const u8) std.io.Writer.Error!void { |
| 277 | ar: ArStrtab, | 264 | comptime assert(fmt.len == 0); |
| 278 | comptime unused_fmt_string: []const u8, | ||
| 279 | options: std.fmt.FormatOptions, | ||
| 280 | writer: anytype, | ||
| 281 | ) !void { | ||
| 282 | _ = unused_fmt_string; | ||
| 283 | _ = options; | ||
| 284 | try writer.print("{f}", .{std.ascii.hexEscape(ar.buffer.items, .lower)}); | 265 | try writer.print("{f}", .{std.ascii.hexEscape(ar.buffer.items, .lower)}); |
| 285 | } | 266 | } |
| 286 | }; | 267 | }; |
src/link/Elf/Atom.zig+24-24| ... | @@ -142,7 +142,7 @@ pub fn freeListEligible(self: Atom, elf_file: *Elf) bool { | ... | @@ -142,7 +142,7 @@ pub fn freeListEligible(self: Atom, elf_file: *Elf) bool { |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | pub fn free(self: *Atom, elf_file: *Elf) void { | 144 | pub fn free(self: *Atom, elf_file: *Elf) void { |
| 145 | log.debug("freeAtom atom({}) ({s})", .{ self.ref(), self.name(elf_file) }); | 145 | log.debug("freeAtom atom({f}) ({s})", .{ self.ref(), self.name(elf_file) }); |
| 146 | 146 | ||
| 147 | const comp = elf_file.base.comp; | 147 | const comp = elf_file.base.comp; |
| 148 | const gpa = comp.gpa; | 148 | const gpa = comp.gpa; |
| ... | @@ -316,7 +316,7 @@ pub fn scanRelocs(self: Atom, elf_file: *Elf, code: ?[]const u8, undefs: anytype | ... | @@ -316,7 +316,7 @@ pub fn scanRelocs(self: Atom, elf_file: *Elf, code: ?[]const u8, undefs: anytype |
| 316 | }; | 316 | }; |
| 317 | // Violation of One Definition Rule for COMDATs. | 317 | // Violation of One Definition Rule for COMDATs. |
| 318 | // TODO convert into an error | 318 | // TODO convert into an error |
| 319 | log.debug("{}: {s}: {s} refers to a discarded COMDAT section", .{ | 319 | log.debug("{f}: {s}: {s} refers to a discarded COMDAT section", .{ |
| 320 | file_ptr.fmtPath(), | 320 | file_ptr.fmtPath(), |
| 321 | self.name(elf_file), | 321 | self.name(elf_file), |
| 322 | sym_name, | 322 | sym_name, |
| ... | @@ -519,11 +519,11 @@ fn dataType(symbol: *const Symbol, elf_file: *Elf) u2 { | ... | @@ -519,11 +519,11 @@ fn dataType(symbol: *const Symbol, elf_file: *Elf) u2 { |
| 519 | fn reportUnhandledRelocError(self: Atom, rel: elf.Elf64_Rela, elf_file: *Elf) RelocError!void { | 519 | fn reportUnhandledRelocError(self: Atom, rel: elf.Elf64_Rela, elf_file: *Elf) RelocError!void { |
| 520 | const diags = &elf_file.base.comp.link_diags; | 520 | const diags = &elf_file.base.comp.link_diags; |
| 521 | var err = try diags.addErrorWithNotes(1); | 521 | var err = try diags.addErrorWithNotes(1); |
| 522 | try err.addMsg("fatal linker error: unhandled relocation type {} at offset 0x{x}", .{ | 522 | try err.addMsg("fatal linker error: unhandled relocation type {f} at offset 0x{x}", .{ |
| 523 | relocation.fmtRelocType(rel.r_type(), elf_file.getTarget().cpu.arch), | 523 | relocation.fmtRelocType(rel.r_type(), elf_file.getTarget().cpu.arch), |
| 524 | rel.r_offset, | 524 | rel.r_offset, |
| 525 | }); | 525 | }); |
| 526 | err.addNote("in {}:{s}", .{ self.file(elf_file).?.fmtPath(), self.name(elf_file) }); | 526 | err.addNote("in {f}:{s}", .{ self.file(elf_file).?.fmtPath(), self.name(elf_file) }); |
| 527 | return error.RelocFailure; | 527 | return error.RelocFailure; |
| 528 | } | 528 | } |
| 529 | 529 | ||
| ... | @@ -539,7 +539,7 @@ fn reportTextRelocError( | ... | @@ -539,7 +539,7 @@ fn reportTextRelocError( |
| 539 | rel.r_offset, | 539 | rel.r_offset, |
| 540 | symbol.name(elf_file), | 540 | symbol.name(elf_file), |
| 541 | }); | 541 | }); |
| 542 | err.addNote("in {}:{s}", .{ self.file(elf_file).?.fmtPath(), self.name(elf_file) }); | 542 | err.addNote("in {f}:{s}", .{ self.file(elf_file).?.fmtPath(), self.name(elf_file) }); |
| 543 | return error.RelocFailure; | 543 | return error.RelocFailure; |
| 544 | } | 544 | } |
| 545 | 545 | ||
| ... | @@ -555,7 +555,7 @@ fn reportPicError( | ... | @@ -555,7 +555,7 @@ fn reportPicError( |
| 555 | rel.r_offset, | 555 | rel.r_offset, |
| 556 | symbol.name(elf_file), | 556 | symbol.name(elf_file), |
| 557 | }); | 557 | }); |
| 558 | err.addNote("in {}:{s}", .{ self.file(elf_file).?.fmtPath(), self.name(elf_file) }); | 558 | err.addNote("in {f}:{s}", .{ self.file(elf_file).?.fmtPath(), self.name(elf_file) }); |
| 559 | err.addNote("recompile with -fPIC", .{}); | 559 | err.addNote("recompile with -fPIC", .{}); |
| 560 | return error.RelocFailure; | 560 | return error.RelocFailure; |
| 561 | } | 561 | } |
| ... | @@ -572,7 +572,7 @@ fn reportNoPicError( | ... | @@ -572,7 +572,7 @@ fn reportNoPicError( |
| 572 | rel.r_offset, | 572 | rel.r_offset, |
| 573 | symbol.name(elf_file), | 573 | symbol.name(elf_file), |
| 574 | }); | 574 | }); |
| 575 | err.addNote("in {}:{s}", .{ self.file(elf_file).?.fmtPath(), self.name(elf_file) }); | 575 | err.addNote("in {f}:{s}", .{ self.file(elf_file).?.fmtPath(), self.name(elf_file) }); |
| 576 | err.addNote("recompile with -fno-PIC", .{}); | 576 | err.addNote("recompile with -fno-PIC", .{}); |
| 577 | return error.RelocFailure; | 577 | return error.RelocFailure; |
| 578 | } | 578 | } |
| ... | @@ -823,7 +823,7 @@ pub fn resolveRelocsNonAlloc(self: Atom, elf_file: *Elf, code: []u8, undefs: any | ... | @@ -823,7 +823,7 @@ pub fn resolveRelocsNonAlloc(self: Atom, elf_file: *Elf, code: []u8, undefs: any |
| 823 | }; | 823 | }; |
| 824 | // Violation of One Definition Rule for COMDATs. | 824 | // Violation of One Definition Rule for COMDATs. |
| 825 | // TODO convert into an error | 825 | // TODO convert into an error |
| 826 | log.debug("{}: {s}: {s} refers to a discarded COMDAT section", .{ | 826 | log.debug("{f}: {s}: {s} refers to a discarded COMDAT section", .{ |
| 827 | file_ptr.fmtPath(), | 827 | file_ptr.fmtPath(), |
| 828 | self.name(elf_file), | 828 | self.name(elf_file), |
| 829 | sym_name, | 829 | sym_name, |
| ... | @@ -855,7 +855,7 @@ pub fn resolveRelocsNonAlloc(self: Atom, elf_file: *Elf, code: []u8, undefs: any | ... | @@ -855,7 +855,7 @@ pub fn resolveRelocsNonAlloc(self: Atom, elf_file: *Elf, code: []u8, undefs: any |
| 855 | 855 | ||
| 856 | const args = ResolveArgs{ P, A, S, GOT, 0, 0, DTP }; | 856 | const args = ResolveArgs{ P, A, S, GOT, 0, 0, DTP }; |
| 857 | 857 | ||
| 858 | relocs_log.debug(" {}: {x}: [{x} => {x}] ({s})", .{ | 858 | relocs_log.debug(" {f}: {x}: [{x} => {x}] ({s})", .{ |
| 859 | relocation.fmtRelocType(rel.r_type(), cpu_arch), | 859 | relocation.fmtRelocType(rel.r_type(), cpu_arch), |
| 860 | rel.r_offset, | 860 | rel.r_offset, |
| 861 | P, | 861 | P, |
| ... | @@ -918,7 +918,7 @@ const Format = struct { | ... | @@ -918,7 +918,7 @@ const Format = struct { |
| 918 | fn default(f: Format, w: *std.io.Writer) std.io.Writer.Error!void { | 918 | fn default(f: Format, w: *std.io.Writer) std.io.Writer.Error!void { |
| 919 | const atom = f.atom; | 919 | const atom = f.atom; |
| 920 | const elf_file = f.elf_file; | 920 | const elf_file = f.elf_file; |
| 921 | try w.print("atom({d}) : {s} : @{x} : shdr({d}) : align({x}) : size({x}) : prev({}) : next({})", .{ | 921 | try w.print("atom({d}) : {s} : @{x} : shdr({d}) : align({x}) : size({x}) : prev({f}) : next({f})", .{ |
| 922 | atom.atom_index, atom.name(elf_file), atom.address(elf_file), | 922 | atom.atom_index, atom.name(elf_file), atom.address(elf_file), |
| 923 | atom.output_section_index, atom.alignment.toByteUnits() orelse 0, atom.size, | 923 | atom.output_section_index, atom.alignment.toByteUnits() orelse 0, atom.size, |
| 924 | atom.prev_atom_ref, atom.next_atom_ref, | 924 | atom.prev_atom_ref, atom.next_atom_ref, |
| ... | @@ -1169,7 +1169,7 @@ const x86_64 = struct { | ... | @@ -1169,7 +1169,7 @@ const x86_64 = struct { |
| 1169 | x86_64.relaxGotPcTlsDesc(code[r_offset - 3 ..], t) catch { | 1169 | x86_64.relaxGotPcTlsDesc(code[r_offset - 3 ..], t) catch { |
| 1170 | var err = try diags.addErrorWithNotes(1); | 1170 | var err = try diags.addErrorWithNotes(1); |
| 1171 | try err.addMsg("could not relax {s}", .{@tagName(r_type)}); | 1171 | try err.addMsg("could not relax {s}", .{@tagName(r_type)}); |
| 1172 | err.addNote("in {}:{s} at offset 0x{x}", .{ | 1172 | err.addNote("in {f}:{s} at offset 0x{x}", .{ |
| 1173 | atom.file(elf_file).?.fmtPath(), | 1173 | atom.file(elf_file).?.fmtPath(), |
| 1174 | atom.name(elf_file), | 1174 | atom.name(elf_file), |
| 1175 | rel.r_offset, | 1175 | rel.r_offset, |
| ... | @@ -1265,7 +1265,7 @@ const x86_64 = struct { | ... | @@ -1265,7 +1265,7 @@ const x86_64 = struct { |
| 1265 | }, t), | 1265 | }, t), |
| 1266 | else => return error.RelaxFailure, | 1266 | else => return error.RelaxFailure, |
| 1267 | }; | 1267 | }; |
| 1268 | relocs_log.debug(" relaxing {} => {}", .{ old_inst.encoding, inst.encoding }); | 1268 | relocs_log.debug(" relaxing {f} => {f}", .{ old_inst.encoding, inst.encoding }); |
| 1269 | const nop: Instruction = try .new(.none, .nop, &.{}, t); | 1269 | const nop: Instruction = try .new(.none, .nop, &.{}, t); |
| 1270 | try encode(&.{ nop, inst }, code); | 1270 | try encode(&.{ nop, inst }, code); |
| 1271 | } | 1271 | } |
| ... | @@ -1276,7 +1276,7 @@ const x86_64 = struct { | ... | @@ -1276,7 +1276,7 @@ const x86_64 = struct { |
| 1276 | switch (old_inst.encoding.mnemonic) { | 1276 | switch (old_inst.encoding.mnemonic) { |
| 1277 | .mov => { | 1277 | .mov => { |
| 1278 | const inst: Instruction = try .new(old_inst.prefix, .lea, &old_inst.ops, t); | 1278 | const inst: Instruction = try .new(old_inst.prefix, .lea, &old_inst.ops, t); |
| 1279 | relocs_log.debug(" relaxing {} => {}", .{ old_inst.encoding, inst.encoding }); | 1279 | relocs_log.debug(" relaxing {f} => {f}", .{ old_inst.encoding, inst.encoding }); |
| 1280 | try encode(&.{inst}, code); | 1280 | try encode(&.{inst}, code); |
| 1281 | }, | 1281 | }, |
| 1282 | else => return error.RelaxFailure, | 1282 | else => return error.RelaxFailure, |
| ... | @@ -1310,11 +1310,11 @@ const x86_64 = struct { | ... | @@ -1310,11 +1310,11 @@ const x86_64 = struct { |
| 1310 | 1310 | ||
| 1311 | else => { | 1311 | else => { |
| 1312 | var err = try diags.addErrorWithNotes(1); | 1312 | var err = try diags.addErrorWithNotes(1); |
| 1313 | try err.addMsg("TODO: rewrite {} when followed by {}", .{ | 1313 | try err.addMsg("TODO: rewrite {f} when followed by {f}", .{ |
| 1314 | relocation.fmtRelocType(rels[0].r_type(), .x86_64), | 1314 | relocation.fmtRelocType(rels[0].r_type(), .x86_64), |
| 1315 | relocation.fmtRelocType(rels[1].r_type(), .x86_64), | 1315 | relocation.fmtRelocType(rels[1].r_type(), .x86_64), |
| 1316 | }); | 1316 | }); |
| 1317 | err.addNote("in {}:{s} at offset 0x{x}", .{ | 1317 | err.addNote("in {f}:{s} at offset 0x{x}", .{ |
| 1318 | self.file(elf_file).?.fmtPath(), | 1318 | self.file(elf_file).?.fmtPath(), |
| 1319 | self.name(elf_file), | 1319 | self.name(elf_file), |
| 1320 | rels[0].r_offset, | 1320 | rels[0].r_offset, |
| ... | @@ -1366,11 +1366,11 @@ const x86_64 = struct { | ... | @@ -1366,11 +1366,11 @@ const x86_64 = struct { |
| 1366 | 1366 | ||
| 1367 | else => { | 1367 | else => { |
| 1368 | var err = try diags.addErrorWithNotes(1); | 1368 | var err = try diags.addErrorWithNotes(1); |
| 1369 | try err.addMsg("TODO: rewrite {} when followed by {}", .{ | 1369 | try err.addMsg("TODO: rewrite {f} when followed by {f}", .{ |
| 1370 | relocation.fmtRelocType(rels[0].r_type(), .x86_64), | 1370 | relocation.fmtRelocType(rels[0].r_type(), .x86_64), |
| 1371 | relocation.fmtRelocType(rels[1].r_type(), .x86_64), | 1371 | relocation.fmtRelocType(rels[1].r_type(), .x86_64), |
| 1372 | }); | 1372 | }); |
| 1373 | err.addNote("in {}:{s} at offset 0x{x}", .{ | 1373 | err.addNote("in {f}:{s} at offset 0x{x}", .{ |
| 1374 | self.file(elf_file).?.fmtPath(), | 1374 | self.file(elf_file).?.fmtPath(), |
| 1375 | self.name(elf_file), | 1375 | self.name(elf_file), |
| 1376 | rels[0].r_offset, | 1376 | rels[0].r_offset, |
| ... | @@ -1408,7 +1408,7 @@ const x86_64 = struct { | ... | @@ -1408,7 +1408,7 @@ const x86_64 = struct { |
| 1408 | // TODO: hack to force imm32s in the assembler | 1408 | // TODO: hack to force imm32s in the assembler |
| 1409 | .{ .imm = .s(-129) }, | 1409 | .{ .imm = .s(-129) }, |
| 1410 | }, t) catch unreachable; | 1410 | }, t) catch unreachable; |
| 1411 | relocs_log.debug(" relaxing {} => {}", .{ old_inst.encoding, inst.encoding }); | 1411 | relocs_log.debug(" relaxing {f} => {f}", .{ old_inst.encoding, inst.encoding }); |
| 1412 | encode(&.{inst}, code) catch unreachable; | 1412 | encode(&.{inst}, code) catch unreachable; |
| 1413 | }, | 1413 | }, |
| 1414 | else => unreachable, | 1414 | else => unreachable, |
| ... | @@ -1425,7 +1425,7 @@ const x86_64 = struct { | ... | @@ -1425,7 +1425,7 @@ const x86_64 = struct { |
| 1425 | // TODO: hack to force imm32s in the assembler | 1425 | // TODO: hack to force imm32s in the assembler |
| 1426 | .{ .imm = .s(-129) }, | 1426 | .{ .imm = .s(-129) }, |
| 1427 | }, target); | 1427 | }, target); |
| 1428 | relocs_log.debug(" relaxing {} => {}", .{ old_inst.encoding, inst.encoding }); | 1428 | relocs_log.debug(" relaxing {f} => {f}", .{ old_inst.encoding, inst.encoding }); |
| 1429 | try encode(&.{inst}, code); | 1429 | try encode(&.{inst}, code); |
| 1430 | }, | 1430 | }, |
| 1431 | else => return error.RelaxFailure, | 1431 | else => return error.RelaxFailure, |
| ... | @@ -1457,7 +1457,7 @@ const x86_64 = struct { | ... | @@ -1457,7 +1457,7 @@ const x86_64 = struct { |
| 1457 | std.mem.writeInt(i32, insts[12..][0..4], value, .little); | 1457 | std.mem.writeInt(i32, insts[12..][0..4], value, .little); |
| 1458 | try stream.seekBy(-4); | 1458 | try stream.seekBy(-4); |
| 1459 | try writer.writeAll(&insts); | 1459 | try writer.writeAll(&insts); |
| 1460 | relocs_log.debug(" relaxing {} and {}", .{ | 1460 | relocs_log.debug(" relaxing {f} and {f}", .{ |
| 1461 | relocation.fmtRelocType(rels[0].r_type(), .x86_64), | 1461 | relocation.fmtRelocType(rels[0].r_type(), .x86_64), |
| 1462 | relocation.fmtRelocType(rels[1].r_type(), .x86_64), | 1462 | relocation.fmtRelocType(rels[1].r_type(), .x86_64), |
| 1463 | }); | 1463 | }); |
| ... | @@ -1465,11 +1465,11 @@ const x86_64 = struct { | ... | @@ -1465,11 +1465,11 @@ const x86_64 = struct { |
| 1465 | 1465 | ||
| 1466 | else => { | 1466 | else => { |
| 1467 | var err = try diags.addErrorWithNotes(1); | 1467 | var err = try diags.addErrorWithNotes(1); |
| 1468 | try err.addMsg("fatal linker error: rewrite {} when followed by {}", .{ | 1468 | try err.addMsg("fatal linker error: rewrite {f} when followed by {f}", .{ |
| 1469 | relocation.fmtRelocType(rels[0].r_type(), .x86_64), | 1469 | relocation.fmtRelocType(rels[0].r_type(), .x86_64), |
| 1470 | relocation.fmtRelocType(rels[1].r_type(), .x86_64), | 1470 | relocation.fmtRelocType(rels[1].r_type(), .x86_64), |
| 1471 | }); | 1471 | }); |
| 1472 | err.addNote("in {}:{s} at offset 0x{x}", .{ | 1472 | err.addNote("in {f}:{s} at offset 0x{x}", .{ |
| 1473 | self.file(elf_file).?.fmtPath(), | 1473 | self.file(elf_file).?.fmtPath(), |
| 1474 | self.name(elf_file), | 1474 | self.name(elf_file), |
| 1475 | rels[0].r_offset, | 1475 | rels[0].r_offset, |
| ... | @@ -1653,7 +1653,7 @@ const aarch64 = struct { | ... | @@ -1653,7 +1653,7 @@ const aarch64 = struct { |
| 1653 | // TODO: relax | 1653 | // TODO: relax |
| 1654 | var err = try diags.addErrorWithNotes(1); | 1654 | var err = try diags.addErrorWithNotes(1); |
| 1655 | try err.addMsg("TODO: relax ADR_GOT_PAGE", .{}); | 1655 | try err.addMsg("TODO: relax ADR_GOT_PAGE", .{}); |
| 1656 | err.addNote("in {}:{s} at offset 0x{x}", .{ | 1656 | err.addNote("in {f}:{s} at offset 0x{x}", .{ |
| 1657 | atom.file(elf_file).?.fmtPath(), | 1657 | atom.file(elf_file).?.fmtPath(), |
| 1658 | atom.name(elf_file), | 1658 | atom.name(elf_file), |
| 1659 | r_offset, | 1659 | r_offset, |
| ... | @@ -1943,7 +1943,7 @@ const riscv = struct { | ... | @@ -1943,7 +1943,7 @@ const riscv = struct { |
| 1943 | // TODO: implement searching forward | 1943 | // TODO: implement searching forward |
| 1944 | var err = try diags.addErrorWithNotes(1); | 1944 | var err = try diags.addErrorWithNotes(1); |
| 1945 | try err.addMsg("TODO: find HI20 paired reloc scanning forward", .{}); | 1945 | try err.addMsg("TODO: find HI20 paired reloc scanning forward", .{}); |
| 1946 | err.addNote("in {}:{s} at offset 0x{x}", .{ | 1946 | err.addNote("in {f}:{s} at offset 0x{x}", .{ |
| 1947 | atom.file(elf_file).?.fmtPath(), | 1947 | atom.file(elf_file).?.fmtPath(), |
| 1948 | atom.name(elf_file), | 1948 | atom.name(elf_file), |
| 1949 | rel.r_offset, | 1949 | rel.r_offset, |
src/link/Elf/AtomList.zig+10-8| ... | @@ -108,7 +108,7 @@ pub fn write(list: AtomList, buffer: *std.ArrayList(u8), undefs: anytype, elf_fi | ... | @@ -108,7 +108,7 @@ pub fn write(list: AtomList, buffer: *std.ArrayList(u8), undefs: anytype, elf_fi |
| 108 | const off = math.cast(usize, atom_ptr.value - list.value) orelse return error.Overflow; | 108 | const off = math.cast(usize, atom_ptr.value - list.value) orelse return error.Overflow; |
| 109 | const size = math.cast(usize, atom_ptr.size) orelse return error.Overflow; | 109 | const size = math.cast(usize, atom_ptr.size) orelse return error.Overflow; |
| 110 | 110 | ||
| 111 | log.debug(" atom({}) at 0x{x}", .{ ref, list.offset(elf_file) + off }); | 111 | log.debug(" atom({f}) at 0x{x}", .{ ref, list.offset(elf_file) + off }); |
| 112 | 112 | ||
| 113 | const object = atom_ptr.file(elf_file).?.object; | 113 | const object = atom_ptr.file(elf_file).?.object; |
| 114 | const code = try object.codeDecompressAlloc(elf_file, ref.index); | 114 | const code = try object.codeDecompressAlloc(elf_file, ref.index); |
| ... | @@ -144,7 +144,7 @@ pub fn writeRelocatable(list: AtomList, buffer: *std.ArrayList(u8), elf_file: *E | ... | @@ -144,7 +144,7 @@ pub fn writeRelocatable(list: AtomList, buffer: *std.ArrayList(u8), elf_file: *E |
| 144 | const off = math.cast(usize, atom_ptr.value - list.value) orelse return error.Overflow; | 144 | const off = math.cast(usize, atom_ptr.value - list.value) orelse return error.Overflow; |
| 145 | const size = math.cast(usize, atom_ptr.size) orelse return error.Overflow; | 145 | const size = math.cast(usize, atom_ptr.size) orelse return error.Overflow; |
| 146 | 146 | ||
| 147 | log.debug(" atom({}) at 0x{x}", .{ ref, list.offset(elf_file) + off }); | 147 | log.debug(" atom({f}) at 0x{x}", .{ ref, list.offset(elf_file) + off }); |
| 148 | 148 | ||
| 149 | const object = atom_ptr.file(elf_file).?.object; | 149 | const object = atom_ptr.file(elf_file).?.object; |
| 150 | const code = try object.codeDecompressAlloc(elf_file, ref.index); | 150 | const code = try object.codeDecompressAlloc(elf_file, ref.index); |
| ... | @@ -172,22 +172,24 @@ const Format = struct { | ... | @@ -172,22 +172,24 @@ const Format = struct { |
| 172 | elf_file: *Elf, | 172 | elf_file: *Elf, |
| 173 | 173 | ||
| 174 | fn default(f: Format, writer: *std.io.Writer) std.io.Writer.Error!void { | 174 | fn default(f: Format, writer: *std.io.Writer) std.io.Writer.Error!void { |
| 175 | const list, const elf_file = f; | 175 | const list = f.atom_list; |
| 176 | try writer.print("list : @{x} : shdr({d}) : align({x}) : size({x})", .{ | 176 | try writer.print("list : @{x} : shdr({d}) : align({x}) : size({x})", .{ |
| 177 | list.address(elf_file), list.output_section_index, | 177 | list.address(f.elf_file), |
| 178 | list.alignment.toByteUnits() orelse 0, list.size, | 178 | list.output_section_index, |
| 179 | list.alignment.toByteUnits() orelse 0, | ||
| 180 | list.size, | ||
| 179 | }); | 181 | }); |
| 180 | try writer.writeAll(" : atoms{ "); | 182 | try writer.writeAll(" : atoms{ "); |
| 181 | for (list.atoms.keys(), 0..) |ref, i| { | 183 | for (list.atoms.keys(), 0..) |ref, i| { |
| 182 | try writer.print("{}", .{ref}); | 184 | try writer.print("{f}", .{ref}); |
| 183 | if (i < list.atoms.keys().len - 1) try writer.writeAll(", "); | 185 | if (i < list.atoms.keys().len - 1) try writer.writeAll(", "); |
| 184 | } | 186 | } |
| 185 | try writer.writeAll(" }"); | 187 | try writer.writeAll(" }"); |
| 186 | } | 188 | } |
| 187 | }; | 189 | }; |
| 188 | 190 | ||
| 189 | pub fn fmt(list: AtomList, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { | 191 | pub fn fmt(atom_list: AtomList, elf_file: *Elf) std.fmt.Formatter(Format, Format.default) { |
| 190 | return .{ .data = .{ list, elf_file } }; | 192 | return .{ .data = .{ .atom_list = atom_list, .elf_file = elf_file } }; |
| 191 | } | 193 | } |
| 192 | 194 | ||
| 193 | const assert = std.debug.assert; | 195 | const assert = std.debug.assert; |
src/link/Elf/Object.zig+7-7| ... | @@ -281,7 +281,7 @@ fn initAtoms( | ... | @@ -281,7 +281,7 @@ fn initAtoms( |
| 281 | elf.SHT_GROUP => { | 281 | elf.SHT_GROUP => { |
| 282 | if (shdr.sh_info >= self.symtab.items.len) { | 282 | if (shdr.sh_info >= self.symtab.items.len) { |
| 283 | // TODO convert into an error | 283 | // TODO convert into an error |
| 284 | log.debug("{}: invalid symbol index in sh_info", .{self.fmtPath()}); | 284 | log.debug("{f}: invalid symbol index in sh_info", .{self.fmtPath()}); |
| 285 | continue; | 285 | continue; |
| 286 | } | 286 | } |
| 287 | const group_info_sym = self.symtab.items[shdr.sh_info]; | 287 | const group_info_sym = self.symtab.items[shdr.sh_info]; |
| ... | @@ -793,7 +793,7 @@ pub fn initInputMergeSections(self: *Object, elf_file: *Elf) !void { | ... | @@ -793,7 +793,7 @@ pub fn initInputMergeSections(self: *Object, elf_file: *Elf) !void { |
| 793 | if (!isNull(data[end .. end + sh_entsize])) { | 793 | if (!isNull(data[end .. end + sh_entsize])) { |
| 794 | var err = try diags.addErrorWithNotes(1); | 794 | var err = try diags.addErrorWithNotes(1); |
| 795 | try err.addMsg("string not null terminated", .{}); | 795 | try err.addMsg("string not null terminated", .{}); |
| 796 | err.addNote("in {}:{s}", .{ self.fmtPath(), atom_ptr.name(elf_file) }); | 796 | err.addNote("in {f}:{s}", .{ self.fmtPath(), atom_ptr.name(elf_file) }); |
| 797 | return error.LinkFailure; | 797 | return error.LinkFailure; |
| 798 | } | 798 | } |
| 799 | end += sh_entsize; | 799 | end += sh_entsize; |
| ... | @@ -808,7 +808,7 @@ pub fn initInputMergeSections(self: *Object, elf_file: *Elf) !void { | ... | @@ -808,7 +808,7 @@ pub fn initInputMergeSections(self: *Object, elf_file: *Elf) !void { |
| 808 | if (shdr.sh_size % sh_entsize != 0) { | 808 | if (shdr.sh_size % sh_entsize != 0) { |
| 809 | var err = try diags.addErrorWithNotes(1); | 809 | var err = try diags.addErrorWithNotes(1); |
| 810 | try err.addMsg("size not a multiple of sh_entsize", .{}); | 810 | try err.addMsg("size not a multiple of sh_entsize", .{}); |
| 811 | err.addNote("in {}:{s}", .{ self.fmtPath(), atom_ptr.name(elf_file) }); | 811 | err.addNote("in {f}:{s}", .{ self.fmtPath(), atom_ptr.name(elf_file) }); |
| 812 | return error.LinkFailure; | 812 | return error.LinkFailure; |
| 813 | } | 813 | } |
| 814 | 814 | ||
| ... | @@ -886,7 +886,7 @@ pub fn resolveMergeSubsections(self: *Object, elf_file: *Elf) error{ | ... | @@ -886,7 +886,7 @@ pub fn resolveMergeSubsections(self: *Object, elf_file: *Elf) error{ |
| 886 | var err = try diags.addErrorWithNotes(2); | 886 | var err = try diags.addErrorWithNotes(2); |
| 887 | try err.addMsg("invalid symbol value: {x}", .{esym.st_value}); | 887 | try err.addMsg("invalid symbol value: {x}", .{esym.st_value}); |
| 888 | err.addNote("for symbol {s}", .{sym.name(elf_file)}); | 888 | err.addNote("for symbol {s}", .{sym.name(elf_file)}); |
| 889 | err.addNote("in {}", .{self.fmtPath()}); | 889 | err.addNote("in {f}", .{self.fmtPath()}); |
| 890 | return error.LinkFailure; | 890 | return error.LinkFailure; |
| 891 | }; | 891 | }; |
| 892 | 892 | ||
| ... | @@ -911,7 +911,7 @@ pub fn resolveMergeSubsections(self: *Object, elf_file: *Elf) error{ | ... | @@ -911,7 +911,7 @@ pub fn resolveMergeSubsections(self: *Object, elf_file: *Elf) error{ |
| 911 | const res = imsec.findSubsection(@intCast(@as(i64, @intCast(esym.st_value)) + rel.r_addend)) orelse { | 911 | const res = imsec.findSubsection(@intCast(@as(i64, @intCast(esym.st_value)) + rel.r_addend)) orelse { |
| 912 | var err = try diags.addErrorWithNotes(1); | 912 | var err = try diags.addErrorWithNotes(1); |
| 913 | try err.addMsg("invalid relocation at offset 0x{x}", .{rel.r_offset}); | 913 | try err.addMsg("invalid relocation at offset 0x{x}", .{rel.r_offset}); |
| 914 | err.addNote("in {}:{s}", .{ self.fmtPath(), atom_ptr.name(elf_file) }); | 914 | err.addNote("in {f}:{s}", .{ self.fmtPath(), atom_ptr.name(elf_file) }); |
| 915 | return error.LinkFailure; | 915 | return error.LinkFailure; |
| 916 | }; | 916 | }; |
| 917 | 917 | ||
| ... | @@ -1536,9 +1536,9 @@ pub fn fmtPath(self: Object) std.fmt.Formatter(Object, formatPath) { | ... | @@ -1536,9 +1536,9 @@ pub fn fmtPath(self: Object) std.fmt.Formatter(Object, formatPath) { |
| 1536 | 1536 | ||
| 1537 | fn formatPath(object: Object, writer: *std.io.Writer) std.io.Writer.Error!void { | 1537 | fn formatPath(object: Object, writer: *std.io.Writer) std.io.Writer.Error!void { |
| 1538 | if (object.archive) |ar| { | 1538 | if (object.archive) |ar| { |
| 1539 | try writer.print("{}({})", .{ ar.path, object.path }); | 1539 | try writer.print("{f}({f})", .{ ar.path, object.path }); |
| 1540 | } else { | 1540 | } else { |
| 1541 | try writer.print("{}", .{object.path}); | 1541 | try writer.print("{f}", .{object.path}); |
| 1542 | } | 1542 | } |
| 1543 | } | 1543 | } |
| 1544 | 1544 |
src/link/Elf/SharedObject.zig+12-12| ... | @@ -519,21 +519,21 @@ pub fn fmtSymtab(self: SharedObject, elf_file: *Elf) std.fmt.Formatter(Format, F | ... | @@ -519,21 +519,21 @@ pub fn fmtSymtab(self: SharedObject, elf_file: *Elf) std.fmt.Formatter(Format, F |
| 519 | const Format = struct { | 519 | const Format = struct { |
| 520 | shared: SharedObject, | 520 | shared: SharedObject, |
| 521 | elf_file: *Elf, | 521 | elf_file: *Elf, |
| 522 | }; | ||
| 523 | 522 | ||
| 524 | fn formatSymtab(f: Format, writer: *std.io.Writer) std.io.Writer.Error!void { | 523 | fn symtab(f: Format, writer: *std.io.Writer) std.io.Writer.Error!void { |
| 525 | const shared = f.shared; | 524 | const shared = f.shared; |
| 526 | const elf_file = f.elf_file; | 525 | const elf_file = f.elf_file; |
| 527 | try writer.writeAll(" globals\n"); | 526 | try writer.writeAll(" globals\n"); |
| 528 | for (shared.symbols.items, 0..) |sym, i| { | 527 | for (shared.symbols.items, 0..) |sym, i| { |
| 529 | const ref = shared.resolveSymbol(@intCast(i), elf_file); | 528 | const ref = shared.resolveSymbol(@intCast(i), elf_file); |
| 530 | if (elf_file.symbol(ref)) |ref_sym| { | 529 | if (elf_file.symbol(ref)) |ref_sym| { |
| 531 | try writer.print(" {}\n", .{ref_sym.fmt(elf_file)}); | 530 | try writer.print(" {f}\n", .{ref_sym.fmt(elf_file)}); |
| 532 | } else { | 531 | } else { |
| 533 | try writer.print(" {s} : unclaimed\n", .{sym.name(elf_file)}); | 532 | try writer.print(" {s} : unclaimed\n", .{sym.name(elf_file)}); |
| 533 | } | ||
| 534 | } | 534 | } |
| 535 | } | 535 | } |
| 536 | } | 536 | }; |
| 537 | 537 | ||
| 538 | const SharedObject = @This(); | 538 | const SharedObject = @This(); |
| 539 | 539 |
src/link/Elf/Symbol.zig+1-1| ... | @@ -338,7 +338,7 @@ const Format = struct { | ... | @@ -338,7 +338,7 @@ const Format = struct { |
| 338 | fn default(f: Format, writer: *std.io.Writer) std.io.Writer.Error!void { | 338 | fn default(f: Format, writer: *std.io.Writer) std.io.Writer.Error!void { |
| 339 | const symbol = f.symbol; | 339 | const symbol = f.symbol; |
| 340 | const elf_file = f.elf_file; | 340 | const elf_file = f.elf_file; |
| 341 | try writer.print("%{d} : {s} : @{x}", .{ | 341 | try writer.print("%{d} : {f} : @{x}", .{ |
| 342 | symbol.esym_index, | 342 | symbol.esym_index, |
| 343 | symbol.fmtName(elf_file), | 343 | symbol.fmtName(elf_file), |
| 344 | symbol.address(.{ .plt = false, .trampoline = false }, elf_file), | 344 | symbol.address(.{ .plt = false, .trampoline = false }, elf_file), |
src/link/Elf/Thunk.zig+1-1| ... | @@ -82,7 +82,7 @@ const Format = struct { | ... | @@ -82,7 +82,7 @@ const Format = struct { |
| 82 | try writer.print("@{x} : size({x})\n", .{ thunk.value, thunk.size(elf_file) }); | 82 | try writer.print("@{x} : size({x})\n", .{ thunk.value, thunk.size(elf_file) }); |
| 83 | for (thunk.symbols.keys()) |ref| { | 83 | for (thunk.symbols.keys()) |ref| { |
| 84 | const sym = elf_file.symbol(ref).?; | 84 | const sym = elf_file.symbol(ref).?; |
| 85 | try writer.print(" {} : {s} : @{x}\n", .{ ref, sym.name(elf_file), sym.value }); | 85 | try writer.print(" {f} : {s} : @{x}\n", .{ ref, sym.name(elf_file), sym.value }); |
| 86 | } | 86 | } |
| 87 | } | 87 | } |
| 88 | }; | 88 | }; |
src/link/Elf/ZigObject.zig+2-2| ... | @@ -2199,7 +2199,7 @@ const Format = struct { | ... | @@ -2199,7 +2199,7 @@ const Format = struct { |
| 2199 | self: *ZigObject, | 2199 | self: *ZigObject, |
| 2200 | elf_file: *Elf, | 2200 | elf_file: *Elf, |
| 2201 | 2201 | ||
| 2202 | fn symtab(f: Format, writer: *std.io.Writer.Error) std.io.Writer.Error!void { | 2202 | fn symtab(f: Format, writer: *std.io.Writer) std.io.Writer.Error!void { |
| 2203 | const self = f.self; | 2203 | const self = f.self; |
| 2204 | const elf_file = f.elf_file; | 2204 | const elf_file = f.elf_file; |
| 2205 | try writer.writeAll(" locals\n"); | 2205 | try writer.writeAll(" locals\n"); |
| ... | @@ -2214,7 +2214,7 @@ const Format = struct { | ... | @@ -2214,7 +2214,7 @@ const Format = struct { |
| 2214 | } | 2214 | } |
| 2215 | } | 2215 | } |
| 2216 | 2216 | ||
| 2217 | fn atoms(f: Format, writer: *std.io.Writer.Error) std.io.Writer.Error!void { | 2217 | fn atoms(f: Format, writer: *std.io.Writer) std.io.Writer.Error!void { |
| 2218 | try writer.writeAll(" atoms\n"); | 2218 | try writer.writeAll(" atoms\n"); |
| 2219 | for (f.self.atoms_indexes.items) |atom_index| { | 2219 | for (f.self.atoms_indexes.items) |atom_index| { |
| 2220 | const atom_ptr = f.self.atom(atom_index) orelse continue; | 2220 | const atom_ptr = f.self.atom(atom_index) orelse continue; |
src/link/Elf/eh_frame.zig+3-3| ... | @@ -141,7 +141,7 @@ pub const Cie = struct { | ... | @@ -141,7 +141,7 @@ pub const Cie = struct { |
| 141 | cie: Cie, | 141 | cie: Cie, |
| 142 | elf_file: *Elf, | 142 | elf_file: *Elf, |
| 143 | 143 | ||
| 144 | fn format2(f: Format, writer: *std.io.Writer) std.io.Writer.Error!void { | 144 | fn default(f: Format, writer: *std.io.Writer) std.io.Writer.Error!void { |
| 145 | const cie = f.cie; | 145 | const cie = f.cie; |
| 146 | const elf_file = f.elf_file; | 146 | const elf_file = f.elf_file; |
| 147 | const base_addr = cie.address(elf_file); | 147 | const base_addr = cie.address(elf_file); |
| ... | @@ -567,11 +567,11 @@ const riscv = struct { | ... | @@ -567,11 +567,11 @@ const riscv = struct { |
| 567 | fn reportInvalidReloc(rec: anytype, elf_file: *Elf, rel: elf.Elf64_Rela) !void { | 567 | fn reportInvalidReloc(rec: anytype, elf_file: *Elf, rel: elf.Elf64_Rela) !void { |
| 568 | const diags = &elf_file.base.comp.link_diags; | 568 | const diags = &elf_file.base.comp.link_diags; |
| 569 | var err = try diags.addErrorWithNotes(1); | 569 | var err = try diags.addErrorWithNotes(1); |
| 570 | try err.addMsg("invalid relocation type {} at offset 0x{x}", .{ | 570 | try err.addMsg("invalid relocation type {f} at offset 0x{x}", .{ |
| 571 | relocation.fmtRelocType(rel.r_type(), elf_file.getTarget().cpu.arch), | 571 | relocation.fmtRelocType(rel.r_type(), elf_file.getTarget().cpu.arch), |
| 572 | rel.r_offset, | 572 | rel.r_offset, |
| 573 | }); | 573 | }); |
| 574 | err.addNote("in {}:.eh_frame", .{elf_file.file(rec.file_index).?.fmtPath()}); | 574 | err.addNote("in {f}:.eh_frame", .{elf_file.file(rec.file_index).?.fmtPath()}); |
| 575 | return error.RelocFailure; | 575 | return error.RelocFailure; |
| 576 | } | 576 | } |
| 577 | 577 |
src/link/Elf/gc.zig+6-12| ... | @@ -111,7 +111,7 @@ fn markLive(atom: *Atom, elf_file: *Elf) void { | ... | @@ -111,7 +111,7 @@ fn markLive(atom: *Atom, elf_file: *Elf) void { |
| 111 | const target_sym = elf_file.symbol(ref) orelse continue; | 111 | const target_sym = elf_file.symbol(ref) orelse continue; |
| 112 | const target_atom = target_sym.atom(elf_file) orelse continue; | 112 | const target_atom = target_sym.atom(elf_file) orelse continue; |
| 113 | target_atom.alive = true; | 113 | target_atom.alive = true; |
| 114 | gc_track_live_log.debug("{}marking live atom({d})", .{ track_live_level, target_atom.atom_index }); | 114 | gc_track_live_log.debug("{f}marking live atom({d})", .{ track_live_level, target_atom.atom_index }); |
| 115 | if (markAtom(target_atom)) markLive(target_atom, elf_file); | 115 | if (markAtom(target_atom)) markLive(target_atom, elf_file); |
| 116 | } | 116 | } |
| 117 | } | 117 | } |
| ... | @@ -128,7 +128,7 @@ fn markLive(atom: *Atom, elf_file: *Elf) void { | ... | @@ -128,7 +128,7 @@ fn markLive(atom: *Atom, elf_file: *Elf) void { |
| 128 | } | 128 | } |
| 129 | const target_atom = target_sym.atom(elf_file) orelse continue; | 129 | const target_atom = target_sym.atom(elf_file) orelse continue; |
| 130 | target_atom.alive = true; | 130 | target_atom.alive = true; |
| 131 | gc_track_live_log.debug("{}marking live atom({d})", .{ track_live_level, target_atom.atom_index }); | 131 | gc_track_live_log.debug("{f}marking live atom({d})", .{ track_live_level, target_atom.atom_index }); |
| 132 | if (markAtom(target_atom)) markLive(target_atom, elf_file); | 132 | if (markAtom(target_atom)) markLive(target_atom, elf_file); |
| 133 | } | 133 | } |
| 134 | } | 134 | } |
| ... | @@ -170,7 +170,7 @@ pub fn dumpPrunedAtoms(elf_file: *Elf) !void { | ... | @@ -170,7 +170,7 @@ pub fn dumpPrunedAtoms(elf_file: *Elf) !void { |
| 170 | const atom = file.atom(atom_index) orelse continue; | 170 | const atom = file.atom(atom_index) orelse continue; |
| 171 | if (!atom.alive) | 171 | if (!atom.alive) |
| 172 | // TODO should we simply print to stderr? | 172 | // TODO should we simply print to stderr? |
| 173 | try stderr.print("link: removing unused section '{s}' in file '{}'\n", .{ | 173 | try stderr.print("link: removing unused section '{s}' in file '{f}'\n", .{ |
| 174 | atom.name(elf_file), | 174 | atom.name(elf_file), |
| 175 | atom.file(elf_file).?.fmtPath(), | 175 | atom.file(elf_file).?.fmtPath(), |
| 176 | }); | 176 | }); |
| ... | @@ -185,15 +185,9 @@ const Level = struct { | ... | @@ -185,15 +185,9 @@ const Level = struct { |
| 185 | self.value += 1; | 185 | self.value += 1; |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | pub fn format( | 188 | pub fn format(self: *const @This(), w: *std.io.Writer, comptime fmt: []const u8) std.io.Writer.Error!void { |
| 189 | self: *const @This(), | 189 | comptime assert(fmt.len == 0); |
| 190 | comptime unused_fmt_string: []const u8, | 190 | try w.splatByteAll(' ', self.value); |
| 191 | options: std.fmt.FormatOptions, | ||
| 192 | writer: anytype, | ||
| 193 | ) !void { | ||
| 194 | _ = unused_fmt_string; | ||
| 195 | _ = options; | ||
| 196 | try writer.writeByteNTimes(' ', self.value); | ||
| 197 | } | 191 | } |
| 198 | }; | 192 | }; |
| 199 | 193 |
src/link/Elf/relocatable.zig+4-4| ... | @@ -31,7 +31,7 @@ pub fn flushStaticLib(elf_file: *Elf, comp: *Compilation) !void { | ... | @@ -31,7 +31,7 @@ pub fn flushStaticLib(elf_file: *Elf, comp: *Compilation) !void { |
| 31 | try elf_file.allocateNonAllocSections(); | 31 | try elf_file.allocateNonAllocSections(); |
| 32 | 32 | ||
| 33 | if (build_options.enable_logging) { | 33 | if (build_options.enable_logging) { |
| 34 | state_log.debug("{}", .{elf_file.dumpState()}); | 34 | state_log.debug("{f}", .{elf_file.dumpState()}); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | try elf_file.writeMergeSections(); | 37 | try elf_file.writeMergeSections(); |
| ... | @@ -96,8 +96,8 @@ pub fn flushStaticLib(elf_file: *Elf, comp: *Compilation) !void { | ... | @@ -96,8 +96,8 @@ pub fn flushStaticLib(elf_file: *Elf, comp: *Compilation) !void { |
| 96 | }; | 96 | }; |
| 97 | 97 | ||
| 98 | if (build_options.enable_logging) { | 98 | if (build_options.enable_logging) { |
| 99 | state_log.debug("ar_symtab\n{}\n", .{ar_symtab.fmt(elf_file)}); | 99 | state_log.debug("ar_symtab\n{f}\n", .{ar_symtab.fmt(elf_file)}); |
| 100 | state_log.debug("ar_strtab\n{}\n", .{ar_strtab}); | 100 | state_log.debug("ar_strtab\n{f}\n", .{ar_strtab}); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | var buffer = std.ArrayList(u8).init(gpa); | 103 | var buffer = std.ArrayList(u8).init(gpa); |
| ... | @@ -170,7 +170,7 @@ pub fn flushObject(elf_file: *Elf, comp: *Compilation) !void { | ... | @@ -170,7 +170,7 @@ pub fn flushObject(elf_file: *Elf, comp: *Compilation) !void { |
| 170 | try elf_file.allocateNonAllocSections(); | 170 | try elf_file.allocateNonAllocSections(); |
| 171 | 171 | ||
| 172 | if (build_options.enable_logging) { | 172 | if (build_options.enable_logging) { |
| 173 | state_log.debug("{}", .{elf_file.dumpState()}); | 173 | state_log.debug("{f}", .{elf_file.dumpState()}); |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | try writeAtoms(elf_file); | 176 | try writeAtoms(elf_file); |
src/link/Elf/synthetic_sections.zig+2-2| ... | @@ -616,7 +616,7 @@ pub const GotSection = struct { | ... | @@ -616,7 +616,7 @@ pub const GotSection = struct { |
| 616 | try writer.writeAll("GOT\n"); | 616 | try writer.writeAll("GOT\n"); |
| 617 | for (got.entries.items) |entry| { | 617 | for (got.entries.items) |entry| { |
| 618 | const symbol = elf_file.symbol(entry.ref).?; | 618 | const symbol = elf_file.symbol(entry.ref).?; |
| 619 | try writer.print(" {d}@0x{x} => {}@0x{x} ({s})\n", .{ | 619 | try writer.print(" {d}@0x{x} => {f}@0x{x} ({s})\n", .{ |
| 620 | entry.cell_index, | 620 | entry.cell_index, |
| 621 | entry.address(elf_file), | 621 | entry.address(elf_file), |
| 622 | entry.ref, | 622 | entry.ref, |
| ... | @@ -752,7 +752,7 @@ pub const PltSection = struct { | ... | @@ -752,7 +752,7 @@ pub const PltSection = struct { |
| 752 | try writer.writeAll("PLT\n"); | 752 | try writer.writeAll("PLT\n"); |
| 753 | for (plt.symbols.items, 0..) |ref, i| { | 753 | for (plt.symbols.items, 0..) |ref, i| { |
| 754 | const symbol = elf_file.symbol(ref).?; | 754 | const symbol = elf_file.symbol(ref).?; |
| 755 | try writer.print(" {d}@0x{x} => {}@0x{x} ({s})\n", .{ | 755 | try writer.print(" {d}@0x{x} => {f}@0x{x} ({s})\n", .{ |
| 756 | i, | 756 | i, |
| 757 | symbol.pltAddress(elf_file), | 757 | symbol.pltAddress(elf_file), |
| 758 | ref, | 758 | ref, |
src/link/Lld.zig+6-6| ... | @@ -437,7 +437,7 @@ fn coffLink(lld: *Lld, arena: Allocator) !void { | ... | @@ -437,7 +437,7 @@ fn coffLink(lld: *Lld, arena: Allocator) !void { |
| 437 | try argv.append(try allocPrint(arena, "-PDBALTPATH:{s}", .{out_pdb_basename})); | 437 | try argv.append(try allocPrint(arena, "-PDBALTPATH:{s}", .{out_pdb_basename})); |
| 438 | } | 438 | } |
| 439 | if (comp.version) |version| { | 439 | if (comp.version) |version| { |
| 440 | try argv.append(try allocPrint(arena, "-VERSION:{}.{}", .{ version.major, version.minor })); | 440 | try argv.append(try allocPrint(arena, "-VERSION:{f}.{f}", .{ version.major, version.minor })); |
| 441 | } | 441 | } |
| 442 | 442 | ||
| 443 | if (target_util.llvmMachineAbi(target)) |mabi| { | 443 | if (target_util.llvmMachineAbi(target)) |mabi| { |
| ... | @@ -507,7 +507,7 @@ fn coffLink(lld: *Lld, arena: Allocator) !void { | ... | @@ -507,7 +507,7 @@ fn coffLink(lld: *Lld, arena: Allocator) !void { |
| 507 | 507 | ||
| 508 | if (comp.emit_implib) |raw_emit_path| { | 508 | if (comp.emit_implib) |raw_emit_path| { |
| 509 | const path = try comp.resolveEmitPathFlush(arena, .temp, raw_emit_path); | 509 | const path = try comp.resolveEmitPathFlush(arena, .temp, raw_emit_path); |
| 510 | try argv.append(try allocPrint(arena, "-IMPLIB:{}", .{path})); | 510 | try argv.append(try allocPrint(arena, "-IMPLIB:{f}", .{path})); |
| 511 | } | 511 | } |
| 512 | 512 | ||
| 513 | if (comp.config.link_libc) { | 513 | if (comp.config.link_libc) { |
| ... | @@ -533,7 +533,7 @@ fn coffLink(lld: *Lld, arena: Allocator) !void { | ... | @@ -533,7 +533,7 @@ fn coffLink(lld: *Lld, arena: Allocator) !void { |
| 533 | }, | 533 | }, |
| 534 | .object, .archive => |obj| { | 534 | .object, .archive => |obj| { |
| 535 | if (obj.must_link) { | 535 | if (obj.must_link) { |
| 536 | argv.appendAssumeCapacity(try allocPrint(arena, "-WHOLEARCHIVE:{}", .{@as(Cache.Path, obj.path)})); | 536 | argv.appendAssumeCapacity(try allocPrint(arena, "-WHOLEARCHIVE:{f}", .{@as(Cache.Path, obj.path)})); |
| 537 | } else { | 537 | } else { |
| 538 | argv.appendAssumeCapacity(try obj.path.toString(arena)); | 538 | argv.appendAssumeCapacity(try obj.path.toString(arena)); |
| 539 | } | 539 | } |
| ... | @@ -1216,7 +1216,7 @@ fn elfLink(lld: *Lld, arena: Allocator) !void { | ... | @@ -1216,7 +1216,7 @@ fn elfLink(lld: *Lld, arena: Allocator) !void { |
| 1216 | if (target.os.versionRange().gnuLibCVersion().?.order(rem_in) != .lt) continue; | 1216 | if (target.os.versionRange().gnuLibCVersion().?.order(rem_in) != .lt) continue; |
| 1217 | } | 1217 | } |
| 1218 | 1218 | ||
| 1219 | const lib_path = try std.fmt.allocPrint(arena, "{}{c}lib{s}.so.{d}", .{ | 1219 | const lib_path = try std.fmt.allocPrint(arena, "{f}{c}lib{s}.so.{d}", .{ |
| 1220 | comp.glibc_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover, | 1220 | comp.glibc_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover, |
| 1221 | }); | 1221 | }); |
| 1222 | try argv.append(lib_path); | 1222 | try argv.append(lib_path); |
| ... | @@ -1229,14 +1229,14 @@ fn elfLink(lld: *Lld, arena: Allocator) !void { | ... | @@ -1229,14 +1229,14 @@ fn elfLink(lld: *Lld, arena: Allocator) !void { |
| 1229 | })); | 1229 | })); |
| 1230 | } else if (target.isFreeBSDLibC()) { | 1230 | } else if (target.isFreeBSDLibC()) { |
| 1231 | for (freebsd.libs) |lib| { | 1231 | for (freebsd.libs) |lib| { |
| 1232 | const lib_path = try std.fmt.allocPrint(arena, "{}{c}lib{s}.so.{d}", .{ | 1232 | const lib_path = try std.fmt.allocPrint(arena, "{f}{c}lib{s}.so.{d}", .{ |
| 1233 | comp.freebsd_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover, | 1233 | comp.freebsd_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover, |
| 1234 | }); | 1234 | }); |
| 1235 | try argv.append(lib_path); | 1235 | try argv.append(lib_path); |
| 1236 | } | 1236 | } |
| 1237 | } else if (target.isNetBSDLibC()) { | 1237 | } else if (target.isNetBSDLibC()) { |
| 1238 | for (netbsd.libs) |lib| { | 1238 | for (netbsd.libs) |lib| { |
| 1239 | const lib_path = try std.fmt.allocPrint(arena, "{}{c}lib{s}.so.{d}", .{ | 1239 | const lib_path = try std.fmt.allocPrint(arena, "{f}{c}lib{s}.so.{d}", .{ |
| 1240 | comp.netbsd_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover, | 1240 | comp.netbsd_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover, |
| 1241 | }); | 1241 | }); |
| 1242 | try argv.append(lib_path); | 1242 | try argv.append(lib_path); |
src/link/MachO.zig+1-1| ... | @@ -4271,7 +4271,7 @@ pub const Platform = struct { | ... | @@ -4271,7 +4271,7 @@ pub const Platform = struct { |
| 4271 | pub fn allocPrintTarget(plat: Platform, gpa: Allocator, cpu_arch: std.Target.Cpu.Arch) error{OutOfMemory}![]u8 { | 4271 | pub fn allocPrintTarget(plat: Platform, gpa: Allocator, cpu_arch: std.Target.Cpu.Arch) error{OutOfMemory}![]u8 { |
| 4272 | var buffer = std.ArrayList(u8).init(gpa); | 4272 | var buffer = std.ArrayList(u8).init(gpa); |
| 4273 | defer buffer.deinit(); | 4273 | defer buffer.deinit(); |
| 4274 | try buffer.writer().print("{}", .{plat.fmtTarget(cpu_arch)}); | 4274 | try buffer.writer().print("{f}", .{plat.fmtTarget(cpu_arch)}); |
| 4275 | return buffer.toOwnedSlice(); | 4275 | return buffer.toOwnedSlice(); |
| 4276 | } | 4276 | } |
| 4277 | 4277 |
src/link/MachO/Archive.zig+1-1| ... | @@ -71,7 +71,7 @@ pub fn unpack(self: *Archive, macho_file: *MachO, path: Path, handle_index: File | ... | @@ -71,7 +71,7 @@ pub fn unpack(self: *Archive, macho_file: *MachO, path: Path, handle_index: File |
| 71 | .mtime = hdr.date() catch 0, | 71 | .mtime = hdr.date() catch 0, |
| 72 | }; | 72 | }; |
| 73 | 73 | ||
| 74 | log.debug("extracting object '{}' from archive '{}'", .{ object.path, path }); | 74 | log.debug("extracting object '{f}' from archive '{f}'", .{ object.path, path }); |
| 75 | 75 | ||
| 76 | try self.objects.append(gpa, object); | 76 | try self.objects.append(gpa, object); |
| 77 | } | 77 | } |
src/link/MachO/Atom.zig+1-1| ... | @@ -602,7 +602,7 @@ pub fn resolveRelocs(self: Atom, macho_file: *MachO, buffer: []u8) !void { | ... | @@ -602,7 +602,7 @@ pub fn resolveRelocs(self: Atom, macho_file: *MachO, buffer: []u8) !void { |
| 602 | }; | 602 | }; |
| 603 | try macho_file.reportParseError2( | 603 | try macho_file.reportParseError2( |
| 604 | file.getIndex(), | 604 | file.getIndex(), |
| 605 | "{s}: 0x{x}: 0x{x}: failed to relax relocation: type {}, target {s}", | 605 | "{s}: 0x{x}: 0x{x}: failed to relax relocation: type {f}, target {s}", |
| 606 | .{ | 606 | .{ |
| 607 | name, | 607 | name, |
| 608 | self.getAddress(macho_file), | 608 | self.getAddress(macho_file), |
src/link/Plan9.zig+6-6| ... | @@ -445,7 +445,7 @@ pub fn updateNav(self: *Plan9, pt: Zcu.PerThread, nav_index: InternPool.Nav.Inde | ... | @@ -445,7 +445,7 @@ pub fn updateNav(self: *Plan9, pt: Zcu.PerThread, nav_index: InternPool.Nav.Inde |
| 445 | .func => return, | 445 | .func => return, |
| 446 | .variable => |variable| Value.fromInterned(variable.init), | 446 | .variable => |variable| Value.fromInterned(variable.init), |
| 447 | .@"extern" => { | 447 | .@"extern" => { |
| 448 | log.debug("found extern decl: {}", .{nav.name.fmt(ip)}); | 448 | log.debug("found extern decl: {f}", .{nav.name.fmt(ip)}); |
| 449 | return; | 449 | return; |
| 450 | }, | 450 | }, |
| 451 | else => nav_val, | 451 | else => nav_val, |
| ... | @@ -675,7 +675,7 @@ pub fn flush( | ... | @@ -675,7 +675,7 @@ pub fn flush( |
| 675 | const off = self.getAddr(text_i, .t); | 675 | const off = self.getAddr(text_i, .t); |
| 676 | text_i += out.code.len; | 676 | text_i += out.code.len; |
| 677 | atom.offset = off; | 677 | atom.offset = off; |
| 678 | log.debug("write text nav 0x{x} ({}), lines {d} to {d}.;__GOT+0x{x} vaddr: 0x{x}", .{ nav_index, nav.name.fmt(&pt.zcu.intern_pool), out.start_line + 1, out.end_line, atom.got_index.? * 8, off }); | 678 | log.debug("write text nav 0x{x} ({f}), lines {d} to {d}.;__GOT+0x{x} vaddr: 0x{x}", .{ nav_index, nav.name.fmt(&pt.zcu.intern_pool), out.start_line + 1, out.end_line, atom.got_index.? * 8, off }); |
| 679 | if (!self.sixtyfour_bit) { | 679 | if (!self.sixtyfour_bit) { |
| 680 | mem.writeInt(u32, got_table[atom.got_index.? * 4 ..][0..4], @intCast(off), target.cpu.arch.endian()); | 680 | mem.writeInt(u32, got_table[atom.got_index.? * 4 ..][0..4], @intCast(off), target.cpu.arch.endian()); |
| 681 | } else { | 681 | } else { |
| ... | @@ -974,11 +974,11 @@ pub fn seeNav(self: *Plan9, pt: Zcu.PerThread, nav_index: InternPool.Nav.Index) | ... | @@ -974,11 +974,11 @@ pub fn seeNav(self: *Plan9, pt: Zcu.PerThread, nav_index: InternPool.Nav.Index) |
| 974 | self.etext_edata_end_atom_indices[2] = atom_idx; | 974 | self.etext_edata_end_atom_indices[2] = atom_idx; |
| 975 | } | 975 | } |
| 976 | try self.updateFinish(pt, nav_index); | 976 | try self.updateFinish(pt, nav_index); |
| 977 | log.debug("seeNav(extern) for {} (got_addr=0x{x})", .{ | 977 | log.debug("seeNav(extern) for {f} (got_addr=0x{x})", .{ |
| 978 | nav.name.fmt(ip), | 978 | nav.name.fmt(ip), |
| 979 | self.getAtom(atom_idx).getOffsetTableAddress(self), | 979 | self.getAtom(atom_idx).getOffsetTableAddress(self), |
| 980 | }); | 980 | }); |
| 981 | } else log.debug("seeNav for {}", .{nav.name.fmt(ip)}); | 981 | } else log.debug("seeNav for {f}", .{nav.name.fmt(ip)}); |
| 982 | return atom_idx; | 982 | return atom_idx; |
| 983 | } | 983 | } |
| 984 | 984 | ||
| ... | @@ -1043,7 +1043,7 @@ fn updateLazySymbolAtom( | ... | @@ -1043,7 +1043,7 @@ fn updateLazySymbolAtom( |
| 1043 | defer code_buffer.deinit(gpa); | 1043 | defer code_buffer.deinit(gpa); |
| 1044 | 1044 | ||
| 1045 | // create the symbol for the name | 1045 | // create the symbol for the name |
| 1046 | const name = try std.fmt.allocPrint(gpa, "__lazy_{s}_{}", .{ | 1046 | const name = try std.fmt.allocPrint(gpa, "__lazy_{s}_{f}", .{ |
| 1047 | @tagName(sym.kind), | 1047 | @tagName(sym.kind), |
| 1048 | Type.fromInterned(sym.ty).fmt(pt), | 1048 | Type.fromInterned(sym.ty).fmt(pt), |
| 1049 | }); | 1049 | }); |
| ... | @@ -1314,7 +1314,7 @@ pub fn getNavVAddr( | ... | @@ -1314,7 +1314,7 @@ pub fn getNavVAddr( |
| 1314 | ) !u64 { | 1314 | ) !u64 { |
| 1315 | const ip = &pt.zcu.intern_pool; | 1315 | const ip = &pt.zcu.intern_pool; |
| 1316 | const nav = ip.getNav(nav_index); | 1316 | const nav = ip.getNav(nav_index); |
| 1317 | log.debug("getDeclVAddr for {}", .{nav.name.fmt(ip)}); | 1317 | log.debug("getDeclVAddr for {f}", .{nav.name.fmt(ip)}); |
| 1318 | if (nav.getExtern(ip) != null) { | 1318 | if (nav.getExtern(ip) != null) { |
| 1319 | if (nav.name.eqlSlice("etext", ip)) { | 1319 | if (nav.name.eqlSlice("etext", ip)) { |
| 1320 | try self.addReloc(reloc_info.parent.atom_index, .{ | 1320 | try self.addReloc(reloc_info.parent.atom_index, .{ |
src/link/Wasm.zig+12-19| ... | @@ -547,7 +547,7 @@ pub const SourceLocation = enum(u32) { | ... | @@ -547,7 +547,7 @@ pub const SourceLocation = enum(u32) { |
| 547 | switch (sl.unpack(wasm)) { | 547 | switch (sl.unpack(wasm)) { |
| 548 | .none => unreachable, | 548 | .none => unreachable, |
| 549 | .zig_object_nofile => diags.addError("zig compilation unit: " ++ f, args), | 549 | .zig_object_nofile => diags.addError("zig compilation unit: " ++ f, args), |
| 550 | .object_index => |i| diags.addError("{}: " ++ f, .{i.ptr(wasm).path} ++ args), | 550 | .object_index => |i| diags.addError("{f}: " ++ f, .{i.ptr(wasm).path} ++ args), |
| 551 | .source_location_index => @panic("TODO"), | 551 | .source_location_index => @panic("TODO"), |
| 552 | } | 552 | } |
| 553 | } | 553 | } |
| ... | @@ -579,9 +579,9 @@ pub const SourceLocation = enum(u32) { | ... | @@ -579,9 +579,9 @@ pub const SourceLocation = enum(u32) { |
| 579 | .object_index => |i| { | 579 | .object_index => |i| { |
| 580 | const obj = i.ptr(wasm); | 580 | const obj = i.ptr(wasm); |
| 581 | return if (obj.archive_member_name.slice(wasm)) |obj_name| | 581 | return if (obj.archive_member_name.slice(wasm)) |obj_name| |
| 582 | try bundle.printString("{} ({s}): {s}", .{ obj.path, std.fs.path.basename(obj_name), msg }) | 582 | try bundle.printString("{f} ({s}): {s}", .{ obj.path, std.fs.path.basename(obj_name), msg }) |
| 583 | else | 583 | else |
| 584 | try bundle.printString("{}: {s}", .{ obj.path, msg }); | 584 | try bundle.printString("{f}: {s}", .{ obj.path, msg }); |
| 585 | }, | 585 | }, |
| 586 | .source_location_index => @panic("TODO"), | 586 | .source_location_index => @panic("TODO"), |
| 587 | }; | 587 | }; |
| ... | @@ -2126,14 +2126,8 @@ pub const FunctionType = extern struct { | ... | @@ -2126,14 +2126,8 @@ pub const FunctionType = extern struct { |
| 2126 | wasm: *const Wasm, | 2126 | wasm: *const Wasm, |
| 2127 | ft: FunctionType, | 2127 | ft: FunctionType, |
| 2128 | 2128 | ||
| 2129 | pub fn format( | 2129 | pub fn format(self: Formatter, writer: *std.io.Writer, comptime f: []const u8) std.io.Writer.Error!void { |
| 2130 | self: Formatter, | 2130 | comptime assert(f.len == 0); |
| 2131 | comptime format_string: []const u8, | ||
| 2132 | options: std.fmt.FormatOptions, | ||
| 2133 | writer: anytype, | ||
| 2134 | ) !void { | ||
| 2135 | if (format_string.len != 0) std.fmt.invalidFmtError(format_string, self); | ||
| 2136 | _ = options; | ||
| 2137 | const params = self.ft.params.slice(self.wasm); | 2131 | const params = self.ft.params.slice(self.wasm); |
| 2138 | const returns = self.ft.returns.slice(self.wasm); | 2132 | const returns = self.ft.returns.slice(self.wasm); |
| 2139 | 2133 | ||
| ... | @@ -2912,9 +2906,8 @@ pub const Feature = packed struct(u8) { | ... | @@ -2912,9 +2906,8 @@ pub const Feature = packed struct(u8) { |
| 2912 | @"=", | 2906 | @"=", |
| 2913 | }; | 2907 | }; |
| 2914 | 2908 | ||
| 2915 | pub fn format(feature: Feature, comptime fmt: []const u8, opt: std.fmt.FormatOptions, writer: anytype) !void { | 2909 | pub fn format(feature: Feature, writer: *std.io.Writer, comptime fmt: []const u8) std.io.Writer.Error!void { |
| 2916 | _ = opt; | 2910 | comptime assert(fmt.len == 0); |
| 2917 | _ = fmt; | ||
| 2918 | try writer.print("{s} {s}", .{ @tagName(feature.prefix), @tagName(feature.tag) }); | 2911 | try writer.print("{s} {s}", .{ @tagName(feature.prefix), @tagName(feature.tag) }); |
| 2919 | } | 2912 | } |
| 2920 | 2913 | ||
| ... | @@ -3036,7 +3029,7 @@ fn openParseObjectReportingFailure(wasm: *Wasm, path: Path) void { | ... | @@ -3036,7 +3029,7 @@ fn openParseObjectReportingFailure(wasm: *Wasm, path: Path) void { |
| 3036 | } | 3029 | } |
| 3037 | 3030 | ||
| 3038 | fn parseObject(wasm: *Wasm, obj: link.Input.Object) !void { | 3031 | fn parseObject(wasm: *Wasm, obj: link.Input.Object) !void { |
| 3039 | log.debug("parseObject {}", .{obj.path}); | 3032 | log.debug("parseObject {f}", .{obj.path}); |
| 3040 | const gpa = wasm.base.comp.gpa; | 3033 | const gpa = wasm.base.comp.gpa; |
| 3041 | const gc_sections = wasm.base.gc_sections; | 3034 | const gc_sections = wasm.base.gc_sections; |
| 3042 | 3035 | ||
| ... | @@ -3060,7 +3053,7 @@ fn parseObject(wasm: *Wasm, obj: link.Input.Object) !void { | ... | @@ -3060,7 +3053,7 @@ fn parseObject(wasm: *Wasm, obj: link.Input.Object) !void { |
| 3060 | } | 3053 | } |
| 3061 | 3054 | ||
| 3062 | fn parseArchive(wasm: *Wasm, obj: link.Input.Object) !void { | 3055 | fn parseArchive(wasm: *Wasm, obj: link.Input.Object) !void { |
| 3063 | log.debug("parseArchive {}", .{obj.path}); | 3056 | log.debug("parseArchive {f}", .{obj.path}); |
| 3064 | const gpa = wasm.base.comp.gpa; | 3057 | const gpa = wasm.base.comp.gpa; |
| 3065 | const gc_sections = wasm.base.gc_sections; | 3058 | const gc_sections = wasm.base.gc_sections; |
| 3066 | 3059 | ||
| ... | @@ -3196,7 +3189,7 @@ pub fn updateFunc( | ... | @@ -3196,7 +3189,7 @@ pub fn updateFunc( |
| 3196 | const is_obj = zcu.comp.config.output_mode == .Obj; | 3189 | const is_obj = zcu.comp.config.output_mode == .Obj; |
| 3197 | const target = &zcu.comp.root_mod.resolved_target.result; | 3190 | const target = &zcu.comp.root_mod.resolved_target.result; |
| 3198 | const owner_nav = zcu.funcInfo(func_index).owner_nav; | 3191 | const owner_nav = zcu.funcInfo(func_index).owner_nav; |
| 3199 | log.debug("updateFunc {}", .{ip.getNav(owner_nav).fqn.fmt(ip)}); | 3192 | log.debug("updateFunc {f}", .{ip.getNav(owner_nav).fqn.fmt(ip)}); |
| 3200 | 3193 | ||
| 3201 | // For Wasm, we do not lower the MIR to code just yet. That lowering happens during `flush`, | 3194 | // For Wasm, we do not lower the MIR to code just yet. That lowering happens during `flush`, |
| 3202 | // after garbage collection, which can affect function and global indexes, which affects the | 3195 | // after garbage collection, which can affect function and global indexes, which affects the |
| ... | @@ -3307,7 +3300,7 @@ pub fn updateNav(wasm: *Wasm, pt: Zcu.PerThread, nav_index: InternPool.Nav.Index | ... | @@ -3307,7 +3300,7 @@ pub fn updateNav(wasm: *Wasm, pt: Zcu.PerThread, nav_index: InternPool.Nav.Index |
| 3307 | .variable => |variable| .{ variable.init, variable.owner_nav }, | 3300 | .variable => |variable| .{ variable.init, variable.owner_nav }, |
| 3308 | else => .{ nav.status.fully_resolved.val, nav_index }, | 3301 | else => .{ nav.status.fully_resolved.val, nav_index }, |
| 3309 | }; | 3302 | }; |
| 3310 | //log.debug("updateNav {} {d}", .{ nav.fqn.fmt(ip), chased_nav_index }); | 3303 | //log.debug("updateNav {f} {d}", .{ nav.fqn.fmt(ip), chased_nav_index }); |
| 3311 | assert(!wasm.imports.contains(chased_nav_index)); | 3304 | assert(!wasm.imports.contains(chased_nav_index)); |
| 3312 | 3305 | ||
| 3313 | if (nav_init != .none and !Value.fromInterned(nav_init).typeOf(zcu).hasRuntimeBits(zcu)) { | 3306 | if (nav_init != .none and !Value.fromInterned(nav_init).typeOf(zcu).hasRuntimeBits(zcu)) { |
| ... | @@ -4347,7 +4340,7 @@ fn resolveFunctionSynthetic( | ... | @@ -4347,7 +4340,7 @@ fn resolveFunctionSynthetic( |
| 4347 | }); | 4340 | }); |
| 4348 | if (import.type != correct_func_type) { | 4341 | if (import.type != correct_func_type) { |
| 4349 | const diags = &wasm.base.comp.link_diags; | 4342 | const diags = &wasm.base.comp.link_diags; |
| 4350 | return import.source_location.fail(diags, "synthetic function {s} {} imported with incorrect signature {}", .{ | 4343 | return import.source_location.fail(diags, "synthetic function {s} {f} imported with incorrect signature {f}", .{ |
| 4351 | @tagName(res), correct_func_type.fmt(wasm), import.type.fmt(wasm), | 4344 | @tagName(res), correct_func_type.fmt(wasm), import.type.fmt(wasm), |
| 4352 | }); | 4345 | }); |
| 4353 | } | 4346 | } |
src/link/table_section.zig+2-8| ... | @@ -39,14 +39,8 @@ pub fn TableSection(comptime Entry: type) type { | ... | @@ -39,14 +39,8 @@ pub fn TableSection(comptime Entry: type) type { |
| 39 | return self.entries.items.len; | 39 | return self.entries.items.len; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | pub fn format( | 42 | pub fn format(self: Self, writer: *std.io.Writer, comptime f: []const u8) std.io.Writer.Error!void { |
| 43 | self: Self, | 43 | comptime assert(f.len == 0); |
| 44 | comptime unused_format_string: []const u8, | ||
| 45 | options: std.fmt.FormatOptions, | ||
| 46 | writer: anytype, | ||
| 47 | ) !void { | ||
| 48 | _ = options; | ||
| 49 | comptime assert(unused_format_string.len == 0); | ||
| 50 | try writer.writeAll("TableSection:\n"); | 44 | try writer.writeAll("TableSection:\n"); |
| 51 | for (self.entries.items, 0..) |entry, i| { | 45 | for (self.entries.items, 0..) |entry, i| { |
| 52 | try writer.print(" {d} => {}\n", .{ i, entry }); | 46 | try writer.print(" {d} => {}\n", .{ i, entry }); |
src/main.zig+1-1| ... | @@ -5296,7 +5296,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | ... | @@ -5296,7 +5296,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 5296 | const s = fs.path.sep_str; | 5296 | const s = fs.path.sep_str; |
| 5297 | const tmp_sub_path = "tmp" ++ s ++ results_tmp_file_nonce; | 5297 | const tmp_sub_path = "tmp" ++ s ++ results_tmp_file_nonce; |
| 5298 | const stdout = dirs.local_cache.handle.readFileAlloc(arena, tmp_sub_path, 50 * 1024 * 1024) catch |err| { | 5298 | const stdout = dirs.local_cache.handle.readFileAlloc(arena, tmp_sub_path, 50 * 1024 * 1024) catch |err| { |
| 5299 | fatal("unable to read results of configure phase from '{}{s}': {s}", .{ | 5299 | fatal("unable to read results of configure phase from '{f}{s}': {s}", .{ |
| 5300 | dirs.local_cache, tmp_sub_path, @errorName(err), | 5300 | dirs.local_cache, tmp_sub_path, @errorName(err), |
| 5301 | }); | 5301 | }); |
| 5302 | }; | 5302 | }; |
src/print_targets.zig+1-1| ... | @@ -64,7 +64,7 @@ pub fn cmdTargets( | ... | @@ -64,7 +64,7 @@ pub fn cmdTargets( |
| 64 | { | 64 | { |
| 65 | var glibc_obj = try root_obj.beginTupleField("glibc", .{}); | 65 | var glibc_obj = try root_obj.beginTupleField("glibc", .{}); |
| 66 | for (glibc_abi.all_versions) |ver| { | 66 | for (glibc_abi.all_versions) |ver| { |
| 67 | const tmp = try std.fmt.allocPrint(allocator, "{}", .{ver}); | 67 | const tmp = try std.fmt.allocPrint(allocator, "{f}", .{ver}); |
| 68 | defer allocator.free(tmp); | 68 | defer allocator.free(tmp); |
| 69 | try glibc_obj.field(tmp, .{}); | 69 | try glibc_obj.field(tmp, .{}); |
| 70 | } | 70 | } |
src/print_value.zig+4-3| ... | @@ -76,14 +76,15 @@ pub fn print( | ... | @@ -76,14 +76,15 @@ pub fn print( |
| 76 | .@"extern" => |e| try writer.print("(extern '{f}')", .{e.name.fmt(ip)}), | 76 | .@"extern" => |e| try writer.print("(extern '{f}')", .{e.name.fmt(ip)}), |
| 77 | .func => |func| try writer.print("(function '{f}')", .{ip.getNav(func.owner_nav).name.fmt(ip)}), | 77 | .func => |func| try writer.print("(function '{f}')", .{ip.getNav(func.owner_nav).name.fmt(ip)}), |
| 78 | .int => |int| switch (int.storage) { | 78 | .int => |int| switch (int.storage) { |
| 79 | inline .u64, .i64, .big_int => |x| try writer.print("{}", .{x}), | 79 | inline .u64, .i64 => |x| try writer.print("{d}", .{x}), |
| 80 | .big_int => |x| try writer.print("{fd}", .{x}), | ||
| 80 | .lazy_align => |ty| if (opt_sema != null) { | 81 | .lazy_align => |ty| if (opt_sema != null) { |
| 81 | const a = try Type.fromInterned(ty).abiAlignmentSema(pt); | 82 | const a = try Type.fromInterned(ty).abiAlignmentSema(pt); |
| 82 | try writer.print("{}", .{a.toByteUnits() orelse 0}); | 83 | try writer.print("{d}", .{a.toByteUnits() orelse 0}); |
| 83 | } else try writer.print("@alignOf({f})", .{Type.fromInterned(ty).fmt(pt)}), | 84 | } else try writer.print("@alignOf({f})", .{Type.fromInterned(ty).fmt(pt)}), |
| 84 | .lazy_size => |ty| if (opt_sema != null) { | 85 | .lazy_size => |ty| if (opt_sema != null) { |
| 85 | const s = try Type.fromInterned(ty).abiSizeSema(pt); | 86 | const s = try Type.fromInterned(ty).abiSizeSema(pt); |
| 86 | try writer.print("{}", .{s}); | 87 | try writer.print("{d}", .{s}); |
| 87 | } else try writer.print("@sizeOf({f})", .{Type.fromInterned(ty).fmt(pt)}), | 88 | } else try writer.print("@sizeOf({f})", .{Type.fromInterned(ty).fmt(pt)}), |
| 88 | }, | 89 | }, |
| 89 | .err => |err| try writer.print("error.{f}", .{ | 90 | .err => |err| try writer.print("error.{f}", .{ |
src/print_zir.zig+9-9| ... | @@ -1212,8 +1212,8 @@ const Writer = struct { | ... | @@ -1212,8 +1212,8 @@ const Writer = struct { |
| 1212 | 1212 | ||
| 1213 | const name = self.code.nullTerminatedString(output.data.name); | 1213 | const name = self.code.nullTerminatedString(output.data.name); |
| 1214 | const constraint = self.code.nullTerminatedString(output.data.constraint); | 1214 | const constraint = self.code.nullTerminatedString(output.data.constraint); |
| 1215 | try stream.print("output({fp}, \"{f}\", ", .{ | 1215 | try stream.print("output({f}, \"{f}\", ", .{ |
| 1216 | std.zig.fmtId(name), std.zig.fmtString(constraint), | 1216 | std.zig.fmtIdP(name), std.zig.fmtString(constraint), |
| 1217 | }); | 1217 | }); |
| 1218 | try self.writeFlag(stream, "->", is_type); | 1218 | try self.writeFlag(stream, "->", is_type); |
| 1219 | try self.writeInstRef(stream, output.data.operand); | 1219 | try self.writeInstRef(stream, output.data.operand); |
| ... | @@ -1231,8 +1231,8 @@ const Writer = struct { | ... | @@ -1231,8 +1231,8 @@ const Writer = struct { |
| 1231 | 1231 | ||
| 1232 | const name = self.code.nullTerminatedString(input.data.name); | 1232 | const name = self.code.nullTerminatedString(input.data.name); |
| 1233 | const constraint = self.code.nullTerminatedString(input.data.constraint); | 1233 | const constraint = self.code.nullTerminatedString(input.data.constraint); |
| 1234 | try stream.print("input({fp}, \"{f}\", ", .{ | 1234 | try stream.print("input({f}, \"{f}\", ", .{ |
| 1235 | std.zig.fmtId(name), std.zig.fmtString(constraint), | 1235 | std.zig.fmtIdP(name), std.zig.fmtString(constraint), |
| 1236 | }); | 1236 | }); |
| 1237 | try self.writeInstRef(stream, input.data.operand); | 1237 | try self.writeInstRef(stream, input.data.operand); |
| 1238 | try stream.writeAll(")"); | 1238 | try stream.writeAll(")"); |
| ... | @@ -1247,7 +1247,7 @@ const Writer = struct { | ... | @@ -1247,7 +1247,7 @@ const Writer = struct { |
| 1247 | const str_index = self.code.extra[extra_i]; | 1247 | const str_index = self.code.extra[extra_i]; |
| 1248 | extra_i += 1; | 1248 | extra_i += 1; |
| 1249 | const clobber = self.code.nullTerminatedString(@enumFromInt(str_index)); | 1249 | const clobber = self.code.nullTerminatedString(@enumFromInt(str_index)); |
| 1250 | try stream.print("{fp}", .{std.zig.fmtId(clobber)}); | 1250 | try stream.print("{f}", .{std.zig.fmtIdP(clobber)}); |
| 1251 | if (i + 1 < clobbers_len) { | 1251 | if (i + 1 < clobbers_len) { |
| 1252 | try stream.writeAll(", "); | 1252 | try stream.writeAll(", "); |
| 1253 | } | 1253 | } |
| ... | @@ -1511,7 +1511,7 @@ const Writer = struct { | ... | @@ -1511,7 +1511,7 @@ const Writer = struct { |
| 1511 | try self.writeFlag(stream, "comptime ", field.is_comptime); | 1511 | try self.writeFlag(stream, "comptime ", field.is_comptime); |
| 1512 | if (field.name != .empty) { | 1512 | if (field.name != .empty) { |
| 1513 | const field_name = self.code.nullTerminatedString(field.name); | 1513 | const field_name = self.code.nullTerminatedString(field.name); |
| 1514 | try stream.print("{fp}: ", .{std.zig.fmtId(field_name)}); | 1514 | try stream.print("{f}: ", .{std.zig.fmtIdP(field_name)}); |
| 1515 | } else { | 1515 | } else { |
| 1516 | try stream.print("@\"{d}\": ", .{i}); | 1516 | try stream.print("@\"{d}\": ", .{i}); |
| 1517 | } | 1517 | } |
| ... | @@ -1674,7 +1674,7 @@ const Writer = struct { | ... | @@ -1674,7 +1674,7 @@ const Writer = struct { |
| 1674 | extra_index += 1; | 1674 | extra_index += 1; |
| 1675 | 1675 | ||
| 1676 | try stream.splatByteAll(' ', self.indent); | 1676 | try stream.splatByteAll(' ', self.indent); |
| 1677 | try stream.print("{fp}", .{std.zig.fmtId(field_name)}); | 1677 | try stream.print("{f}", .{std.zig.fmtIdP(field_name)}); |
| 1678 | 1678 | ||
| 1679 | if (has_type) { | 1679 | if (has_type) { |
| 1680 | const field_type = @as(Zir.Inst.Ref, @enumFromInt(self.code.extra[extra_index])); | 1680 | const field_type = @as(Zir.Inst.Ref, @enumFromInt(self.code.extra[extra_index])); |
| ... | @@ -1808,7 +1808,7 @@ const Writer = struct { | ... | @@ -1808,7 +1808,7 @@ const Writer = struct { |
| 1808 | extra_index += 1; | 1808 | extra_index += 1; |
| 1809 | 1809 | ||
| 1810 | try stream.splatByteAll(' ', self.indent); | 1810 | try stream.splatByteAll(' ', self.indent); |
| 1811 | try stream.print("{fp}", .{std.zig.fmtId(field_name)}); | 1811 | try stream.print("{f}", .{std.zig.fmtIdP(field_name)}); |
| 1812 | 1812 | ||
| 1813 | if (has_tag_value) { | 1813 | if (has_tag_value) { |
| 1814 | const tag_value_ref = @as(Zir.Inst.Ref, @enumFromInt(self.code.extra[extra_index])); | 1814 | const tag_value_ref = @as(Zir.Inst.Ref, @enumFromInt(self.code.extra[extra_index])); |
| ... | @@ -1913,7 +1913,7 @@ const Writer = struct { | ... | @@ -1913,7 +1913,7 @@ const Writer = struct { |
| 1913 | const name_index: Zir.NullTerminatedString = @enumFromInt(self.code.extra[extra_index]); | 1913 | const name_index: Zir.NullTerminatedString = @enumFromInt(self.code.extra[extra_index]); |
| 1914 | const name = self.code.nullTerminatedString(name_index); | 1914 | const name = self.code.nullTerminatedString(name_index); |
| 1915 | try stream.splatByteAll(' ', self.indent); | 1915 | try stream.splatByteAll(' ', self.indent); |
| 1916 | try stream.print("{fp},\n", .{std.zig.fmtId(name)}); | 1916 | try stream.print("{f},\n", .{std.zig.fmtIdP(name)}); |
| 1917 | } | 1917 | } |
| 1918 | 1918 | ||
| 1919 | self.indent -= 2; | 1919 | self.indent -= 2; |
src/register_manager.zig+8-8| ... | @@ -149,7 +149,7 @@ pub fn RegisterManager( | ... | @@ -149,7 +149,7 @@ pub fn RegisterManager( |
| 149 | /// Only the owner of the `RegisterLock` can unlock the | 149 | /// Only the owner of the `RegisterLock` can unlock the |
| 150 | /// register later. | 150 | /// register later. |
| 151 | pub fn lockRegIndex(self: *Self, tracked_index: TrackedIndex) ?RegisterLock { | 151 | pub fn lockRegIndex(self: *Self, tracked_index: TrackedIndex) ?RegisterLock { |
| 152 | log.debug("locking {f}", .{regAtTrackedIndex(tracked_index)}); | 152 | log.debug("locking {}", .{regAtTrackedIndex(tracked_index)}); |
| 153 | if (self.isRegIndexLocked(tracked_index)) { | 153 | if (self.isRegIndexLocked(tracked_index)) { |
| 154 | log.debug(" register already locked", .{}); | 154 | log.debug(" register already locked", .{}); |
| 155 | return null; | 155 | return null; |
| ... | @@ -164,7 +164,7 @@ pub fn RegisterManager( | ... | @@ -164,7 +164,7 @@ pub fn RegisterManager( |
| 164 | /// Like `lockReg` but asserts the register was unused always | 164 | /// Like `lockReg` but asserts the register was unused always |
| 165 | /// returning a valid lock. | 165 | /// returning a valid lock. |
| 166 | pub fn lockRegIndexAssumeUnused(self: *Self, tracked_index: TrackedIndex) RegisterLock { | 166 | pub fn lockRegIndexAssumeUnused(self: *Self, tracked_index: TrackedIndex) RegisterLock { |
| 167 | log.debug("locking asserting free {f}", .{regAtTrackedIndex(tracked_index)}); | 167 | log.debug("locking asserting free {}", .{regAtTrackedIndex(tracked_index)}); |
| 168 | assert(!self.isRegIndexLocked(tracked_index)); | 168 | assert(!self.isRegIndexLocked(tracked_index)); |
| 169 | self.locked_registers.set(tracked_index); | 169 | self.locked_registers.set(tracked_index); |
| 170 | return RegisterLock{ .tracked_index = tracked_index }; | 170 | return RegisterLock{ .tracked_index = tracked_index }; |
| ... | @@ -202,7 +202,7 @@ pub fn RegisterManager( | ... | @@ -202,7 +202,7 @@ pub fn RegisterManager( |
| 202 | /// Requires `RegisterLock` to unlock a register. | 202 | /// Requires `RegisterLock` to unlock a register. |
| 203 | /// Call `lockReg` to obtain the lock first. | 203 | /// Call `lockReg` to obtain the lock first. |
| 204 | pub fn unlockReg(self: *Self, lock: RegisterLock) void { | 204 | pub fn unlockReg(self: *Self, lock: RegisterLock) void { |
| 205 | log.debug("unlocking {f}", .{regAtTrackedIndex(lock.tracked_index)}); | 205 | log.debug("unlocking {}", .{regAtTrackedIndex(lock.tracked_index)}); |
| 206 | self.locked_registers.unset(lock.tracked_index); | 206 | self.locked_registers.unset(lock.tracked_index); |
| 207 | } | 207 | } |
| 208 | 208 | ||
| ... | @@ -238,7 +238,7 @@ pub fn RegisterManager( | ... | @@ -238,7 +238,7 @@ pub fn RegisterManager( |
| 238 | if (i < count) return null; | 238 | if (i < count) return null; |
| 239 | 239 | ||
| 240 | for (regs, insts) |reg, inst| { | 240 | for (regs, insts) |reg, inst| { |
| 241 | log.debug("tryAllocReg {f} for inst {f}", .{ reg, inst }); | 241 | log.debug("tryAllocReg {} for inst {f}", .{ reg, inst }); |
| 242 | self.markRegAllocated(reg); | 242 | self.markRegAllocated(reg); |
| 243 | 243 | ||
| 244 | if (inst) |tracked_inst| { | 244 | if (inst) |tracked_inst| { |
| ... | @@ -317,7 +317,7 @@ pub fn RegisterManager( | ... | @@ -317,7 +317,7 @@ pub fn RegisterManager( |
| 317 | tracked_index: TrackedIndex, | 317 | tracked_index: TrackedIndex, |
| 318 | inst: ?Air.Inst.Index, | 318 | inst: ?Air.Inst.Index, |
| 319 | ) AllocationError!void { | 319 | ) AllocationError!void { |
| 320 | log.debug("getReg {f} for inst {f}", .{ regAtTrackedIndex(tracked_index), inst }); | 320 | log.debug("getReg {} for inst {f}", .{ regAtTrackedIndex(tracked_index), inst }); |
| 321 | if (!self.isRegIndexFree(tracked_index)) { | 321 | if (!self.isRegIndexFree(tracked_index)) { |
| 322 | // Move the instruction that was previously there to a | 322 | // Move the instruction that was previously there to a |
| 323 | // stack allocation. | 323 | // stack allocation. |
| ... | @@ -330,7 +330,7 @@ pub fn RegisterManager( | ... | @@ -330,7 +330,7 @@ pub fn RegisterManager( |
| 330 | self.getRegIndexAssumeFree(tracked_index, inst); | 330 | self.getRegIndexAssumeFree(tracked_index, inst); |
| 331 | } | 331 | } |
| 332 | pub fn getReg(self: *Self, reg: Register, inst: ?Air.Inst.Index) AllocationError!void { | 332 | pub fn getReg(self: *Self, reg: Register, inst: ?Air.Inst.Index) AllocationError!void { |
| 333 | log.debug("getting reg: {f}", .{reg}); | 333 | log.debug("getting reg: {}", .{reg}); |
| 334 | return self.getRegIndex(indexOfRegIntoTracked(reg) orelse return, inst); | 334 | return self.getRegIndex(indexOfRegIntoTracked(reg) orelse return, inst); |
| 335 | } | 335 | } |
| 336 | pub fn getKnownReg( | 336 | pub fn getKnownReg( |
| ... | @@ -349,7 +349,7 @@ pub fn RegisterManager( | ... | @@ -349,7 +349,7 @@ pub fn RegisterManager( |
| 349 | tracked_index: TrackedIndex, | 349 | tracked_index: TrackedIndex, |
| 350 | inst: ?Air.Inst.Index, | 350 | inst: ?Air.Inst.Index, |
| 351 | ) void { | 351 | ) void { |
| 352 | log.debug("getRegAssumeFree {f} for inst {f}", .{ regAtTrackedIndex(tracked_index), inst }); | 352 | log.debug("getRegAssumeFree {} for inst {f}", .{ regAtTrackedIndex(tracked_index), inst }); |
| 353 | self.markRegIndexAllocated(tracked_index); | 353 | self.markRegIndexAllocated(tracked_index); |
| 354 | 354 | ||
| 355 | assert(self.isRegIndexFree(tracked_index)); | 355 | assert(self.isRegIndexFree(tracked_index)); |
| ... | @@ -364,7 +364,7 @@ pub fn RegisterManager( | ... | @@ -364,7 +364,7 @@ pub fn RegisterManager( |
| 364 | 364 | ||
| 365 | /// Marks the specified register as free | 365 | /// Marks the specified register as free |
| 366 | pub fn freeRegIndex(self: *Self, tracked_index: TrackedIndex) void { | 366 | pub fn freeRegIndex(self: *Self, tracked_index: TrackedIndex) void { |
| 367 | log.debug("freeing register {f}", .{regAtTrackedIndex(tracked_index)}); | 367 | log.debug("freeing register {}", .{regAtTrackedIndex(tracked_index)}); |
| 368 | self.registers[tracked_index] = undefined; | 368 | self.registers[tracked_index] = undefined; |
| 369 | self.markRegIndexFree(tracked_index); | 369 | self.markRegIndexFree(tracked_index); |
| 370 | } | 370 | } |
src/translate_c.zig+4-4| ... | @@ -3327,7 +3327,7 @@ fn transConstantExpr(c: *Context, scope: *Scope, expr: *const clang.Expr, used: | ... | @@ -3327,7 +3327,7 @@ fn transConstantExpr(c: *Context, scope: *Scope, expr: *const clang.Expr, used: |
| 3327 | return maybeSuppressResult(c, used, as_node); | 3327 | return maybeSuppressResult(c, used, as_node); |
| 3328 | }, | 3328 | }, |
| 3329 | else => |kind| { | 3329 | else => |kind| { |
| 3330 | return fail(c, error.UnsupportedTranslation, expr.getBeginLoc(), "unsupported constant expression kind '{}'", .{kind}); | 3330 | return fail(c, error.UnsupportedTranslation, expr.getBeginLoc(), "unsupported constant expression kind '{f}'", .{kind}); |
| 3331 | }, | 3331 | }, |
| 3332 | } | 3332 | } |
| 3333 | } | 3333 | } |
| ... | @@ -5832,7 +5832,7 @@ fn zigifyEscapeSequences(ctx: *Context, m: *MacroCtx) ![]const u8 { | ... | @@ -5832,7 +5832,7 @@ fn zigifyEscapeSequences(ctx: *Context, m: *MacroCtx) ![]const u8 { |
| 5832 | num += c - 'A' + 10; | 5832 | num += c - 'A' + 10; |
| 5833 | }, | 5833 | }, |
| 5834 | else => { | 5834 | else => { |
| 5835 | i += std.fmt.printInt(bytes[i..], num, 16, .lower, std.fmt.FormatOptions{ .fill = '0', .width = 2 }); | 5835 | i += std.fmt.printInt(bytes[i..], num, 16, .lower, .{ .fill = '0', .width = 2 }); |
| 5836 | num = 0; | 5836 | num = 0; |
| 5837 | if (c == '\\') | 5837 | if (c == '\\') |
| 5838 | state = .escape | 5838 | state = .escape |
| ... | @@ -5858,7 +5858,7 @@ fn zigifyEscapeSequences(ctx: *Context, m: *MacroCtx) ![]const u8 { | ... | @@ -5858,7 +5858,7 @@ fn zigifyEscapeSequences(ctx: *Context, m: *MacroCtx) ![]const u8 { |
| 5858 | }; | 5858 | }; |
| 5859 | num += c - '0'; | 5859 | num += c - '0'; |
| 5860 | } else { | 5860 | } else { |
| 5861 | i += std.fmt.printInt(bytes[i..], num, 16, .lower, std.fmt.FormatOptions{ .fill = '0', .width = 2 }); | 5861 | i += std.fmt.printInt(bytes[i..], num, 16, .lower, .{ .fill = '0', .width = 2 }); |
| 5862 | num = 0; | 5862 | num = 0; |
| 5863 | count = 0; | 5863 | count = 0; |
| 5864 | if (c == '\\') | 5864 | if (c == '\\') |
| ... | @@ -5872,7 +5872,7 @@ fn zigifyEscapeSequences(ctx: *Context, m: *MacroCtx) ![]const u8 { | ... | @@ -5872,7 +5872,7 @@ fn zigifyEscapeSequences(ctx: *Context, m: *MacroCtx) ![]const u8 { |
| 5872 | } | 5872 | } |
| 5873 | } | 5873 | } |
| 5874 | if (state == .hex or state == .octal) | 5874 | if (state == .hex or state == .octal) |
| 5875 | i += std.fmt.printInt(bytes[i..], num, 16, .lower, std.fmt.FormatOptions{ .fill = '0', .width = 2 }); | 5875 | i += std.fmt.printInt(bytes[i..], num, 16, .lower, .{ .fill = '0', .width = 2 }); |
| 5876 | return bytes[0..i]; | 5876 | return bytes[0..i]; |
| 5877 | } | 5877 | } |
| 5878 | 5878 |