diff options
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -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(); } |