zig cc: emit to a.out if outpath is unspecified

If `-o` is not specified for `zig cc` for linking, it should emit the
`a.out` (or equivalent) to the current directory. So then this:

    $ zig cc test.c

Should result in `./a.out`.

If directory is omitted from `Compilation.EmitLoc`, it will default to
the cache directory later in the compilation chain, which will result
in `a.out` missing in the current directory.

If we specify the directory to `Compilation.EmitLoc`, it will be
handled, allegedly, correctly.

Fixes #12858
This commit is contained in:
Motiejus Jakštys
2022-09-19 16:24:07 +03:00
committed by Andrew Kelley
parent e42f83825f
commit 4521456f66
+1 -1
View File
@@ -2613,7 +2613,7 @@ fn buildOutputType(
}
},
.yes_a_out => Compilation.EmitLoc{
.directory = null,
.directory = .{ .path = null, .handle = fs.cwd() },
.basename = a_out_basename,
},
};