Bug 1460645 - Avoid the thread_local keyword for MinGW and instead use __thread. r=froydnj, a=jcristau
authorTom Ritter <tom@mozilla.com>
Thu, 10 May 2018 11:11:19 -0500
changeset 802209 ccf77791ff9327b69643ece08e810f7162110180
parent 802208 8d568f13019209d727e5ef0f777fe7d7ed27964b
child 802210 ff177546a2af2fa31d2eb6e44369f5a8761f4c9d
push id111850
push userbmo:tom@mozilla.com
push dateThu, 31 May 2018 16:41:37 +0000
reviewersfroydnj, jcristau
bugs1460645
milestone60.0.2
Bug 1460645 - Avoid the thread_local keyword for MinGW and instead use __thread. r=froydnj, a=jcristau MozReview-Commit-ID: 5RPwQVatThs
mfbt/ThreadLocal.h
--- a/mfbt/ThreadLocal.h
+++ b/mfbt/ThreadLocal.h
@@ -232,17 +232,17 @@ ThreadLocal<T, Storage>::set(const T aVa
 {
   MOZ_ASSERT(Storage<T>::initialized());
   bool succeeded = Storage<T>::set(aValue);
   if (!succeeded) {
     MOZ_CRASH();
   }
 }
 
-#if defined(XP_WIN) || defined(MACOSX_HAS_THREAD_LOCAL)
+#if (defined(XP_WIN) || defined(MACOSX_HAS_THREAD_LOCAL)) && !defined(__MINGW32__)
 #define MOZ_THREAD_LOCAL(TYPE) thread_local mozilla::detail::ThreadLocal<TYPE, mozilla::detail::ThreadLocalNativeStorage>
 #elif defined(HAVE_THREAD_TLS_KEYWORD)
 #define MOZ_THREAD_LOCAL(TYPE) __thread mozilla::detail::ThreadLocal<TYPE, mozilla::detail::ThreadLocalNativeStorage>
 #else
 #define MOZ_THREAD_LOCAL(TYPE) mozilla::detail::ThreadLocal<TYPE, mozilla::detail::ThreadLocalKeyStorage>
 #endif
 
 } // namespace detail