summaryrefslogtreecommitdiff
path: root/src/log.h
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-07-22 00:19:58 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-07-22 00:19:58 +1000
commit4f09bcb7dc48dc9b0d97ce3a9f73ffc6eee49045 (patch)
treee94bb84660061941c12eb25455a1a855649416a7 /src/log.h
parentda1ddc29ac15e511086b8b5343b735a34be1fcea (diff)
error handling loading pbr textures
Diffstat (limited to 'src/log.h')
-rw-r--r--src/log.h25
1 files changed, 24 insertions, 1 deletions
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