Converted log_failure and fatal to macros (fixes GEN_PANIC not determining correct line or file)

This commit is contained in:
2023-08-08 09:48:50 -04:00
parent ed3246c6b0
commit d2fc1d0a56
5 changed files with 35 additions and 34 deletions

View File

@ -33,5 +33,27 @@ void assert_handler( char const* condition, char const* file, s32 line, char con
s32 assert_crash( char const* condition );
void process_exit( u32 code );
#if Build_Debug
#define fatal( fmt, ... ) \
do \
{ \
local_persist thread_local \
char buf[GEN_PRINTF_MAXLEN] = { 0 }; \
\
str_fmt(buf, GEN_PRINTF_MAXLEN, fmt, __VA_ARGS__); \
GEN_PANIC(buf); \
} \
while (0)
#else
# define fatal( fmt, ... ) \
do \
{ \
str_fmt_out_err_va( fmt, __VA_ARGS__ ); \
process_exit(1); \
} \
while (0)
#endif
#pragma endregion Debug