Skip to content

Commit

Permalink
Fix more stray uses of {} for formatting strings
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonBoy authored and andrewrk committed Jan 3, 2021
1 parent 1ca2dec commit d2f6fa1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
14 changes: 7 additions & 7 deletions src/Module.zig
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ pub fn ensureDeclAnalyzed(self: *Module, decl: *Decl) InnerError!void {
.complete => return,

.outdated => blk: {
log.debug("re-analyzing {}\n", .{decl.name});
log.debug("re-analyzing {s}\n", .{decl.name});

// The exports this Decl performs will be re-discovered, so we remove them here
// prior to re-analysis.
Expand Down Expand Up @@ -1663,7 +1663,7 @@ pub fn analyzeContainer(self: *Module, container_scope: *Scope.Container) !void
// Handle explicitly deleted decls from the source code. Not to be confused
// with when we delete decls because they are no longer referenced.
for (deleted_decls.items()) |entry| {
log.debug("noticed '{}' deleted from source\n", .{entry.key.name});
log.debug("noticed '{s}' deleted from source\n", .{entry.key.name});
try self.deleteDecl(entry.key);
}
}
Expand Down Expand Up @@ -1716,7 +1716,7 @@ pub fn analyzeRootZIRModule(self: *Module, root_scope: *Scope.ZIRModule) !void {
// Handle explicitly deleted decls from the source code. Not to be confused
// with when we delete decls because they are no longer referenced.
for (deleted_decls.items()) |entry| {
log.debug("noticed '{}' deleted from source\n", .{entry.key.name});
log.debug("noticed '{s}' deleted from source\n", .{entry.key.name});
try self.deleteDecl(entry.key);
}
}
Expand All @@ -1728,7 +1728,7 @@ pub fn deleteDecl(self: *Module, decl: *Decl) !void {
// not be present in the set, and this does nothing.
decl.scope.removeDecl(decl);

log.debug("deleting decl '{}'\n", .{decl.name});
log.debug("deleting decl '{s}'\n", .{decl.name});
const name_hash = decl.fullyQualifiedNameHash();
self.decl_table.removeAssertDiscard(name_hash);
// Remove itself from its dependencies, because we are about to destroy the decl pointer.
Expand Down Expand Up @@ -1819,17 +1819,17 @@ pub fn analyzeFnBody(self: *Module, decl: *Decl, func: *Fn) !void {
const fn_zir = func.analysis.queued;
defer fn_zir.arena.promote(self.gpa).deinit();
func.analysis = .{ .in_progress = {} };
log.debug("set {} to in_progress\n", .{decl.name});
log.debug("set {s} to in_progress\n", .{decl.name});

try zir_sema.analyzeBody(self, &inner_block.base, fn_zir.body);

const instructions = try arena.allocator.dupe(*Inst, inner_block.instructions.items);
func.analysis = .{ .success = .{ .instructions = instructions } };
log.debug("set {} to success\n", .{decl.name});
log.debug("set {s} to success\n", .{decl.name});
}

fn markOutdatedDecl(self: *Module, decl: *Decl) !void {
log.debug("mark {} outdated\n", .{decl.name});
log.debug("mark {s} outdated\n", .{decl.name});
try self.comp.work_queue.writeItem(.{ .analyze_decl = decl });
if (self.failed_decls.remove(decl)) |entry| {
entry.value.destroy(self.gpa);
Expand Down
4 changes: 2 additions & 2 deletions src/link/Elf.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2300,7 +2300,7 @@ pub fn updateDecl(self: *Elf, module: *Module, decl: *Module.Decl) !void {
!mem.isAlignedGeneric(u64, local_sym.st_value, required_alignment);
if (need_realloc) {
const vaddr = try self.growTextBlock(&decl.link.elf, code.len, required_alignment);
log.debug("growing {} from 0x{x} to 0x{x}\n", .{ decl.name, local_sym.st_value, vaddr });
log.debug("growing {s} from 0x{x} to 0x{x}\n", .{ decl.name, local_sym.st_value, vaddr });
if (vaddr != local_sym.st_value) {
local_sym.st_value = vaddr;

Expand All @@ -2322,7 +2322,7 @@ pub fn updateDecl(self: *Elf, module: *Module, decl: *Module.Decl) !void {
const decl_name = mem.spanZ(decl.name);
const name_str_index = try self.makeString(decl_name);
const vaddr = try self.allocateTextBlock(&decl.link.elf, code.len, required_alignment);
log.debug("allocated text block for {} at 0x{x}\n", .{ decl_name, vaddr });
log.debug("allocated text block for {s} at 0x{x}\n", .{ decl_name, vaddr });
errdefer self.freeTextBlock(&decl.link.elf);

local_sym.* = .{
Expand Down
2 changes: 1 addition & 1 deletion src/test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ pub const TestContext = struct {
}
}
if (comp.bin_file.cast(link.File.C)) |c_file| {
std.debug.print("Generated C: \n===============\n{}\n\n===========\n\n", .{
std.debug.print("Generated C: \n===============\n{s}\n\n===========\n\n", .{
c_file.main.items,
});
}
Expand Down
4 changes: 2 additions & 2 deletions test/compare_output.zig
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
\\ _ = args_it.skip();
\\ while (args_it.next(allocator)) |arg_or_err| : (index += 1) {
\\ const arg = try arg_or_err;
\\ try stdout.print("{}: {}\n", .{index, arg});
\\ try stdout.print("{}: {s}\n", .{index, arg});
\\ }
\\}
,
Expand Down Expand Up @@ -492,7 +492,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
\\ _ = args_it.skip();
\\ while (args_it.next(allocator)) |arg_or_err| : (index += 1) {
\\ const arg = try arg_or_err;
\\ try stdout.print("{}: {}\n", .{index, arg});
\\ try stdout.print("{}: {s}\n", .{index, arg});
\\ }
\\}
,
Expand Down
3 changes: 2 additions & 1 deletion test/stage1/behavior/async_fn.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const std = @import("std");
const builtin = @import("builtin");
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const expectEqualStrings = std.testing.expectEqualStrings;
const expectError = std.testing.expectError;

var global_x: i32 = 1;
Expand Down Expand Up @@ -541,7 +542,7 @@ test "pass string literal to async function" {
fn hello(msg: []const u8) void {
frame = @frame();
suspend;
expectEqual(@as([]const u8, "hello"), msg);
expectEqualStrings("hello", msg);
ok = true;
}
};
Expand Down

0 comments on commit d2f6fa1

Please sign in to comment.