summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-10-04 19:05:08 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-10-05 14:14:10 +0200
commitcd4b9241d28507f4227380abd4e0422469ccf070 (patch)
treed16c08132a6fc7257f8350ca6e1e86368e0d0de0
parent33ca910fa1661cf9ed3ae1752636111741ab2a79 (diff)
compat/assert: don't add stack frame on top
-rw-r--r--compat/assert.hpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/compat/assert.hpp b/compat/assert.hpp
index 24b16db8..c406009a 100644
--- a/compat/assert.hpp
+++ b/compat/assert.hpp
@@ -26,15 +26,10 @@
#define FM_KILL_PRINTF_WARN_2()
#endif
-namespace floormat {
-
-[[noreturn]] [[maybe_unused]] static inline void _fm_abort() {
- *(volatile int*)nullptr = 0;
- for (;;)
+#define fm_EMIT_ABORT() \
+ *(volatile int*)nullptr = 0; \
+ for (;;) \
;
-}
-
-} // namespace floormat
#define fm_EMIT_DEBUG2(pfx, ...) \
do { \
@@ -62,7 +57,7 @@ namespace floormat {
do { \
fm_EMIT_DEBUG2("fatal: ", __VA_ARGS__); \
fm_EMIT_DEBUG("", " in %s:%d", __FILE__, __LINE__); \
- ::floormat::_fm_abort(); \
+ fm_EMIT_ABORT(); \
} while (false)
#define fm_assert(...) \
@@ -70,7 +65,7 @@ namespace floormat {
if (!(__VA_ARGS__)) [[unlikely]] { \
fm_EMIT_DEBUG("", "assertion failed: %s in %s:%d", \
#__VA_ARGS__, __FILE__, __LINE__); \
- ::floormat::_fm_abort(); \
+ fm_EMIT_ABORT(); \
} \
} while(false)