authorgravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2020-01-12 18:28:10-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-01-12 18:28:10-05:00
logd08009556eea9cb6d5dea273340081e599d7741b
treeb763b38c6de4b97b6775b8df20ce76285d36425e
parentc96131f30caaf6d7cd1d202891a28ee0df8b577e
parent25b1ae0a5faf5e5632d9e9103840da6d9c5e80cb
signature Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #4161 from mikdusan/stage1-builtin-debugtrap

prefer C++ compiler builtins for BREAKPOINT

1 files changed, 5 insertions(+), 2 deletions(-)

src/util.hpp+5-2
...@@ -30,8 +30,6 @@...@@ -30,8 +30,6 @@
3030
31#else31#else
3232
33#include <signal.h>
34
35#define ATTRIBUTE_COLD __attribute__((cold))33#define ATTRIBUTE_COLD __attribute__((cold))
36#define ATTRIBUTE_PRINTF(a, b) __attribute__((format(printf, a, b)))34#define ATTRIBUTE_PRINTF(a, b) __attribute__((format(printf, a, b)))
37#define ATTRIBUTE_RETURNS_NOALIAS __attribute__((__malloc__))35#define ATTRIBUTE_RETURNS_NOALIAS __attribute__((__malloc__))
...@@ -40,7 +38,12 @@...@@ -40,7 +38,12 @@
4038
41#if defined(__MINGW32__) || defined(__MINGW64__)39#if defined(__MINGW32__) || defined(__MINGW64__)
42#define BREAKPOINT __debugbreak()40#define BREAKPOINT __debugbreak()
41#elif defined(__clang__)
42#define BREAKPOINT __builtin_debugtrap()
43#elif defined(__GNUC__)
44#define BREAKPOINT __builtin_trap()
43#else45#else
46#include <signal.h>
44#define BREAKPOINT raise(SIGTRAP)47#define BREAKPOINT raise(SIGTRAP)
45#endif48#endif
4649