summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-11-27 20:28:40 -0600
committerNathan Ringo <nathan@remexre.com>2024-11-27 20:28:40 -0600
commitb252d0de46cf12b8e2521b3eb42da9acc41a4cc1 (patch)
tree456bfed5547745edacebe8c89194c26f03a25908 /src/util.c
parent62e41dcb40d0450d493a804e7f0ac3e32f35aabf (diff)
new simpler GC
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index 14a213a..b512296 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1,11 +1,13 @@
#include "util.h"
+#include "gc.h"
#include "platform.h"
#include <stdarg.h>
#include <stdio.h>
noreturn void assume__failed(const char *file, int line, const char *expr) {
panic_begin();
- fprintf(stderr, "%s:%d: assertion failed: %s\n", file, line, expr);
+ fprintf(stderr, "%s:%d: assertion failed: %s\n\n", file, line, expr);
+ gc_debug();
panic_end();
}
@@ -16,5 +18,20 @@ noreturn void todo__impl(const char *file, int line, const char *fmt, ...) {
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
+ printf("\n");
+ gc_debug();
+ panic_end();
+}
+
+noreturn void unreachable__impl(const char *file, int line, const char *fmt,
+ ...) {
+ panic_begin();
+ printf("%s:%d: unreachable code entered: ", file, line);
+ va_list ap;
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+ va_end(ap);
+ printf("\n");
+ gc_debug();
panic_end();
}