From 3f0eaf7c46037fc0f65b011e935e5a1a93ec51f9 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Mon, 27 Jun 2016 18:54:38 +0100 Subject: [PATCH 1/2] Fix clang thread_local support detection --- include/boost/math/tools/config.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index a39210d1c..b18d527bb 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -445,6 +445,15 @@ namespace boost{ namespace math{ // // Thread local storage: // +#ifdef __has_feature + +#if __has_feature(cxx_thread_local) +# define BOOST_MATH_THREAD_LOCAL thread_local +#else +# define BOOST_MATH_THREAD_LOCAL +#endif + +#else #if (__cplusplus >= 201103L) || (defined(_MSC_VER) && (_MSC_VER >= 1900)) # define BOOST_MATH_THREAD_LOCAL thread_local #elif defined(__GNUC__) @@ -456,7 +465,7 @@ namespace boost{ namespace math{ #endif #endif // BOOST_MATH_TOOLS_CONFIG_HPP - +#endif From 44a105aaf0b1b2441a4a2b703faabe7fd7b17ed2 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Mon, 27 Jun 2016 19:42:09 +0100 Subject: [PATCH 2/2] Tidy up clang/thread_local detection a little. --- include/boost/math/tools/config.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index b18d527bb..4ad379766 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -445,7 +445,7 @@ namespace boost{ namespace math{ // // Thread local storage: // -#ifdef __has_feature +#if defined(__has_feature) && defined(__clang__) #if __has_feature(cxx_thread_local) # define BOOST_MATH_THREAD_LOCAL thread_local @@ -464,9 +464,10 @@ namespace boost{ namespace math{ # define BOOST_MATH_THREAD_LOCAL #endif -#endif // BOOST_MATH_TOOLS_CONFIG_HPP #endif +#endif // BOOST_MATH_TOOLS_CONFIG_HPP +