Merge pull request #369 from adierking/crtassert
Report crash messages on Windows to the CRT
diff --git a/src/internal.h b/src/internal.h
index d9a7f0a..1eb069c 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -293,6 +293,7 @@
#endif
#if defined(_WIN32)
#include <io.h>
+#include <crtdbg.h>
#endif
#if defined(__GNUC__) || defined(__clang__)
@@ -876,9 +877,19 @@
#define _dispatch_hardware_crash() \
__asm__(""); __builtin_trap() // <rdar://problem/17464981>
+#ifdef _WIN32
+#define _dispatch_set_crash_log_cause_and_message(ac, msg) do { \
+ (void)(ac); \
+ _dispatch_set_crash_log_message_dynamic((msg)); \
+ } while (0)
+#define _dispatch_set_crash_log_message(msg) \
+ _dispatch_set_crash_log_message_dynamic((msg))
+#define _dispatch_set_crash_log_message_dynamic(msg) _RPTF0(_CRT_ASSERT, (msg))
+#else
#define _dispatch_set_crash_log_cause_and_message(ac, msg) ((void)(ac))
#define _dispatch_set_crash_log_message(msg)
#define _dispatch_set_crash_log_message_dynamic(msg)
+#endif
#if HAVE_MACH
// MIG_REPLY_MISMATCH means either: