Debug: Provide UserError, FatalError fmt macros

This commit is contained in:
Jonathan G Rennison
2024-01-05 14:47:30 +00:00
parent 8832ab8e5d
commit 1b7a5372ec
2 changed files with 39 additions and 16 deletions

View File

@@ -21,4 +21,10 @@
*/
#define Debug(name, level, format_string, ...) if ((level) == 0 || _debug_ ## name ## _level >= (level)) debug_print(#name, fmt::format(FMT_STRING(format_string), ## __VA_ARGS__).c_str())
void NORETURN usererror_str(const char *msg);
void NORETURN fatalerror_str(const char *msg);
#define UserError(format_string, ...) usererror_str(fmt::format(FMT_STRING(format_string), ## __VA_ARGS__).c_str())
#define FatalError(format_string, ...) fatalerror_str(fmt::format(FMT_STRING(format_string), ## __VA_ARGS__).c_str())
#endif /* DEBUG_FMT_H */