]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Simplify use_proxy_wait function
authorJonathan Wakely <jwakely@redhat.com>
Thu, 8 Jan 2026 14:03:01 +0000 (14:03 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 9 Jan 2026 19:18:21 +0000 (19:18 +0000)
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 <tkaminsk@redhat.com>
libstdc++-v3/src/c++20/atomic.cc

index cbff5e9ba1a64f4623c61b34537bf6a33e1f2d69..80558a1ad9e062d45edb98db1173f98d2c8b754d 100644 (file)
@@ -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);