aboutsummaryrefslogtreecommitdiff
path: root/lib/compilers/zig.js
diff options
context:
space:
mode:
authorMarc Tiehuis <marctiehuis@gmail.com>2018-10-02 21:22:02 +1300
committerMarc Tiehuis <marctiehuis@gmail.com>2018-10-02 21:24:52 +1300
commit291c7c09e2473d80e4014c628ba61738ed6bee31 (patch)
treec2bce7e18b2736a18d3f0240af7e61399085cf1b /lib/compilers/zig.js
parent24f804f5d0753199282d41012dc8a657e31e3b2a (diff)
downloadcompiler-explorer-291c7c09e2473d80e4014c628ba61738ed6bee31.tar.gz
compiler-explorer-291c7c09e2473d80e4014c628ba61738ed6bee31.zip
Fix zig 0.2.0 compilation failures
There is a bug in the zig 0.2.0 compiler when emitting an explicit assembly output file. Binary dumping using objdump is required.
Diffstat (limited to 'lib/compilers/zig.js')
-rw-r--r--lib/compilers/zig.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/compilers/zig.js b/lib/compilers/zig.js
index 9567fc40b..fdeaf4bae 100644
--- a/lib/compilers/zig.js
+++ b/lib/compilers/zig.js
@@ -33,12 +33,21 @@ class ZigCompiler extends BaseCompiler {
}
preProcess(source) {
- source += '\n';
- source += 'extern fn zig_panic() noreturn;\n';
- source += 'pub inline fn panic(msg: []const u8, error_return_trace: ' +
- '?*@import("builtin").StackTrace) noreturn {\n';
- source += ' zig_panic();\n';
- source += '}\n';
+ if (this.compiler.semver == '0.2.0') {
+ source += '\n';
+ source += 'extern fn zig_panic() noreturn;\n';
+ source += 'pub inline fn panic(msg: []const u8, error_return_trace: ' +
+ '?&@import("builtin").StackTrace) noreturn {\n';
+ source += ' zig_panic();\n';
+ source += '}\n';
+ } else {
+ source += '\n';
+ source += 'extern fn zig_panic() noreturn;\n';
+ source += 'pub inline fn panic(msg: []const u8, error_return_trace: ' +
+ '?*@import("builtin").StackTrace) noreturn {\n';
+ source += ' zig_panic();\n';
+ source += '}\n';
+ }
return source;
}