aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Dusan <michael.dusan@gmail.com>2020-01-12 18:28:10 -0500
committerGitHub <noreply@github.com>2020-01-12 18:28:10 -0500
commitd08009556eea9cb6d5dea273340081e599d7741b (patch)
treeb763b38c6de4b97b6775b8df20ce76285d36425e /src
parentc96131f30caaf6d7cd1d202891a28ee0df8b577e (diff)
parent25b1ae0a5faf5e5632d9e9103840da6d9c5e80cb (diff)
downloadzig-d08009556eea9cb6d5dea273340081e599d7741b.tar.gz
zig-d08009556eea9cb6d5dea273340081e599d7741b.zip
Merge pull request #4161 from mikdusan/stage1-builtin-debugtrap
prefer C++ compiler builtins for BREAKPOINT
Diffstat (limited to 'src')
-rw-r--r--src/util.hpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/util.hpp b/src/util.hpp
index 61a17fc07e..8dcd41438e 100644
--- a/src/util.hpp
+++ b/src/util.hpp
@@ -30,8 +30,6 @@
#else
-#include <signal.h>
-
#define ATTRIBUTE_COLD __attribute__((cold))
#define ATTRIBUTE_PRINTF(a, b) __attribute__((format(printf, a, b)))
#define ATTRIBUTE_RETURNS_NOALIAS __attribute__((__malloc__))
@@ -40,7 +38,12 @@
#if defined(__MINGW32__) || defined(__MINGW64__)
#define BREAKPOINT __debugbreak()
+#elif defined(__clang__)
+#define BREAKPOINT __builtin_debugtrap()
+#elif defined(__GNUC__)
+#define BREAKPOINT __builtin_trap()
#else
+#include <signal.h>
#define BREAKPOINT raise(SIGTRAP)
#endif