diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-09-30 18:58:41 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-09-30 20:21:57 -0400 |
| commit | c6295fe9abf5508d522ab4000b577a6f30a98a88 (patch) | |
| tree | de5ff247f235fbf8f9cfe6f8ad2267c897c4d022 /std/special/panic.zig | |
| parent | 6db589fff5be05e3e782a34443a1133ebc6ef17d (diff) | |
| download | zig-c6295fe9abf5508d522ab4000b577a6f30a98a88.tar.gz zig-c6295fe9abf5508d522ab4000b577a6f30a98a88.zip | |
remove zigrt
adds test case for #394
partially reverts a32b5929ccf8cbf79396d8924097a1a911985dac
Diffstat (limited to 'std/special/panic.zig')
| -rw-r--r-- | std/special/panic.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/std/special/panic.zig b/std/special/panic.zig new file mode 100644 index 0000000000..78117a5366 --- /dev/null +++ b/std/special/panic.zig @@ -0,0 +1,14 @@ +// This file is the default panic handler if the root source file does not +// have a `pub fn panic`. +// If this file wants to import other files *by name*, support for that would +// have to be added in the compiler. + +const builtin = @import("builtin"); + +pub coldcc fn panic(msg: []const u8) -> noreturn { + if (builtin.os == builtin.Os.freestanding) { + while (true) {} + } else { + @import("std").debug.panic("{}", msg); + } +} |
