commit 4c273126dfc44cf4fcf9d5d97bf1cb1da07d7bd7 (tree)
parent b85b68a7fd175169e0f07ab733bde6d5654b1044
Author: Marc Tiehuis <marctiehuis@gmail.com>
Date: Sun, 3 Jun 2018 18:30:43 +1200
Add context to zig_unreachable calls (#1039)
This greatly aids debugging on platforms with no stack-traces.
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/util.hpp b/src/util.hpp
@@ -38,11 +38,11 @@ ATTRIBUTE_NORETURN
ATTRIBUTE_PRINTF(1, 2)
void zig_panic(const char *format, ...);
-ATTRIBUTE_COLD
-ATTRIBUTE_NORETURN
-static inline void zig_unreachable(void) {
- zig_panic("unreachable");
-}
+#ifdef WIN32
+#define __func__ __FUNCTION__
+#endif
+
+#define zig_unreachable() zig_panic("unreachable: %s:%s:%d", __FILE__, __func__, __LINE__)
#if defined(_MSC_VER)
static inline int clzll(unsigned long long mask) {