std.fmt: add more invalid format string errors
This commit is contained in:
committed by
Veikka Tuominen
parent
4ef7d85810
commit
baafb8a491
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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});
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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});
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user