diff options
| author | r00ster91 <r00ster91@proton.me> | 2022-07-23 16:53:59 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-07-27 18:07:53 +0300 |
| commit | baafb8a491c296fbf434c8cf44d9485e8f2c729c (patch) | |
| tree | 4dffed76fe1898abb975c70085e509b7f0e3a879 /src | |
| parent | 4ef7d8581085394d55f5effbb38c05a15546af1b (diff) | |
| download | zig-baafb8a491c296fbf434c8cf44d9485e8f2c729c.tar.gz zig-baafb8a491c296fbf434c8cf44d9485e8f2c729c.zip | |
std.fmt: add more invalid format string errors
Diffstat (limited to 'src')
| -rw-r--r-- | src/Sema.zig | 2 | ||||
| -rw-r--r-- | src/arch/sparc64/bits.zig | 4 | ||||
| -rw-r--r-- | src/arch/wasm/CodeGen.zig | 6 | ||||
| -rw-r--r-- | src/arch/x86_64/Emit.zig | 2 | ||||
| -rw-r--r-- | src/link/MachO/Atom.zig | 6 | ||||
| -rw-r--r-- | src/link/MachO/Dylib.zig | 4 | ||||
| -rw-r--r-- | src/link/MachO/Object.zig | 4 | ||||
| -rw-r--r-- | src/link/MachO/fat.zig | 2 | ||||
| -rw-r--r-- | src/main.zig | 6 | ||||
| -rw-r--r-- | src/print_zir.zig | 2 | ||||
| -rw-r--r-- | src/translate_c.zig | 2 |
11 files changed, 20 insertions, 20 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 8894036424..293169e293 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -2173,7 +2173,7 @@ fn coerceResultPtr( }, else => { if (std.debug.runtime_safety) { - std.debug.panic("unexpected AIR tag for coerce_result_ptr: {s}", .{ + std.debug.panic("unexpected AIR tag for coerce_result_ptr: {}", .{ air_tags[trash_inst], }); } else { diff --git a/src/arch/sparc64/bits.zig b/src/arch/sparc64/bits.zig index ebfc55635c..ea85c59f2b 100644 --- a/src/arch/sparc64/bits.zig +++ b/src/arch/sparc64/bits.zig @@ -1582,8 +1582,8 @@ test "Serialize formats" { for (testcases) |case| { const actual = case.inst.toU32(); testing.expectEqual(case.expected, actual) catch |err| { - std.debug.print("error: {x}\n", .{err}); - std.debug.print("case: {x}\n", .{case}); + std.debug.print("error: {}\n", .{err}); + std.debug.print("case: {}\n", .{case}); return err; }; } diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig index 1fbf9f5785..fd9e13a220 100644 --- a/src/arch/wasm/CodeGen.zig +++ b/src/arch/wasm/CodeGen.zig @@ -1773,7 +1773,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions. } else if (func_val.castTag(.decl_ref)) |decl_ref| { break :blk module.declPtr(decl_ref.data); } - return self.fail("Expected a function, but instead found type '{s}'", .{func_val.tag()}); + return self.fail("Expected a function, but instead found type '{}'", .{func_val.tag()}); }; const sret = if (first_param_sret) blk: { @@ -2365,7 +2365,7 @@ fn lowerConstant(self: *Self, val: Value, ty: Type) InnerError!WValue { }, .int_u64, .one => return WValue{ .imm32 = @intCast(u32, val.toUnsignedInt(target)) }, .zero, .null_value => return WValue{ .imm32 = 0 }, - else => return self.fail("Wasm TODO: lowerConstant for other const pointer tag {s}", .{val.tag()}), + else => return self.fail("Wasm TODO: lowerConstant for other const pointer tag {}", .{val.tag()}), }, .Enum => { if (val.castTag(.enum_field_index)) |field_index| { @@ -2421,7 +2421,7 @@ fn lowerConstant(self: *Self, val: Value, ty: Type) InnerError!WValue { const is_pl = val.tag() == .opt_payload; return WValue{ .imm32 = if (is_pl) @as(u32, 1) else 0 }; }, - else => |zig_type| return self.fail("Wasm TODO: LowerConstant for zigTypeTag {s}", .{zig_type}), + else => |zig_type| return self.fail("Wasm TODO: LowerConstant for zigTypeTag {}", .{zig_type}), } } diff --git a/src/arch/x86_64/Emit.zig b/src/arch/x86_64/Emit.zig index 52d68e81ec..8b61c6077c 100644 --- a/src/arch/x86_64/Emit.zig +++ b/src/arch/x86_64/Emit.zig @@ -202,7 +202,7 @@ pub fn lowerMir(emit: *Emit) InnerError!void { .pop_regs => try emit.mirPushPopRegisterList(.pop, inst), else => { - return emit.fail("Implement MIR->Emit lowering for x86_64 for pseudo-inst: {s}", .{tag}); + return emit.fail("Implement MIR->Emit lowering for x86_64 for pseudo-inst: {}", .{tag}); }, } } diff --git a/src/link/MachO/Atom.zig b/src/link/MachO/Atom.zig index ca840e1a51..ba00764127 100644 --- a/src/link/MachO/Atom.zig +++ b/src/link/MachO/Atom.zig @@ -246,7 +246,7 @@ pub fn parseRelocs(self: *Atom, relocs: []const macho.relocation_info, context: else => { log.err("unexpected relocation type after ARM64_RELOC_ADDEND", .{}); log.err(" expected ARM64_RELOC_PAGE21 or ARM64_RELOC_PAGEOFF12", .{}); - log.err(" found {s}", .{next}); + log.err(" found {}", .{next}); return error.UnexpectedRelocationType; }, } @@ -285,7 +285,7 @@ pub fn parseRelocs(self: *Atom, relocs: []const macho.relocation_info, context: else => { log.err("unexpected relocation type after ARM64_RELOC_ADDEND", .{}); log.err(" expected ARM64_RELOC_UNSIGNED", .{}); - log.err(" found {s}", .{@intToEnum(macho.reloc_type_arm64, relocs[i + 1].r_type)}); + log.err(" found {}", .{@intToEnum(macho.reloc_type_arm64, relocs[i + 1].r_type)}); return error.UnexpectedRelocationType; }, }, @@ -294,7 +294,7 @@ pub fn parseRelocs(self: *Atom, relocs: []const macho.relocation_info, context: else => { log.err("unexpected relocation type after X86_64_RELOC_ADDEND", .{}); log.err(" expected X86_64_RELOC_UNSIGNED", .{}); - log.err(" found {s}", .{@intToEnum(macho.reloc_type_x86_64, relocs[i + 1].r_type)}); + log.err(" found {}", .{@intToEnum(macho.reloc_type_x86_64, relocs[i + 1].r_type)}); return error.UnexpectedRelocationType; }, }, diff --git a/src/link/MachO/Dylib.zig b/src/link/MachO/Dylib.zig index e46ede8d1e..ffc0b2cca6 100644 --- a/src/link/MachO/Dylib.zig +++ b/src/link/MachO/Dylib.zig @@ -167,7 +167,7 @@ pub fn parse( const this_arch: std.Target.Cpu.Arch = try fat.decodeArch(self.header.?.cputype, true); if (this_arch != cpu_arch) { - log.err("mismatched cpu architecture: expected {s}, found {s}", .{ cpu_arch, this_arch }); + log.err("mismatched cpu architecture: expected {}, found {}", .{ cpu_arch, this_arch }); return error.MismatchedCpuArchitecture; } @@ -208,7 +208,7 @@ fn readLoadCommands( } }, else => { - log.debug("Unknown load command detected: 0x{x}.", .{cmd.cmd()}); + log.debug("Unknown load command detected: 0x{x}.", .{@enumToInt(cmd.cmd())}); }, } self.load_commands.appendAssumeCapacity(cmd); diff --git a/src/link/MachO/Object.zig b/src/link/MachO/Object.zig index c7fb4f3ee4..0d929627cd 100644 --- a/src/link/MachO/Object.zig +++ b/src/link/MachO/Object.zig @@ -110,7 +110,7 @@ pub fn parse(self: *Object, allocator: Allocator, cpu_arch: std.Target.Cpu.Arch) }, }; if (this_arch != cpu_arch) { - log.err("mismatched cpu architecture: expected {s}, found {s}", .{ cpu_arch, this_arch }); + log.err("mismatched cpu architecture: expected {}, found {}", .{ cpu_arch, this_arch }); return error.MismatchedCpuArchitecture; } @@ -171,7 +171,7 @@ pub fn parse(self: *Object, allocator: Allocator, cpu_arch: std.Target.Cpu.Arch) cmd.linkedit_data.dataoff += file_offset; }, else => { - log.debug("Unknown load command detected: 0x{x}.", .{cmd.cmd()}); + log.debug("Unknown load command detected: 0x{x}.", .{@enumToInt(cmd.cmd())}); }, } self.load_commands.appendAssumeCapacity(cmd); diff --git a/src/link/MachO/fat.zig b/src/link/MachO/fat.zig index 3eddd93761..1511f274a8 100644 --- a/src/link/MachO/fat.zig +++ b/src/link/MachO/fat.zig @@ -46,7 +46,7 @@ pub fn getLibraryOffset(reader: anytype, cpu_arch: std.Target.Cpu.Arch) !u64 { return fat_arch.offset; } } else { - log.err("Could not find matching cpu architecture in fat library: expected {s}", .{cpu_arch}); + log.err("Could not find matching cpu architecture in fat library: expected {}", .{cpu_arch}); return error.MismatchedCpuArchitecture; } } diff --git a/src/main.zig b/src/main.zig index c9b9d1c0af..bd86cd2bb9 100644 --- a/src/main.zig +++ b/src/main.zig @@ -4076,12 +4076,12 @@ pub fn cmdFmt(gpa: Allocator, arena: Allocator, args: []const []const u8) !void const stdin = io.getStdIn(); const source_code = readSourceFileToEndAlloc(gpa, &stdin, null) catch |err| { - fatal("unable to read stdin: {s}", .{err}); + fatal("unable to read stdin: {}", .{err}); }; defer gpa.free(source_code); var tree = std.zig.parse(gpa, source_code) catch |err| { - fatal("error parsing stdin: {s}", .{err}); + fatal("error parsing stdin: {}", .{err}); }; defer tree.deinit(gpa); @@ -5011,7 +5011,7 @@ pub fn cmdAstCheck( } else { const stdin = io.getStdIn(); const source = readSourceFileToEndAlloc(arena, &stdin, null) catch |err| { - fatal("unable to read stdin: {s}", .{err}); + fatal("unable to read stdin: {}", .{err}); }; file.sub_file_path = "<stdin>"; file.source = source; diff --git a/src/print_zir.zig b/src/print_zir.zig index 6b85e767d3..de51c271c4 100644 --- a/src/print_zir.zig +++ b/src/print_zir.zig @@ -551,7 +551,7 @@ const Writer = struct { fn writeElemTypeIndex(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void { const inst_data = self.code.instructions.items(.data)[inst].bin; try self.writeInstRef(stream, inst_data.lhs); - try stream.print(", {d})", .{inst_data.rhs}); + try stream.print(", {d})", .{@enumToInt(inst_data.rhs)}); } fn writeUnNode( diff --git a/src/translate_c.zig b/src/translate_c.zig index d5b2d145f3..e53342990e 100644 --- a/src/translate_c.zig +++ b/src/translate_c.zig @@ -3279,7 +3279,7 @@ fn transConstantExpr(c: *Context, scope: *Scope, expr: *const clang.Expr, used: return maybeSuppressResult(c, scope, used, as_node); }, else => |kind| { - return fail(c, error.UnsupportedTranslation, expr.getBeginLoc(), "unsupported constant expression kind '{s}'", .{kind}); + return fail(c, error.UnsupportedTranslation, expr.getBeginLoc(), "unsupported constant expression kind '{}'", .{kind}); }, } } |
