From 4f09bcb7dc48dc9b0d97ce3a9f73ffc6eee49045 Mon Sep 17 00:00:00 2001 From: omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Mon, 22 Jul 2024 00:19:58 +1000 Subject: error handling loading pbr textures --- src/log.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/log.h') diff --git a/src/log.h b/src/log.h index d954684..64d0d2e 100644 --- a/src/log.h +++ b/src/log.h @@ -53,4 +53,27 @@ void log_output(log_level level, const char* message, ...); #define TRACE(message, ...) log_output(LOG_LEVEL_TRACE, message, ##__VA_ARGS__) #else #define TRACE(message, ...) -#endif \ No newline at end of file +#endif + +// TODO: Move this to an asserts file + +void report_assertion_failure(const char *expression, const char *message, const char *file, + int line); + +#define CASSERT(expr) \ + { \ + if (expr) { \ + } else { \ + report_assertion_failure(#expr, "", __FILE__, __LINE__); \ + __builtin_trap(); \ + } \ + } + +#define CASSERT_MSG(expr, msg) \ + { \ + if (expr) { \ + } else { \ + report_assertion_failure(#expr, msg, __FILE__, __LINE__); \ + __builtin_trap(); \ + } \ + } \ No newline at end of file -- cgit v1.2.3-70-g09d2