public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix gnu-versioned-namespace build
@ 2019-12-11  7:29 François Dumont
  2019-12-11 11:16 ` Jonathan Wakely
  2019-12-11 16:48 ` Jonathan Wakely
  0 siblings, 2 replies; 17+ messages in thread
From: François Dumont @ 2019-12-11  7:29 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 561 bytes --]

I plan to commit this tomorrow.

Note that rather than just adding the missing 
_GLIBCXX_[BEGIN,END]_VERSION_NAMESPACE I also move anonymous namespace 
usage outside std namespace. Let me know if it was intentional.

     * src/c++11/random.cc: Add _GLIBCXX_BEGIN_NAMESPACE_VERSION and
     _GLIBCXX_END_NAMESPACE_VERSION. Move anonymous namespace outside std
     namespace.

Tested under Linux x86_64 normal/debug/versioned namespace modes.

There are still tests failing in versioned namespace, more patches to come.

François


[-- Attachment #2: versioned_namespace_build.patch --]
[-- Type: text/x-patch, Size: 1163 bytes --]

diff --git a/libstdc++-v3/src/c++11/random.cc b/libstdc++-v3/src/c++11/random.cc
index 10fbe1dc4c4..d4ebc9556ab 100644
--- a/libstdc++-v3/src/c++11/random.cc
+++ b/libstdc++-v3/src/c++11/random.cc
@@ -73,8 +73,6 @@
 # define USE_MT19937 1
 #endif
 
-namespace std _GLIBCXX_VISIBILITY(default)
-{
 namespace
 {
 #if USE_RDRAND
@@ -124,6 +122,10 @@ namespace std _GLIBCXX_VISIBILITY(default)
 #endif
 }
 
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
   void
   random_device::_M_init(const std::string& token)
   {
@@ -286,7 +288,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
     _M_mt.seed(seed);
 #else
     // Convert old default token "mt19937" or numeric seed tokens to "default".
-    if (token == "mt19937" || isdigit((unsigned char)token[0]))
+    if (token == "mt19937" || std::isdigit((unsigned char)token[0]))
       _M_init("default");
     else
       _M_init(token);
@@ -407,5 +409,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
     0x9d2c5680UL, 15,
     0xefc60000UL, 18, 1812433253UL>;
 #endif // USE_MT19937
-}
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
 #endif // _GLIBCXX_USE_C99_STDINT_TR1

^ permalink raw reply	[flat|nested] 17+ messages in thread
* [PATCH] Fix gnu-versioned-namespace build
@ 2020-10-30 12:59 François Dumont
  2020-10-30 13:23 ` Jonathan Wakely
  0 siblings, 1 reply; 17+ messages in thread
From: François Dumont @ 2020-10-30 12:59 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 685 bytes --]

The gnu-versioned-namespace build is broken.

The fix in charconv/floating_from_chars.cc is quite trivial. I am not so 
sure about the fix in sstream-inst.cc.

     libstdc++: Fix gnu-version-namespace buid

     libstdc++-v3/ChangeLog

             * include/std/charconv (from_chars): Define only if
             _GLIBCXX_USE_CXX11_ABI.
             * src/c++17/floating_from_chars.cc (from_chars): Likewise.
             * src/c++20/sstream-inst.cc: Limit instantiations if
             _GLIBCXX_USE_CXX11_ABI.

I build the lib with this patch. I am now running tests.

Ok to commit if tests are successful ?

François


[-- Attachment #2: version-ns.patch --]
[-- Type: text/x-patch, Size: 1632 bytes --]

diff --git a/libstdc++-v3/include/std/charconv b/libstdc++-v3/include/std/charconv
index dd1ebdf8322..90142659a0c 100644
--- a/libstdc++-v3/include/std/charconv
+++ b/libstdc++-v3/include/std/charconv
@@ -688,7 +688,7 @@ namespace __detail
   operator^=(chars_format& __lhs, chars_format __rhs) noexcept
   { return __lhs = __lhs ^ __rhs; }
 
-#if _GLIBCXX_HAVE_USELOCALE
+#if _GLIBCXX_HAVE_USELOCALE && _GLIBCXX_USE_CXX11_ABI
   from_chars_result
   from_chars(const char* __first, const char* __last, float& __value,
 	     chars_format __fmt = chars_format::general) noexcept;
diff --git a/libstdc++-v3/src/c++17/floating_from_chars.cc b/libstdc++-v3/src/c++17/floating_from_chars.cc
index d52c0a937b9..36685c2d6f4 100644
--- a/libstdc++-v3/src/c++17/floating_from_chars.cc
+++ b/libstdc++-v3/src/c++17/floating_from_chars.cc
@@ -41,7 +41,7 @@
 # include <xlocale.h>
 #endif
 
-#if _GLIBCXX_HAVE_USELOCALE
+#if _GLIBCXX_HAVE_USELOCALE && _GLIBCXX_USE_CXX11_ABI
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/libstdc++-v3/src/c++20/sstream-inst.cc b/libstdc++-v3/src/c++20/sstream-inst.cc
index e04560d28c8..8c6840115c5 100644
--- a/libstdc++-v3/src/c++20/sstream-inst.cc
+++ b/libstdc++-v3/src/c++20/sstream-inst.cc
@@ -29,6 +29,7 @@
 // Instantiations in this file are only for the new SSO std::string ABI
 #include <sstream>
 
+#if _GLIBCXX_USE_CXX11_ABI
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -106,3 +107,5 @@ basic_stringstream<wchar_t>::view() const noexcept;
 
 _GLIBCXX_END_NAMESPACE_VERSION
 }
+
+#endif //_GLIBCXX_USE_CXX11_ABI

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-10-31 17:16 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11  7:29 [PATCH] Fix gnu-versioned-namespace build François Dumont
2019-12-11 11:16 ` Jonathan Wakely
2019-12-11 11:22   ` Jonathan Wakely
2019-12-11 20:26     ` [PATCH] Fix gnu-versioned-namespace tr1 declaration François Dumont
2019-12-11 21:04       ` Jonathan Wakely
2019-12-11 20:23   ` [PATCH] Fix gnu-versioned-namespace build François Dumont
2019-12-11 20:44     ` Jonathan Wakely
2019-12-11 21:28       ` François Dumont
2019-12-11 21:33         ` Jonathan Wakely
2019-12-11 16:48 ` Jonathan Wakely
2020-10-30 12:59 François Dumont
2020-10-30 13:23 ` Jonathan Wakely
2020-10-30 13:37   ` Jonathan Wakely
2020-10-30 14:11     ` Jonathan Wakely
2020-10-30 17:51     ` François Dumont
2020-10-30 18:48       ` Jonathan Wakely
2020-10-31 17:16         ` François Dumont

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).