mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 15:04:10 +01:00
ircd: Move lfence to __assert_fail(); simplify macro.
This commit is contained in:
parent
84b5bf536c
commit
9e085c49c5
2 changed files with 10 additions and 17 deletions
|
@ -58,12 +58,16 @@ __assert_fail(const char *__assertion,
|
|||
extern "C" // for clang
|
||||
{
|
||||
extern inline void
|
||||
__attribute__((flatten, always_inline, gnu_inline, artificial))
|
||||
__attribute__((cold, flatten, always_inline, gnu_inline, artificial))
|
||||
__assert_fail(const char *__assertion,
|
||||
const char *__file,
|
||||
unsigned int __line,
|
||||
const char *__function)
|
||||
{
|
||||
#if defined(__SSE2__) && defined(__clang__)
|
||||
asm volatile ("lfence");
|
||||
#endif
|
||||
|
||||
ircd::print_assertion(__assertion, __file, __line, __function);
|
||||
ircd::debugtrap();
|
||||
}
|
||||
|
|
|
@ -67,22 +67,11 @@ namespace ircd
|
|||
|
||||
#if defined(RB_ASSERT) && defined(RB_ASSERT_INTRINSIC) && !defined(NDEBUG) && defined(__SSE2__)
|
||||
#undef assert
|
||||
#ifdef __clang__
|
||||
#define assert(expr) \
|
||||
({ \
|
||||
if(unlikely(!static_cast<bool>(expr))) \
|
||||
{ \
|
||||
asm volatile ("lfence"); \
|
||||
__assert_fail(#expr, __FILE__, __LINE__, __FUNCTION__); \
|
||||
} \
|
||||
})
|
||||
#else
|
||||
#define assert(expr) \
|
||||
({ \
|
||||
if(unlikely(!static_cast<bool>(expr))) \
|
||||
__assert_fail(#expr, __FILE__, __LINE__, __FUNCTION__); \
|
||||
})
|
||||
#endif
|
||||
#define assert(expr) \
|
||||
({ \
|
||||
if(unlikely(!static_cast<bool>(expr))) \
|
||||
__assert_fail(#expr, __FILE__, __LINE__, __FUNCTION__); \
|
||||
})
|
||||
#endif
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue