summaryrefslogtreecommitdiff
path: root/utils.hpp
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2022-09-03 17:33:07 +0300
committerOxore <oxore@protonmail.com>2022-09-03 17:33:07 +0300
commitd2b615061e008c4d13a6ce0f11efd8ec337f41c6 (patch)
tree0aab1cc72db576761524267ea3594a21db14b829 /utils.hpp
parent9037b017d6519fed435eea20c3553d40d871d379 (diff)
Impl breakpoints (pretty much draft)
Breakpoints work somehow, but overstep 1 instruction. Needs to be fixed.
Diffstat (limited to 'utils.hpp')
-rw-r--r--utils.hpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/utils.hpp b/utils.hpp
index 4a83a8d..0c49739 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -3,13 +3,19 @@
#pragma once
+#if defined(NDEBUG)
#ifdef __clang__
-# define UNREACHABLE __builtin_unreachable
+# define UNREACHABLE (__builtin_unreachable())
#elif __GNUC__
-# define UNREACHABLE __builtin_unreachable
+# define UNREACHABLE (__builtin_unreachable())
#else
# define UNREACHABLE
#endif
+#else
+#include <cassert>
+#define UNREACHABLE (assert((void*)0 == "Unreachable code reached"), abort(), 1)
+#endif
+
#include <stdint.h>