libstdc++: Fix -Wunused warning
authorJonathan Wakely <jwakely@redhat.com>
Thu, 17 Dec 2020 13:16:02 +0000 (13:16 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 17 Dec 2020 14:03:00 +0000 (14:03 +0000)
As noted in PR 66146 comment 35, there is a new warning in the new
std::call_once implementation.

libstdc++-v3/ChangeLog:

* src/c++11/mutex.cc (std::once_flag::_M_finish): Add
maybe_unused attribute to variable used in assertion.

libstdc++-v3/src/c++11/mutex.cc

index 4d42bed8ecc9017b483d11265a093b930e7f034d..93a5eae391d57f8ab73ead80ea41092428865f71 100644 (file)
@@ -74,7 +74,8 @@ std::once_flag::_M_finish(bool returning) noexcept
     }
   else
     {
-      int prev = __atomic_exchange_n(&_M_once, newval, __ATOMIC_RELEASE);
+      int prev [[maybe_unused]]
+       = __atomic_exchange_n(&_M_once, newval, __ATOMIC_RELEASE);
       __glibcxx_assert(prev & _Bits::_Active);
       // Wake any other threads waiting for this execution to finish.
       constexpr int futex_wake = 129; // FUTEX_WAKE_PRIVATE