2023-05-17 20:42:59 -07:00
|
|
|
#pragma once
|
|
|
|
|
2023-11-05 09:24:09 -08:00
|
|
|
#include <glacier/string/str_format.h>
|
2023-05-18 01:16:53 -07:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2023-06-17 01:45:53 -07:00
|
|
|
#include "include/ztypes.h"
|
2023-06-07 08:50:08 -07:00
|
|
|
|
2023-11-05 08:48:41 -08:00
|
|
|
// Debug line without formatting for
|
|
|
|
// before allocations are available.
|
|
|
|
void early_dbgln(const char* str);
|
|
|
|
|
2023-11-05 09:24:09 -08:00
|
|
|
void dbgln(const glcr::StringView& str);
|
|
|
|
|
|
|
|
template <typename... Args>
|
|
|
|
void dbgln(const char* str, Args... args) {
|
|
|
|
dbgln(glcr::StrFormat(str, args...));
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename... Args>
|
|
|
|
void panic(const char* str, Args... args) {
|
|
|
|
dbgln(glcr::StrFormat(str, args...));
|
|
|
|
dbgln("PANIC");
|
|
|
|
}
|
2023-06-07 08:50:08 -07:00
|
|
|
|
|
|
|
#define UNREACHABLE \
|
2023-11-05 09:24:09 -08:00
|
|
|
panic("Unreachable {}, {}", __FILE__, __LINE__); \
|
2023-06-07 08:50:08 -07:00
|
|
|
__builtin_unreachable();
|