diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-07-22 00:19:58 +1000 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-07-22 00:19:58 +1000 |
commit | 4f09bcb7dc48dc9b0d97ce3a9f73ffc6eee49045 (patch) | |
tree | e94bb84660061941c12eb25455a1a855649416a7 /src/log.h | |
parent | da1ddc29ac15e511086b8b5343b735a34be1fcea (diff) |
error handling loading pbr textures
Diffstat (limited to 'src/log.h')
-rw-r--r-- | src/log.h | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -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 |