[libcxx-commits] [libcxxabi] [libc++abi] Use __has_feature check to enable usage of thread_local for exception storage (PR #97591)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 3 08:34:03 PDT 2024


https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/97591

Previously, we'd use HAS_THREAD_LOCAL which was never defined. Hence, we'd basically never use the code path where we use thread_local.

Fixes #78207

>From 36ab3ebf5d4d4e966b8866ffa75ccaaa5449f654 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Wed, 3 Jul 2024 11:32:41 -0400
Subject: [PATCH] [libc++abi] Use __has_feature check to enable usage of
 thread_local for exception storage

Previously, we'd use HAS_THREAD_LOCAL which was never defined. Hence,
we'd basically never use the code path where we use thread_local.

Fixes #78207
---
 libcxxabi/src/cxa_exception_storage.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxxabi/src/cxa_exception_storage.cpp b/libcxxabi/src/cxa_exception_storage.cpp
index 2479f550e09ef..c842da195accb 100644
--- a/libcxxabi/src/cxa_exception_storage.cpp
+++ b/libcxxabi/src/cxa_exception_storage.cpp
@@ -24,7 +24,7 @@ extern "C" {
 } // extern "C"
 } // namespace __cxxabiv1
 
-#elif defined(HAS_THREAD_LOCAL)
+#elif __has_feature(cxx_thread_local)
 
 namespace __cxxabiv1 {
 namespace {



More information about the libcxx-commits mailing list