diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-12-04 13:36:23 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-12-04 13:36:23 +0100 |
commit | 511102c4220aba8166f9ac8117aa1b8fba99b204 (patch) | |
tree | 66de3b87bbd759f51afbbcc5b2ffea27b938ee9d | |
parent | f38e0159c7047c08fdea92a4a91b8037a4770a10 (diff) |
compat/assert: add [[unlikely]] to fm_assert
-rw-r--r-- | compat/assert.hpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/compat/assert.hpp b/compat/assert.hpp index 0afd0772..24b16db8 100644 --- a/compat/assert.hpp +++ b/compat/assert.hpp @@ -67,7 +67,7 @@ namespace floormat { #define fm_assert(...) \ do { \ - if (!(__VA_ARGS__)) { \ + if (!(__VA_ARGS__)) [[unlikely]] { \ fm_EMIT_DEBUG("", "assertion failed: %s in %s:%d", \ #__VA_ARGS__, __FILE__, __LINE__); \ ::floormat::_fm_abort(); \ @@ -80,13 +80,6 @@ namespace floormat { #define fm_debug_assert(...) void() #endif -#define ASSERT_EXPR(var, expr, cond) \ - ([&] { \ - decltype(auto) var = (expr); \ - fm_assert(cond); \ - return (var); \ - })() - #define fm_warn(...) fm_EMIT_DEBUG("warning: ", __VA_ARGS__) #define fm_error(...) fm_EMIT_DEBUG("error: ", __VA_ARGS__) #define fm_log(...) fm_EMIT_DEBUG("", __VA_ARGS__) @@ -94,7 +87,7 @@ namespace floormat { #define fm_warn_once(...) do { \ static bool _fm_once_flag = false; \ - if (!_fm_once_flag) { \ + if (!_fm_once_flag) [[unlikely]] { \ _fm_once_flag = true; \ fm_warn(__VA_ARGS__); \ } \ |