authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-09-13 14:10:13-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-09-13 14:10:13-07:00
logfda6d44778f3faf53c66945a0db65be68113416f
tree56d5a1888b773308399ecfd54dd345f9673af26e
parentc25ce5bba0d00283ad4de9077dba5a8d5255b619

zig cc: do not enable the cache for link operations

This commit makes `zig cc` match the equivalent behavior of `zig build-exe` with regards to caching. That is - it will cache individual .c to .o compilations (with the usual exceptions), but will always repeat the linking process so that incremental linking has a chance to happen. Perhaps a future enhancement will provide a way to get the old behavior, but I suspect this new behavior will be preferred by everyone, because it is closer to what C compilers do. Note that the old behavior can be obtained by switching to `zig build-exe` instead of `zig cc` and using the `--enable-cache` parameter. Closes #12317

1 files changed, 0 insertions(+), 1 deletions(-)

src/main.zig-1
...@@ -2110,7 +2110,6 @@ fn buildOutputType(...@@ -2110,7 +2110,6 @@ fn buildOutputType(
2110 .link => {2110 .link => {
2111 output_mode = if (is_shared_lib) .Lib else .Exe;2111 output_mode = if (is_shared_lib) .Lib else .Exe;
2112 emit_bin = if (out_path) |p| .{ .yes = p } else EmitBin.yes_a_out;2112 emit_bin = if (out_path) |p| .{ .yes = p } else EmitBin.yes_a_out;
2113 enable_cache = true;
2114 if (emit_llvm) {2113 if (emit_llvm) {
2115 fatal("-emit-llvm cannot be used when linking", .{});2114 fatal("-emit-llvm cannot be used when linking", .{});
2116 }2115 }