Skip to content

Commit

Permalink
Add context to zig_unreachable calls (#1039)
Browse files Browse the repository at this point in the history
This greatly aids debugging on platforms with no stack-traces.
  • Loading branch information
tiehuis authored and andrewrk committed Jun 3, 2018
1 parent b85b68a commit 4c27312
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/util.hpp
Expand Up @@ -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) {
Expand Down

0 comments on commit 4c27312

Please sign in to comment.