diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-25 08:44:11 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-25 08:45:16 +0200 |
commit | 9a68f55a2ff3caf8cbc2004bc4ea6e3f276c6b4c (patch) | |
tree | 8a4a547348b365293131882f4df1f3ce73f7be46 | |
parent | d06dcbaba14ab511eedf30ae39418989f0139499 (diff) |
a
-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 |