[libcxx-commits] [libcxx] [libc++][NFC] Clean up atomic_support.h (PR #212464)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 28 04:16:21 PDT 2026


https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/212464

We don't support any compilers which don't have the atomic builtins, so we don't need to check whether they exist.


>From 347b6201345554173c43f8448c0d0efcdf9bc4ad Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Tue, 28 Jul 2026 13:15:32 +0200
Subject: [PATCH] [libc++][NFC] Clean up atomic_support.h

---
 libcxx/src/include/atomic_support.h | 24 +-----------------------
 1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/libcxx/src/include/atomic_support.h b/libcxx/src/include/atomic_support.h
index 410f64b267111..305a53e2ee2e0 100644
--- a/libcxx/src/include/atomic_support.h
+++ b/libcxx/src/include/atomic_support.h
@@ -10,30 +10,10 @@
 #define ATOMIC_SUPPORT_H
 
 #include <__config>
-#include <memory> // for __libcpp_relaxed_load
-
-#if defined(__clang__) && __has_builtin(__atomic_load_n) && __has_builtin(__atomic_store_n) &&                         \
-    __has_builtin(__atomic_add_fetch) && __has_builtin(__atomic_exchange_n) &&                                         \
-    __has_builtin(__atomic_compare_exchange_n) && defined(__ATOMIC_RELAXED) && defined(__ATOMIC_CONSUME) &&            \
-    defined(__ATOMIC_ACQUIRE) && defined(__ATOMIC_RELEASE) && defined(__ATOMIC_ACQ_REL) && defined(__ATOMIC_SEQ_CST)
-#  define _LIBCPP_HAS_ATOMIC_BUILTINS
-#elif defined(_LIBCPP_COMPILER_GCC)
-#  define _LIBCPP_HAS_ATOMIC_BUILTINS
-#endif
-
-#if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && _LIBCPP_HAS_THREADS
-#  if defined(_LIBCPP_WARNING)
-_LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported")
-#  else
-#    warning Building libc++ without __atomic builtins is unsupported
-#  endif
-#endif
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-namespace {
-
-#if defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && _LIBCPP_HAS_THREADS
+#if _LIBCPP_HAS_THREADS
 
 enum __libcpp_atomic_order {
   _AO_Relaxed = __ATOMIC_RELAXED,
@@ -125,8 +105,6 @@ __libcpp_atomic_compare_exchange(_ValueType* __val, _ValueType* __expected, _Val
 
 #endif // _LIBCPP_HAS_THREADS
 
-} // namespace
-
 _LIBCPP_END_NAMESPACE_STD
 
 #endif // ATOMIC_SUPPORT_H



More information about the libcxx-commits mailing list