diff options
-rw-r--r-- | compat/assert.hpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/compat/assert.hpp b/compat/assert.hpp index 1f0678a1..8c882b0e 100644 --- a/compat/assert.hpp +++ b/compat/assert.hpp @@ -70,6 +70,23 @@ void fm_emit_debug_loc0(const char* file, int line, fm_FORMAT_ARG_MSVC const cha } \ })(__VA_ARGS__) +#define fm_assert_not_equal(...) \ + ([](auto a, auto b) -> void \ + { \ + if (a == b) [[unlikely]] \ + { \ + ERR_nospace << Debug::color(Debug::Color::Magenta) \ + << "fatal:" \ + << Debug::resetColor << " " \ + << "Inequality assertion failed at " \ + << __FILE__ << ":" << __LINE__; \ + ERR_nospace << #__VA_ARGS__; \ + ERR_nospace << "not expected: " << a; \ + ERR_nospace << " actual: " << b; \ + fm_emit_abort(); \ + } \ + })(__VA_ARGS__) + #ifdef __GNUG__ # pragma GCC diagnostic pop #endif |