authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-03-20 22:33:02+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-03-20 15:09:45-07:00
log39133321451682d6610b09161114ab96ebdb3d2d
treed649a40ebce36b9e3740cad7937e296b482b94b5
parente35f325dd1b45c22a781a7b2074c49036d163a72

Fix digest format specifier after std.fmt updates


1 files changed, 17 insertions(+), 6 deletions(-)

src/Compilation.zig+17-6
...@@ -3183,7 +3183,11 @@ fn updateStage1Module(comp: *Compilation, main_progress_node: *std.Progress.Node...@@ -3183,7 +3183,11 @@ fn updateStage1Module(comp: *Compilation, main_progress_node: *std.Progress.Node
3183 id_symlink_basename,3183 id_symlink_basename,
3184 &prev_digest_buf,3184 &prev_digest_buf,
3185 ) catch |err| blk: {3185 ) catch |err| blk: {
3186 log.debug("stage1 {s} new_digest={} error: {s}", .{ mod.root_pkg.root_src_path, digest, @errorName(err) });3186 log.debug("stage1 {s} new_digest={s} error: {s}", .{
3187 mod.root_pkg.root_src_path,
3188 std.fmt.fmtSliceHexLower(&digest),
3189 @errorName(err),
3190 });
3187 // Handle this as a cache miss.3191 // Handle this as a cache miss.
3188 break :blk prev_digest_buf[0..0];3192 break :blk prev_digest_buf[0..0];
3189 };3193 };
...@@ -3191,10 +3195,13 @@ fn updateStage1Module(comp: *Compilation, main_progress_node: *std.Progress.Node...@@ -3191,10 +3195,13 @@ fn updateStage1Module(comp: *Compilation, main_progress_node: *std.Progress.Node
3191 if (!mem.eql(u8, prev_digest[0..digest.len], &digest))3195 if (!mem.eql(u8, prev_digest[0..digest.len], &digest))
3192 break :hit;3196 break :hit;
31933197
3194 log.debug("stage1 {s} digest={} match - skipping invocation", .{ mod.root_pkg.root_src_path, digest });3198 log.debug("stage1 {s} digest={s} match - skipping invocation", .{
3199 mod.root_pkg.root_src_path,
3200 std.fmt.fmtSliceHexLower(&digest),
3201 });
3195 var flags_bytes: [1]u8 = undefined;3202 var flags_bytes: [1]u8 = undefined;
3196 _ = std.fmt.hexToBytes(&flags_bytes, prev_digest[digest.len..]) catch {3203 _ = std.fmt.hexToBytes(&flags_bytes, prev_digest[digest.len..]) catch {
3197 log.warn("bad cache stage1 digest: '{s}'", .{prev_digest});3204 log.warn("bad cache stage1 digest: '{s}'", .{std.fmt.fmtSliceHexLower(prev_digest)});
3198 break :hit;3205 break :hit;
3199 };3206 };
32003207
...@@ -3214,7 +3221,11 @@ fn updateStage1Module(comp: *Compilation, main_progress_node: *std.Progress.Node...@@ -3214,7 +3221,11 @@ fn updateStage1Module(comp: *Compilation, main_progress_node: *std.Progress.Node
3214 mod.stage1_flags = @bitCast(@TypeOf(mod.stage1_flags), flags_bytes[0]);3221 mod.stage1_flags = @bitCast(@TypeOf(mod.stage1_flags), flags_bytes[0]);
3215 return;3222 return;
3216 }3223 }
3217 log.debug("stage1 {s} prev_digest={} new_digest={}", .{ mod.root_pkg.root_src_path, prev_digest, digest });3224 log.debug("stage1 {s} prev_digest={s} new_digest={s}", .{
3225 mod.root_pkg.root_src_path,
3226 std.fmt.fmtSliceHexLower(prev_digest),
3227 std.fmt.fmtSliceHexLower(&digest),
3228 });
3218 man.unhit(prev_hash_state, input_file_count);3229 man.unhit(prev_hash_state, input_file_count);
3219 }3230 }
32203231
...@@ -3361,8 +3372,8 @@ fn updateStage1Module(comp: *Compilation, main_progress_node: *std.Progress.Node...@@ -3361,8 +3372,8 @@ fn updateStage1Module(comp: *Compilation, main_progress_node: *std.Progress.Node
3361 // Update the small file with the digest. If it fails we can continue; it only3372 // Update the small file with the digest. If it fails we can continue; it only
3362 // means that the next invocation will have an unnecessary cache miss.3373 // means that the next invocation will have an unnecessary cache miss.
3363 const stage1_flags_byte = @bitCast(u8, mod.stage1_flags);3374 const stage1_flags_byte = @bitCast(u8, mod.stage1_flags);
3364 log.debug("stage1 {s} final digest={} flags={x}", .{3375 log.debug("stage1 {s} final digest={s} flags={x}", .{
3365 mod.root_pkg.root_src_path, digest, stage1_flags_byte,3376 mod.root_pkg.root_src_path, std.fmt.fmtSliceHexLower(&digest), stage1_flags_byte,
3366 });3377 });
3367 var digest_plus_flags: [digest.len + 2]u8 = undefined;3378 var digest_plus_flags: [digest.len + 2]u8 = undefined;
3368 digest_plus_flags[0..digest.len].* = digest;3379 digest_plus_flags[0..digest.len].* = digest;