scudo: Remove the THREADLOCAL macro. am: 0d4ff652fe am: 2be54abae4 am: ef839b5545 am: 688e783a73
Original change: https://android-review.googlesource.com/c/platform/external/scudo/+/1425485
Change-Id: I1ef7d5353606951c96a00c6aa7c00b31319dbeee
diff --git a/standalone/internal_defs.h b/standalone/internal_defs.h
index a884f1f..0babbbe 100644
--- a/standalone/internal_defs.h
+++ b/standalone/internal_defs.h
@@ -36,7 +36,6 @@
#define FORMAT(F, A) __attribute__((format(printf, F, A)))
#define NOINLINE __attribute__((noinline))
#define NORETURN __attribute__((noreturn))
-#define THREADLOCAL __thread
#define LIKELY(X) __builtin_expect(!!(X), 1)
#define UNLIKELY(X) __builtin_expect(!!(X), 0)
#if defined(__i386__) || defined(__x86_64__)
diff --git a/standalone/tests/primary_test.cpp b/standalone/tests/primary_test.cpp
index a7a2b31..605ce44 100644
--- a/standalone/tests/primary_test.cpp
+++ b/standalone/tests/primary_test.cpp
@@ -152,7 +152,7 @@
static bool Ready;
template <typename Primary> static void performAllocations(Primary *Allocator) {
- static THREADLOCAL typename Primary::CacheT Cache;
+ static thread_local typename Primary::CacheT Cache;
Cache.init(nullptr, Allocator);
std::vector<std::pair<scudo::uptr, void *>> V;
{
diff --git a/standalone/tsd_exclusive.h b/standalone/tsd_exclusive.h
index ac5a22c..9437167 100644
--- a/standalone/tsd_exclusive.h
+++ b/standalone/tsd_exclusive.h
@@ -99,16 +99,16 @@
atomic_u8 Disabled;
TSD<Allocator> FallbackTSD;
HybridMutex Mutex;
- static THREADLOCAL ThreadState State;
- static THREADLOCAL TSD<Allocator> ThreadTSD;
+ static thread_local ThreadState State;
+ static thread_local TSD<Allocator> ThreadTSD;
friend void teardownThread<Allocator>(void *Ptr);
};
template <class Allocator>
-THREADLOCAL TSD<Allocator> TSDRegistryExT<Allocator>::ThreadTSD;
+thread_local TSD<Allocator> TSDRegistryExT<Allocator>::ThreadTSD;
template <class Allocator>
-THREADLOCAL ThreadState TSDRegistryExT<Allocator>::State;
+thread_local ThreadState TSDRegistryExT<Allocator>::State;
template <class Allocator> void teardownThread(void *Ptr) {
typedef TSDRegistryExT<Allocator> TSDRegistryT;