]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Include <mutex> in syncbuf.cc [PR122698]
authorJonathan Wakely <jwakely@redhat.com>
Sun, 16 Nov 2025 13:57:25 +0000 (13:57 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Sun, 16 Nov 2025 14:00:55 +0000 (14:00 +0000)
For most configurations bits/std_mutex.h would already be included by
<syncstream>, but not if configured with _GLIBCXX_USE_CXX11_ABI=0 as the
default, because syncbuf is disabled in that case.

libstdc++-v3/ChangeLog:

PR libstdc++/122698
* src/c++20/syncbuf.cc (__syncbuf_get_mutex): Include <mutex>.
Fix indentation of function body.

libstdc++-v3/src/c++20/syncbuf.cc

index 150ba5e3ce4daab55070a0ccfcc23cdc91f1f599..1fe380ec28300122941ee4653b6d705e20069c38 100644 (file)
@@ -23,6 +23,7 @@
 // <http://www.gnu.org/licenses/>.
 
 #include <syncstream>
+#include <mutex>
 #include <bits/functional_hash.h>
 
 #if _GLIBCXX_HAS_GTHREADS
@@ -32,13 +33,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 mutex&
 __syncbuf_get_mutex(void* __t)
-  {
-    const unsigned char __mask = 0xf;
-    static mutex __m[__mask + 1];
+{
+  const unsigned char __mask = 0xf;
+  static mutex __m[__mask + 1];
 
-    auto __key = _Hash_impl::hash(__t) & __mask;
-    return __m[__key];
-  }
+  auto __key = _Hash_impl::hash(__t) & __mask;
+  return __m[__key];
+}
 
 _GLIBCXX_END_NAMESPACE_VERSION
 }