windows: fix mingw32/debug build

Debug build failed on mingw32 because CRT assertion disable code was stubbed out.
Replace __declspec(thread) with UV_THREAD_LOCAL which is defined as __thread on GCC.
This commit is contained in:
Caleb James DeLisle 2014-06-18 07:33:32 +02:00 committed by Saúl Ibarra Corretgé
parent d3c30aa276
commit fe8322d27c
2 changed files with 6 additions and 5 deletions

View File

@ -26,9 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if !defined(__MINGW32__)
#include <crtdbg.h>
#endif
#include "uv.h"
#include "internal.h"
@ -44,11 +42,11 @@ static uv_once_t uv_init_guard_ = UV_ONCE_INIT;
static uv_once_t uv_default_loop_init_guard_ = UV_ONCE_INIT;
#if defined(_DEBUG) && !defined(__MINGW32__)
#if defined(_DEBUG)
/* Our crt debug report handler allows us to temporarily disable asserts */
/* just for the current thread. */
__declspec( thread ) int uv__crt_assert_enabled = TRUE;
UV_THREAD_LOCAL int uv__crt_assert_enabled = TRUE;
static int uv__crt_dbg_report_handler(int report_type, char *message, int *ret_val) {
if (uv__crt_assert_enabled || report_type != _CRT_ASSERT)

View File

@ -31,13 +31,16 @@
#ifdef _MSC_VER
# define INLINE __inline
# define UV_THREAD_LOCAL __declspec( thread )
#else
# define INLINE inline
# define UV_THREAD_LOCAL __thread
#endif
#ifdef _DEBUG
extern __declspec( thread ) int uv__crt_assert_enabled;
extern UV_THREAD_LOCAL int uv__crt_assert_enabled;
#define UV_BEGIN_DISABLE_CRT_ASSERT() \
{ \