From 16f17fb9deeb3de5ea127bfececd22603df4ceec Mon Sep 17 00:00:00 2001 From: Martchus Date: Thu, 26 Jan 2023 22:20:06 +0100 Subject: [PATCH] Make feature detection for thead local work with MSVC --- conversion/stringconversion.cpp | 4 +++- feature_detection/features.h | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/conversion/stringconversion.cpp b/conversion/stringconversion.cpp index 786da85..d72078d 100644 --- a/conversion/stringconversion.cpp +++ b/conversion/stringconversion.cpp @@ -2,7 +2,9 @@ #ifndef CPP_UTILITIES_NO_THREAD_LOCAL #include "../feature_detection/features.h" -#else +#endif + +#ifndef CPP_UTILITIES_THREAD_LOCAL #define CPP_UTILITIES_THREAD_LOCAL #endif diff --git a/feature_detection/features.h b/feature_detection/features.h index b0ecd54..0295c46 100644 --- a/feature_detection/features.h +++ b/feature_detection/features.h @@ -226,9 +226,6 @@ # else # define CPP_UTILITIES_COMPILER_CXX_THREAD_LOCAL 0 # endif - -# else -# error Unsupported compiler # endif # if defined(CPP_UTILITIES_COMPILER_CXX_THREAD_LOCAL) && CPP_UTILITIES_COMPILER_CXX_THREAD_LOCAL @@ -236,7 +233,7 @@ # elif CPP_UTILITIES_COMPILER_IS_GNU || CPP_UTILITIES_COMPILER_IS_Clang || CPP_UTILITIES_COMPILER_IS_AppleClang # define CPP_UTILITIES_THREAD_LOCAL __thread # elif CPP_UTILITIES_COMPILER_IS_MSVC -# define CPP_UTILITIES_THREAD_LOCAL __declspec(thread) +# define CPP_UTILITIES_THREAD_LOCAL __declspec(thread) static # else // CPP_UTILITIES_THREAD_LOCAL not defined for this configuration. # endif