winpthreads: simplify the USE_VEH_FOR_MSC_SETTHREADNAME check
When compiling with other compilers than MSVC, we always use the code
relying on USE_VEH_FOR_MSC_SETTHREADNAME.
The __try/__except check code is not modified as it relies on internal MSVC
dialect. With MSVC either USE_VEH_FOR_MSC_SETTHREADNAME was set but that code
wasn't use anyway (unchanged) or it wasn't set and we use the code (unchanged).
Without MSVC we always define USE_VEH_FOR_MSC_SETTHREADNAME so the other
variant of the code is used (unchanged).
Signed-off-by: Liu Hao <lh_mouse@126.com>
diff --git a/mingw-w64-libraries/winpthreads/src/thread.c b/mingw-w64-libraries/winpthreads/src/thread.c
index 1b12edb..1040511 100644
--- a/mingw-w64-libraries/winpthreads/src/thread.c
+++ b/mingw-w64-libraries/winpthreads/src/thread.c
@@ -54,7 +54,11 @@
static size_t idListMax = 0;
static pthread_t idListNextId = 0;
-#if !defined(_MSC_VER) || defined (USE_VEH_FOR_MSC_SETTHREADNAME)
+#if !defined(_MSC_VER)
+#define USE_VEH_FOR_MSC_SETTHREADNAME
+#endif
+
+#if defined(USE_VEH_FOR_MSC_SETTHREADNAME)
static void *SetThreadName_VEH_handle = NULL;
static LONG __stdcall
@@ -419,7 +423,7 @@
if (dwReason == DLL_PROCESS_DETACH)
{
-#if !defined(_MSC_VER) || defined (USE_VEH_FOR_MSC_SETTHREADNAME)
+#if defined(USE_VEH_FOR_MSC_SETTHREADNAME)
if (lpreserved == NULL && SetThreadName_VEH_handle != NULL)
{
RemoveVectoredExceptionHandler (SetThreadName_VEH_handle);
@@ -430,7 +434,7 @@
}
else if (dwReason == DLL_PROCESS_ATTACH)
{
-#if !defined(_MSC_VER) || defined (USE_VEH_FOR_MSC_SETTHREADNAME)
+#if defined(USE_VEH_FOR_MSC_SETTHREADNAME)
SetThreadName_VEH_handle = AddVectoredExceptionHandler (1, &SetThreadName_VEH);
/* Can't do anything on error anyway, check for NULL later */
#endif