[libcxx-commits] [libcxx] [libc++] Drop dependency on __functional/operations.h from <atomic> (PR #117302)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Nov 22 00:35:53 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Louis Dionne (ldionne)
<details>
<summary>Changes</summary>
This should reduce the preprocessed size of the atomic header and other headers in the synchronization library.
---
Full diff: https://github.com/llvm/llvm-project/pull/117302.diff
1 Files Affected:
- (modified) libcxx/include/__atomic/atomic.h (+4-3)
``````````diff
diff --git a/libcxx/include/__atomic/atomic.h b/libcxx/include/__atomic/atomic.h
index ae0475693f22b4..d83719c8733d7e 100644
--- a/libcxx/include/__atomic/atomic.h
+++ b/libcxx/include/__atomic/atomic.h
@@ -16,7 +16,6 @@
#include <__atomic/memory_order.h>
#include <__config>
#include <__cstddef/ptrdiff_t.h>
-#include <__functional/operations.h>
#include <__memory/addressof.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_floating_point.h>
@@ -376,7 +375,8 @@ struct atomic<_Tp> : __atomic_base<_Tp> {
auto __builtin_op = [](auto __a, auto __builtin_operand, auto __order) {
return std::__cxx_atomic_fetch_add(__a, __builtin_operand, __order);
};
- return __rmw_op(std::forward<_This>(__self), __operand, __m, std::plus<>{}, __builtin_op);
+ auto __plus = [](auto __a, auto __b) { return __a + __b; };
+ return __rmw_op(std::forward<_This>(__self), __operand, __m, __plus, __builtin_op);
}
template <class _This>
@@ -384,7 +384,8 @@ struct atomic<_Tp> : __atomic_base<_Tp> {
auto __builtin_op = [](auto __a, auto __builtin_operand, auto __order) {
return std::__cxx_atomic_fetch_sub(__a, __builtin_operand, __order);
};
- return __rmw_op(std::forward<_This>(__self), __operand, __m, std::minus<>{}, __builtin_op);
+ auto __minus = [](auto __a, auto __b) { return __a - __b; };
+ return __rmw_op(std::forward<_This>(__self), __operand, __m, __minus, __builtin_op);
}
public:
``````````
</details>
https://github.com/llvm/llvm-project/pull/117302
More information about the libcxx-commits
mailing list