stage1 assertions always on, and have stack traces
This commit is contained in:
10
src/util.cpp
10
src/util.cpp
@@ -10,17 +10,25 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "util.hpp"
|
||||
#include "userland.h"
|
||||
|
||||
void zig_panic(const char *format, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
vfprintf(stderr, format, ap);
|
||||
fprintf(stderr, "\n");
|
||||
fflush(stderr);
|
||||
va_end(ap);
|
||||
stage2_panic(nullptr, 0);
|
||||
abort();
|
||||
}
|
||||
|
||||
void assert(bool ok) {
|
||||
if (!ok) {
|
||||
const char *msg = "Assertion failed. This is a bug in the Zig compiler.";
|
||||
stage2_panic(msg, strlen(msg));
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t int_hash(int i) {
|
||||
return (uint32_t)(i % UINT32_MAX);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user