authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-11-26 17:06:52+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-01-02 17:12:57-07:00
logd2f6fa1608f31cbd7137f81b5dd6df2977766eae
treefc4636cb8846a60995c353bbace342fc08544862
parent1ca2deca33e5ee489e12bd71a34ec3e4a2e1255f

Fix more stray uses of {} for formatting strings


5 files changed, 14 insertions(+), 13 deletions(-)

src/Module.zig+7-7
...@@ -918,7 +918,7 @@ pub fn ensureDeclAnalyzed(self: *Module, decl: *Decl) InnerError!void {...@@ -918,7 +918,7 @@ pub fn ensureDeclAnalyzed(self: *Module, decl: *Decl) InnerError!void {
918 .complete => return,918 .complete => return,
919919
920 .outdated => blk: {920 .outdated => blk: {
921 log.debug("re-analyzing {}\n", .{decl.name});921 log.debug("re-analyzing {s}\n", .{decl.name});
922922
923 // The exports this Decl performs will be re-discovered, so we remove them here923 // The exports this Decl performs will be re-discovered, so we remove them here
924 // prior to re-analysis.924 // prior to re-analysis.
...@@ -1663,7 +1663,7 @@ pub fn analyzeContainer(self: *Module, container_scope: *Scope.Container) !void...@@ -1663,7 +1663,7 @@ pub fn analyzeContainer(self: *Module, container_scope: *Scope.Container) !void
1663 // Handle explicitly deleted decls from the source code. Not to be confused1663 // Handle explicitly deleted decls from the source code. Not to be confused
1664 // with when we delete decls because they are no longer referenced.1664 // with when we delete decls because they are no longer referenced.
1665 for (deleted_decls.items()) |entry| {1665 for (deleted_decls.items()) |entry| {
1666 log.debug("noticed '{}' deleted from source\n", .{entry.key.name});1666 log.debug("noticed '{s}' deleted from source\n", .{entry.key.name});
1667 try self.deleteDecl(entry.key);1667 try self.deleteDecl(entry.key);
1668 }1668 }
1669}1669}
...@@ -1716,7 +1716,7 @@ pub fn analyzeRootZIRModule(self: *Module, root_scope: *Scope.ZIRModule) !void {...@@ -1716,7 +1716,7 @@ pub fn analyzeRootZIRModule(self: *Module, root_scope: *Scope.ZIRModule) !void {
1716 // Handle explicitly deleted decls from the source code. Not to be confused1716 // Handle explicitly deleted decls from the source code. Not to be confused
1717 // with when we delete decls because they are no longer referenced.1717 // with when we delete decls because they are no longer referenced.
1718 for (deleted_decls.items()) |entry| {1718 for (deleted_decls.items()) |entry| {
1719 log.debug("noticed '{}' deleted from source\n", .{entry.key.name});1719 log.debug("noticed '{s}' deleted from source\n", .{entry.key.name});
1720 try self.deleteDecl(entry.key);1720 try self.deleteDecl(entry.key);
1721 }1721 }
1722}1722}
...@@ -1728,7 +1728,7 @@ pub fn deleteDecl(self: *Module, decl: *Decl) !void {...@@ -1728,7 +1728,7 @@ pub fn deleteDecl(self: *Module, decl: *Decl) !void {
1728 // not be present in the set, and this does nothing.1728 // not be present in the set, and this does nothing.
1729 decl.scope.removeDecl(decl);1729 decl.scope.removeDecl(decl);
17301730
1731 log.debug("deleting decl '{}'\n", .{decl.name});1731 log.debug("deleting decl '{s}'\n", .{decl.name});
1732 const name_hash = decl.fullyQualifiedNameHash();1732 const name_hash = decl.fullyQualifiedNameHash();
1733 self.decl_table.removeAssertDiscard(name_hash);1733 self.decl_table.removeAssertDiscard(name_hash);
1734 // Remove itself from its dependencies, because we are about to destroy the decl pointer.1734 // Remove itself from its dependencies, because we are about to destroy the decl pointer.
...@@ -1819,17 +1819,17 @@ pub fn analyzeFnBody(self: *Module, decl: *Decl, func: *Fn) !void {...@@ -1819,17 +1819,17 @@ pub fn analyzeFnBody(self: *Module, decl: *Decl, func: *Fn) !void {
1819 const fn_zir = func.analysis.queued;1819 const fn_zir = func.analysis.queued;
1820 defer fn_zir.arena.promote(self.gpa).deinit();1820 defer fn_zir.arena.promote(self.gpa).deinit();
1821 func.analysis = .{ .in_progress = {} };1821 func.analysis = .{ .in_progress = {} };
1822 log.debug("set {} to in_progress\n", .{decl.name});1822 log.debug("set {s} to in_progress\n", .{decl.name});
18231823
1824 try zir_sema.analyzeBody(self, &inner_block.base, fn_zir.body);1824 try zir_sema.analyzeBody(self, &inner_block.base, fn_zir.body);
18251825
1826 const instructions = try arena.allocator.dupe(*Inst, inner_block.instructions.items);1826 const instructions = try arena.allocator.dupe(*Inst, inner_block.instructions.items);
1827 func.analysis = .{ .success = .{ .instructions = instructions } };1827 func.analysis = .{ .success = .{ .instructions = instructions } };
1828 log.debug("set {} to success\n", .{decl.name});1828 log.debug("set {s} to success\n", .{decl.name});
1829}1829}
18301830
1831fn markOutdatedDecl(self: *Module, decl: *Decl) !void {1831fn markOutdatedDecl(self: *Module, decl: *Decl) !void {
1832 log.debug("mark {} outdated\n", .{decl.name});1832 log.debug("mark {s} outdated\n", .{decl.name});
1833 try self.comp.work_queue.writeItem(.{ .analyze_decl = decl });1833 try self.comp.work_queue.writeItem(.{ .analyze_decl = decl });
1834 if (self.failed_decls.remove(decl)) |entry| {1834 if (self.failed_decls.remove(decl)) |entry| {
1835 entry.value.destroy(self.gpa);1835 entry.value.destroy(self.gpa);
src/link/Elf.zig+2-2
...@@ -2300,7 +2300,7 @@ pub fn updateDecl(self: *Elf, module: *Module, decl: *Module.Decl) !void {...@@ -2300,7 +2300,7 @@ pub fn updateDecl(self: *Elf, module: *Module, decl: *Module.Decl) !void {
2300 !mem.isAlignedGeneric(u64, local_sym.st_value, required_alignment);2300 !mem.isAlignedGeneric(u64, local_sym.st_value, required_alignment);
2301 if (need_realloc) {2301 if (need_realloc) {
2302 const vaddr = try self.growTextBlock(&decl.link.elf, code.len, required_alignment);2302 const vaddr = try self.growTextBlock(&decl.link.elf, code.len, required_alignment);
2303 log.debug("growing {} from 0x{x} to 0x{x}\n", .{ decl.name, local_sym.st_value, vaddr });2303 log.debug("growing {s} from 0x{x} to 0x{x}\n", .{ decl.name, local_sym.st_value, vaddr });
2304 if (vaddr != local_sym.st_value) {2304 if (vaddr != local_sym.st_value) {
2305 local_sym.st_value = vaddr;2305 local_sym.st_value = vaddr;
23062306
...@@ -2322,7 +2322,7 @@ pub fn updateDecl(self: *Elf, module: *Module, decl: *Module.Decl) !void {...@@ -2322,7 +2322,7 @@ pub fn updateDecl(self: *Elf, module: *Module, decl: *Module.Decl) !void {
2322 const decl_name = mem.spanZ(decl.name);2322 const decl_name = mem.spanZ(decl.name);
2323 const name_str_index = try self.makeString(decl_name);2323 const name_str_index = try self.makeString(decl_name);
2324 const vaddr = try self.allocateTextBlock(&decl.link.elf, code.len, required_alignment);2324 const vaddr = try self.allocateTextBlock(&decl.link.elf, code.len, required_alignment);
2325 log.debug("allocated text block for {} at 0x{x}\n", .{ decl_name, vaddr });2325 log.debug("allocated text block for {s} at 0x{x}\n", .{ decl_name, vaddr });
2326 errdefer self.freeTextBlock(&decl.link.elf);2326 errdefer self.freeTextBlock(&decl.link.elf);
23272327
2328 local_sym.* = .{2328 local_sym.* = .{
src/test.zig+1-1
...@@ -660,7 +660,7 @@ pub const TestContext = struct {...@@ -660,7 +660,7 @@ pub const TestContext = struct {
660 }660 }
661 }661 }
662 if (comp.bin_file.cast(link.File.C)) |c_file| {662 if (comp.bin_file.cast(link.File.C)) |c_file| {
663 std.debug.print("Generated C: \n===============\n{}\n\n===========\n\n", .{663 std.debug.print("Generated C: \n===============\n{s}\n\n===========\n\n", .{
664 c_file.main.items,664 c_file.main.items,
665 });665 });
666 }666 }
test/compare_output.zig+2-2
...@@ -453,7 +453,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -453,7 +453,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
453 \\ _ = args_it.skip();453 \\ _ = args_it.skip();
454 \\ while (args_it.next(allocator)) |arg_or_err| : (index += 1) {454 \\ while (args_it.next(allocator)) |arg_or_err| : (index += 1) {
455 \\ const arg = try arg_or_err;455 \\ const arg = try arg_or_err;
456 \\ try stdout.print("{}: {}\n", .{index, arg});456 \\ try stdout.print("{}: {s}\n", .{index, arg});
457 \\ }457 \\ }
458 \\}458 \\}
459 ,459 ,
...@@ -492,7 +492,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -492,7 +492,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
492 \\ _ = args_it.skip();492 \\ _ = args_it.skip();
493 \\ while (args_it.next(allocator)) |arg_or_err| : (index += 1) {493 \\ while (args_it.next(allocator)) |arg_or_err| : (index += 1) {
494 \\ const arg = try arg_or_err;494 \\ const arg = try arg_or_err;
495 \\ try stdout.print("{}: {}\n", .{index, arg});495 \\ try stdout.print("{}: {s}\n", .{index, arg});
496 \\ }496 \\ }
497 \\}497 \\}
498 ,498 ,
test/stage1/behavior/async_fn.zig+2-1
...@@ -2,6 +2,7 @@ const std = @import("std");...@@ -2,6 +2,7 @@ const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const expect = std.testing.expect;3const expect = std.testing.expect;
4const expectEqual = std.testing.expectEqual;4const expectEqual = std.testing.expectEqual;
5const expectEqualStrings = std.testing.expectEqualStrings;
5const expectError = std.testing.expectError;6const expectError = std.testing.expectError;
67
7var global_x: i32 = 1;8var global_x: i32 = 1;
...@@ -541,7 +542,7 @@ test "pass string literal to async function" {...@@ -541,7 +542,7 @@ test "pass string literal to async function" {
541 fn hello(msg: []const u8) void {542 fn hello(msg: []const u8) void {
542 frame = @frame();543 frame = @frame();
543 suspend;544 suspend;
544 expectEqual(@as([]const u8, "hello"), msg);545 expectEqualStrings("hello", msg);
545 ok = true;546 ok = true;
546 }547 }
547 };548 };