[llvm-branch-commits] [libcxxabi] [release/18.x][backport][libc++abi] Use __has_feature check to enable usage of thread_local for exception storage (PR #132241)

Bushev Dmitry via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Mar 20 08:45:42 PDT 2025


https://github.com/dybv-sc created https://github.com/llvm/llvm-project/pull/132241

This is a backport of original commit #97591 to 18.x release.

>From 881b155a6a432cd8caf96076ed8d53bd6ac029fb Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Mon, 8 Jul 2024 15:20:21 -0500
Subject: [PATCH] [libc++abi] Use __has_feature check to enable usage of
 thread_local for exception storage (#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
---
 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 3a3233a1b9272..83408c904e1f7 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 llvm-branch-commits mailing list