aboutsummaryrefslogtreecommitdiff
path: root/src-self-hosted/util.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-11-27 13:38:49 -0500
committerGitHub <noreply@github.com>2019-11-27 13:38:49 -0500
commit83c664eaa080669cff83f7c30046376f3399eafb (patch)
tree06cccc09052be4459e924d04a867ff34a889d87c /src-self-hosted/util.zig
parent63300a21ddf4cfe209a39796c6d7ea7773e14fd6 (diff)
parent4d8a8e65df79ddd5edf52f961552036ccfca6e8e (diff)
downloadzig-83c664eaa080669cff83f7c30046376f3399eafb.tar.gz
zig-83c664eaa080669cff83f7c30046376f3399eafb.zip
Merge pull request #3780 from Vexu/stage2-async-review
Update use of async functions in self hosted compiler
Diffstat (limited to 'src-self-hosted/util.zig')
-rw-r--r--src-self-hosted/util.zig23
1 files changed, 12 insertions, 11 deletions
diff --git a/src-self-hosted/util.zig b/src-self-hosted/util.zig
index f1d892411f..070ba9ba87 100644
--- a/src-self-hosted/util.zig
+++ b/src-self-hosted/util.zig
@@ -32,21 +32,21 @@ pub fn getFloatAbi(self: Target) FloatAbi {
};
}
-pub fn getObjectFormat(self: Target) Target.ObjectFormat {
- return switch (self) {
- .Native => @import("builtin").object_format,
- .Cross => {
+pub fn getObjectFormat(target: Target) Target.ObjectFormat {
+ switch (target) {
+ .Native => return @import("builtin").object_format,
+ .Cross => blk: {
if (target.isWindows() or target.isUefi()) {
- break .coff;
+ return .coff;
} else if (target.isDarwin()) {
- break .macho;
+ return .macho;
}
if (target.isWasm()) {
- break .wasm;
+ return .wasm;
}
- break .elf;
+ return .elf;
},
- };
+ }
}
pub fn getDynamicLinkerPath(self: Target) ?[]const u8 {
@@ -156,7 +156,7 @@ pub fn getDynamicLinkerPath(self: Target) ?[]const u8 {
}
}
-pub fn getDarwinArchString(self: Target) []const u8 {
+pub fn getDarwinArchString(self: Target) [:0]const u8 {
const arch = self.getArch();
switch (arch) {
.aarch64 => return "arm64",
@@ -166,7 +166,8 @@ pub fn getDarwinArchString(self: Target) []const u8 {
.powerpc => return "ppc",
.powerpc64 => return "ppc64",
.powerpc64le => return "ppc64le",
- else => return @tagName(arch),
+ // @tagName should be able to return sentinel terminated slice
+ else => @panic("TODO https://github.com/ziglang/zig/issues/3779"), //return @tagName(arch),
}
}