[libcxx-commits] [libcxx] c806042 - [libc++] Drop dependency on __functional/operations.h from <atomic> (#117302)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 3 13:57:21 PST 2024


Author: Louis Dionne
Date: 2024-12-03T16:57:17-05:00
New Revision: c8060423fe153fcb8febbebc4a043123b7a29a7b

URL: https://github.com/llvm/llvm-project/commit/c8060423fe153fcb8febbebc4a043123b7a29a7b
DIFF: https://github.com/llvm/llvm-project/commit/c8060423fe153fcb8febbebc4a043123b7a29a7b.diff

LOG: [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.

Added: 
    

Modified: 
    libcxx/include/__atomic/atomic.h

Removed: 
    


################################################################################
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/ptr
diff _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:


        


More information about the libcxx-commits mailing list