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
This commit is contained in:
Andrew Kelley 2022-09-13 14:10:13 -07:00
parent c25ce5bba0
commit fda6d44778

View File

@ -2110,7 +2110,6 @@ fn buildOutputType(
.link => {
output_mode = if (is_shared_lib) .Lib else .Exe;
emit_bin = if (out_path) |p| .{ .yes = p } else EmitBin.yes_a_out;
enable_cache = true;
if (emit_llvm) {
fatal("-emit-llvm cannot be used when linking", .{});
}