Hi

    Still time for this fix for gcc 12 ?

    If so I'll make sure to run tests quickly, especially the abi.exp one to confirm that the cleanup in gnu-versioned-namespace.ver do not need to be replaced by the same in __8 namespace.

libstdc++: [_GLIBCXX_INLINE_VERSION] Fix std::random_device definition

Definition shall be put in _GLIBCXX_BEGIN_VERSION_NAMESPACE/
_GLIBCXX_END_VERSION_NAMESPACE like the declaration.

libstdc++-v3/ChangeLog

    * src/c++11/cow-string-inst.cc: Put random_device member definitions
    in versioned namespace.
    * src/c++11/random.cc: Likewise.
    * config/abi/pre/gnu-versioned-namespace.ver: Remove std::random_device
    symbols.

François
diff --git a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
index e9520a6421e..b37199ece72 100644
--- a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
+++ b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
@@ -28,7 +28,6 @@ GLIBCXX_8.0 {
     {
       std::*;
       std::__8::*;
-      std::random_device::*
     };
 
     # operator new(size_t)
diff --git a/libstdc++-v3/src/c++11/cow-string-inst.cc b/libstdc++-v3/src/c++11/cow-string-inst.cc
index e5331bb029a..f038d0018f0 100644
--- a/libstdc++-v3/src/c++11/cow-string-inst.cc
+++ b/libstdc++-v3/src/c++11/cow-string-inst.cc
@@ -38,6 +38,8 @@
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
   void
   random_device::_M_init(const std::string& token)
   { _M_init(token.c_str(), token.length()); }
@@ -45,5 +47,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
   void
   random_device::_M_init_pretr1(const std::string& token)
   { _M_init(token.c_str(), token.length()); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 #endif
diff --git a/libstdc++-v3/src/c++11/random.cc b/libstdc++-v3/src/c++11/random.cc
index 8b5175a4ebf..9c806b92559 100644
--- a/libstdc++-v3/src/c++11/random.cc
+++ b/libstdc++-v3/src/c++11/random.cc
@@ -301,7 +301,9 @@ namespace std _GLIBCXX_VISIBILITY(default)
 
       return any; // should be unreachable
     }
-  }
+  } // namespace
+
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   void
   random_device::_M_init(const std::string& token)
@@ -665,5 +667,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
     linear_congruential_engine<unsigned, 16807UL, 0UL, 2147483647UL>;
   template struct __detail::_Mod<unsigned, 2147483647UL, 16807UL, 0UL>;
 #endif
+_GLIBCXX_END_NAMESPACE_VERSION
 }
 #endif // _GLIBCXX_USE_C99_STDINT_TR1

Reply via email to