summaryrefslogtreecommitdiff
path: root/utils.hpp
diff options
context:
space:
mode:
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>