[libcxx-commits] [libcxx] [libc++] Fix build failure with libdispatch backend (PR #141606)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 27 06:57:49 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

<details>
<summary>Changes</summary>

We get an error "cannot add 'abi_tag' attribute in a redeclaration" because functions like `__dispatch_apply` are first declared without an ABI tag due to `_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS` inside the header, and then redeclared with an ABI tag in the .cpp file.

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


1 Files Affected:

- (modified) libcxx/src/pstl/libdispatch.cpp (+2) 


``````````diff
diff --git a/libcxx/src/pstl/libdispatch.cpp b/libcxx/src/pstl/libdispatch.cpp
index 3dca702341c85..528018358eeb0 100644
--- a/libcxx/src/pstl/libdispatch.cpp
+++ b/libcxx/src/pstl/libdispatch.cpp
@@ -12,6 +12,7 @@
 #include <dispatch/dispatch.h>
 
 _LIBCPP_BEGIN_NAMESPACE_STD
+_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
 namespace __pstl::__libdispatch {
 
 void __dispatch_apply(size_t chunk_count, void* context, void (*func)(void* context, size_t chunk)) noexcept {
@@ -29,4 +30,5 @@ __chunk_partitions __partition_chunks(ptrdiff_t element_count) noexcept {
 }
 
 } // namespace __pstl::__libdispatch
+_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
 _LIBCPP_END_NAMESPACE_STD

``````````

</details>


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


More information about the libcxx-commits mailing list