#pragma once #include // For convenience, bring in soft assertions with assert(). #include // Allow the client to define their own LOGE() macro. #ifndef LOGE #include #define LOGE(format, ...) \ { \ fprintf( \ stderr, "[ASSERT] %s:%d " format "\n", __FILE__, \ __LINE__ __VA_OPT__(, ) __VA_ARGS__); \ } #endif // LOGE #define TRAP() raise(SIGTRAP) /// Unconditional hard assert. #define FAIL(format, ...) \ LOGE(format, __VA_ARGS__); \ TRAP(); //// Conditional hard assert. #define ASSERT(condition) \ if (!(condition)) { \ LOGE("Assertion failed: " #condition) \ TRAP(); \ }