0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

ircd::assert: Always inline the debugtrap.

This commit is contained in:
Jason Volk 2019-08-08 16:12:52 -07:00
parent 6181a4828d
commit ca99df8edb
2 changed files with 14 additions and 16 deletions

View file

@ -52,3 +52,17 @@ __assert(const char *__assertion,
int __line);
#endif
extern inline void
__attribute__((always_inline, gnu_inline, artificial))
ircd::debugtrap()
{
#if defined(__clang__)
static_assert(__has_builtin(__builtin_debugtrap));
__builtin_debugtrap();
#elif defined(__x86_64__)
__asm__ volatile ("int $3");
#else
__builtin_trap();
#endif
}

View file

@ -97,19 +97,3 @@ __assert_fail(const char *__assertion,
#pragma clang diagnostic pop
#endif __clang__
#endif
void
__attribute__((visibility("default")))
ircd::debugtrap()
{
#if defined(__clang__)
static_assert(__has_builtin(__builtin_debugtrap));
__builtin_debugtrap();
#elif defined(__x86_64__)
__asm__ volatile ("int $3");
#elif defined(HAVE_SIGNAL_H)
raise(SIGTRAP);
#else
__builtin_trap();
#endif
}