diff options
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 |