[libcxx-commits] [libcxx] [libc++] "Always" include_next for non C++ path in stdatomic.h (PR #178463)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 28 08:42:04 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Walter Lee (googlewalt)

<details>
<summary>Changes</summary>

In https://github.com/llvm/llvm-project/pull/176903, `#include <__configuration/compiler.h>` is moved into the 
`#ifdef _cplusplus` clause, so `_LIBCPP_COMPILER_CLANG_BASED` is no longer set for C compiles.  This causes a regression internally, where when C compiles includes stdatomic.h, they no longer get the corresponding C header.

C++ stdlib headers "shouldn't" be on the search patch for C compile, but we do and so do lots of other people, so libc++ tends to support that.  This include_next for a C compile should be unconditional, not conditional upon being Clang.

---
Full diff: https://github.com/llvm/llvm-project/pull/178463.diff


2 Files Affected:

- (modified) libcxx/include/__cxx03/stdatomic.h (+1-1) 
- (modified) libcxx/include/stdatomic.h (+1-1) 


``````````diff
diff --git a/libcxx/include/__cxx03/stdatomic.h b/libcxx/include/__cxx03/stdatomic.h
index 78bb745303c1a..30378e5abef8a 100644
--- a/libcxx/include/__cxx03/stdatomic.h
+++ b/libcxx/include/__cxx03/stdatomic.h
@@ -220,7 +220,7 @@ using std::atomic_store_explicit _LIBCPP_USING_IF_EXISTS;
 using std::atomic_signal_fence _LIBCPP_USING_IF_EXISTS;
 using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS;
 
-#elif defined(_LIBCPP_COMPILER_CLANG_BASED)
+#else
 
 // Before C++23, we include the next <stdatomic.h> on the path to avoid hijacking
 // the header. We do this because Clang has historically shipped a <stdatomic.h>
diff --git a/libcxx/include/stdatomic.h b/libcxx/include/stdatomic.h
index 2991030eee456..aeb4442898c09 100644
--- a/libcxx/include/stdatomic.h
+++ b/libcxx/include/stdatomic.h
@@ -231,7 +231,7 @@ using std::atomic_store_explicit _LIBCPP_USING_IF_EXISTS;
 using std::atomic_signal_fence _LIBCPP_USING_IF_EXISTS;
 using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS;
 
-#  elif defined(_LIBCPP_COMPILER_CLANG_BASED)
+#  else
 
 // Before C++23, we include the next <stdatomic.h> on the path to avoid hijacking
 // the header. We do this because Clang has historically shipped a <stdatomic.h>

``````````

</details>


https://github.com/llvm/llvm-project/pull/178463


More information about the libcxx-commits mailing list