From 4c273126dfc44cf4fcf9d5d97bf1cb1da07d7bd7 Mon Sep 17 00:00:00 2001 From: Marc Tiehuis Date: Sun, 3 Jun 2018 18:30:43 +1200 Subject: [PATCH] Add context to zig_unreachable calls (#1039) This greatly aids debugging on platforms with no stack-traces. --- src/util.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util.hpp b/src/util.hpp index ae33cb84af..25141d8435 100644 --- 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) {