The __wait_args::_M_setup_proxy_wait function must only be called when
_M_obj == addr is true, so it's redundant for _M_setup_proxy_wait to
pass addr to use_proxy_wait. That address is already passed as
args._M_old anyway.

libstdc++-v3/ChangeLog:

        * src/c++20/atomic.cc (use_proxy_wait): Remove unused second
        parameter.
        (__wait_args::_M_setup_proxy_wait): Remove second argument.
        (__notify_impl): Likewise.

Reviewed-by: Tomasz KamiƄski <[email protected]>
---

v2: No changes, just rebased on the first patch.

Tested x86_64-linux and x86_64-freebsd14.

 libstdc++-v3/src/c++20/atomic.cc | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libstdc++-v3/src/c++20/atomic.cc b/libstdc++-v3/src/c++20/atomic.cc
index cbff5e9ba1a6..80558a1ad9e0 100644
--- a/libstdc++-v3/src/c++20/atomic.cc
+++ b/libstdc++-v3/src/c++20/atomic.cc
@@ -280,8 +280,7 @@ namespace
 
   [[gnu::always_inline]]
   inline bool
-  use_proxy_wait([[maybe_unused]] const __wait_args_base& args,
-                [[maybe_unused]] const void* /* addr */)
+  use_proxy_wait([[maybe_unused]] const __wait_args_base& args)
   {
 #ifdef _GLIBCXX_HAVE_PLATFORM_WAIT
     if constexpr (__platform_wait_uses_type<uint32_t>)
@@ -324,7 +323,7 @@ __wait_args::_M_setup_proxy_wait(const void* addr)
 
   if (addr == _M_obj)
     {
-      if (!use_proxy_wait(*this, addr)) // We can wait on this address 
directly.
+      if (!use_proxy_wait(*this)) // We can wait on this address directly.
        return false;
 
       // This will be a proxy wait, so get a waitable state.
@@ -384,7 +383,7 @@ __notify_impl([[maybe_unused]] const void* __addr, 
[[maybe_unused]] bool __all,
              const __wait_args_base& __args)
 {
   const bool __track_contention = __args & __wait_flags::__track_contention;
-  const bool proxy_wait = use_proxy_wait(__args, __addr);
+  const bool proxy_wait = use_proxy_wait(__args);
 
   [[maybe_unused]] auto* __wait_addr
     = static_cast<const __platform_wait_t*>(__addr);
-- 
2.52.0

Reply via email to