Skip to content

Commit c806042

Browse files
authored
[libc++] Drop dependency on __functional/operations.h from <atomic> (#117302)
This should reduce the preprocessed size of the atomic header and other headers in the synchronization library.
1 parent a9bf16d commit c806042

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

libcxx/include/__atomic/atomic.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <__atomic/memory_order.h>
1717
#include <__config>
1818
#include <__cstddef/ptrdiff_t.h>
19-
#include <__functional/operations.h>
2019
#include <__memory/addressof.h>
2120
#include <__type_traits/enable_if.h>
2221
#include <__type_traits/is_floating_point.h>
@@ -376,15 +375,17 @@ struct atomic<_Tp> : __atomic_base<_Tp> {
376375
auto __builtin_op = [](auto __a, auto __builtin_operand, auto __order) {
377376
return std::__cxx_atomic_fetch_add(__a, __builtin_operand, __order);
378377
};
379-
return __rmw_op(std::forward<_This>(__self), __operand, __m, std::plus<>{}, __builtin_op);
378+
auto __plus = [](auto __a, auto __b) { return __a + __b; };
379+
return __rmw_op(std::forward<_This>(__self), __operand, __m, __plus, __builtin_op);
380380
}
381381

382382
template <class _This>
383383
_LIBCPP_HIDE_FROM_ABI static _Tp __fetch_sub(_This&& __self, _Tp __operand, memory_order __m) {
384384
auto __builtin_op = [](auto __a, auto __builtin_operand, auto __order) {
385385
return std::__cxx_atomic_fetch_sub(__a, __builtin_operand, __order);
386386
};
387-
return __rmw_op(std::forward<_This>(__self), __operand, __m, std::minus<>{}, __builtin_op);
387+
auto __minus = [](auto __a, auto __b) { return __a - __b; };
388+
return __rmw_op(std::forward<_This>(__self), __operand, __m, __minus, __builtin_op);
388389
}
389390

390391
public:

0 commit comments

Comments
 (0)