aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid John <davidatgit@gmail.com>2021-12-10 11:47:38 +0530
committerVeikka Tuominen <git@vexu.eu>2022-01-27 19:42:40 +0200
commit80ac022c4667e1995ccdf70fff90e5af26b6eb97 (patch)
tree6ac43e59c2ff304c8d3ae646f3bab5150a49cb71 /lib
parentdb1edb6535383817c6f597f55a35fc892d1c22c5 (diff)
downloadzig-80ac022c4667e1995ccdf70fff90e5af26b6eb97.tar.gz
zig-80ac022c4667e1995ccdf70fff90e5af26b6eb97.zip
add std.debug.todo
Diffstat (limited to 'lib')
-rw-r--r--lib/std/debug.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index 517176c900..b25dabbc06 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -66,6 +66,15 @@ pub fn print(comptime fmt: []const u8, args: anytype) void {
nosuspend stderr.print(fmt, args) catch return;
}
+/// Indicates code that is unfinshed. It will throw a compiler error by default in Release mode.
+/// This behaviour can be controlled with `root.allow_todo_in_release`.
+pub fn todo(comptime desc: []const u8) noreturn {
+ if (builtin.mode != .Debug and !(@hasDecl(root, "allow_todo_in_release") and root.allow_todo_in_release)) {
+ @compileError("TODO: " ++ desc);
+ }
+ @panic("TODO: " ++ desc);
+}
+
pub fn getStderrMutex() *std.Thread.Mutex {
return &stderr_mutex;
}