Skip to content

Commit 4c27312

Browse files
tiehuisandrewrk
authored andcommittedJun 3, 2018
Add context to zig_unreachable calls (#1039)
This greatly aids debugging on platforms with no stack-traces.
·
0.15.10.3.0
1 parent b85b68a commit 4c27312

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎src/util.hpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ ATTRIBUTE_NORETURN
3838
ATTRIBUTE_PRINTF(1, 2)
3939
void zig_panic(const char *format, ...);
4040

41-
ATTRIBUTE_COLD
42-
ATTRIBUTE_NORETURN
43-
static inline void zig_unreachable(void) {
44-
zig_panic("unreachable");
45-
}
41+
#ifdef WIN32
42+
#define __func__ __FUNCTION__
43+
#endif
44+
45+
#define zig_unreachable() zig_panic("unreachable: %s:%s:%d", __FILE__, __func__, __LINE__)
4646

4747
#if defined(_MSC_VER)
4848
static inline int clzll(unsigned long long mask) {

0 commit comments

Comments
 (0)
Please sign in to comment.