aboutsummaryrefslogtreecommitdiff
path: root/std/special/panic.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-03-26 06:39:28 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-03-26 06:39:28 -0400
commit5bc9feb5cb98fc13db62d01b2b9fec15677310a7 (patch)
tree12972dfc1f9b964bb74428ec0d6766e77b9b0be7 /std/special/panic.zig
parent7ce753a16b0c16b4c6494467f42f2d5fe9a235e6 (diff)
downloadzig-5bc9feb5cb98fc13db62d01b2b9fec15677310a7.tar.gz
zig-5bc9feb5cb98fc13db62d01b2b9fec15677310a7.zip
organize std and make import relative to current file
closes #216
Diffstat (limited to 'std/special/panic.zig')
-rw-r--r--std/special/panic.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/std/special/panic.zig b/std/special/panic.zig
new file mode 100644
index 0000000000..9b58a4d9c8
--- /dev/null
+++ b/std/special/panic.zig
@@ -0,0 +1,12 @@
+// This file is included if and only if the user's main source file does not
+// include a public panic function.
+// If this file wants to import other files *by name*, support for that would
+// have to be added in the compiler.
+
+pub coldcc fn panic(message: []const u8) -> noreturn {
+ if (@compileVar("os") == Os.freestanding) {
+ while (true) {}
+ } else {
+ @import("std").debug.panic(message);
+ }
+}