diff options
author | Rubén Rincón Blanco <ruben@rinconblanco.es> | 2018-10-02 11:25:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-02 11:25:47 +0200 |
commit | d700ae9186b96fe031c06617ba4cafcb01088a62 (patch) | |
tree | c2bce7e18b2736a18d3f0240af7e61399085cf1b /lib/compilers/zig.js | |
parent | 24f804f5d0753199282d41012dc8a657e31e3b2a (diff) | |
parent | 291c7c09e2473d80e4014c628ba61738ed6bee31 (diff) | |
download | compiler-explorer-d700ae9186b96fe031c06617ba4cafcb01088a62.tar.gz compiler-explorer-d700ae9186b96fe031c06617ba4cafcb01088a62.zip |
Merge pull request #1101 from tiehuis/master
Fix zig 0.2.0 compilation failures
Diffstat (limited to 'lib/compilers/zig.js')
-rw-r--r-- | lib/compilers/zig.js | 21 |
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; } |