From 4521456f66122c6348ef6980ae1eecdb94f4f110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Mon, 19 Sep 2022 16:24:07 +0300 Subject: [PATCH] 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 --- src/main.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.zig b/src/main.zig index 35610542a8..691e1da54c 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2613,7 +2613,7 @@ fn buildOutputType( } }, .yes_a_out => Compilation.EmitLoc{ - .directory = null, + .directory = .{ .path = null, .handle = fs.cwd() }, .basename = a_out_basename, }, };