mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-13 23:36:29 +00:00
Check in panic_utils.zig
This commit is contained in:
parent
18713e2209
commit
d7db10d7b5
1 changed files with 16 additions and 0 deletions
16
crates/compiler/builtins/bitcode/src/panic.zig
Normal file
16
crates/compiler/builtins/bitcode/src/panic.zig
Normal file
|
@ -0,0 +1,16 @@
|
|||
const std = @import("std");
|
||||
const RocStr = @import("str.zig").RocStr;
|
||||
const always_inline = std.builtin.CallOptions.Modifier.always_inline;
|
||||
|
||||
// Signals to the host that the program has panicked
|
||||
extern fn roc_panic(msg: *const RocStr, tag_id: u32) callconv(.C) void;
|
||||
|
||||
pub fn panic_help(msg: []const u8, tag_id: u32) void {
|
||||
var str = RocStr.init(msg.ptr, msg.len);
|
||||
roc_panic(&str, tag_id);
|
||||
}
|
||||
|
||||
// must export this explicitly because right now it is not used from zig code
|
||||
pub fn panic(msg: *const RocStr, alignment: u32) callconv(.C) void {
|
||||
return @call(.{ .modifier = always_inline }, roc_panic, .{ msg, alignment });
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue