public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Export explicit instantiations for C++17 members of std::string
@ 2019-01-04 23:24 Jonathan Wakely
  2019-01-06 17:00 ` Rainer Orth
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2019-01-04 23:24 UTC (permalink / raw)
  To: libstdc++, gcc-patches

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

The C++17 standard added some new members to std::basic_string, which
were not previously instantiated in the library. This meant that the
extern template declarations had to be disabled for C++17 mode. With
this patch the new members are instantiated in the library and so the
explicit instantiation declarations can be used for C++17.

The new members added by C++2a are still not exported, and so the
explicit instantiation declarations are still disabled for C++2a.

	* config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Make patterns less greedy
	for const member functions of std::basic_string.
	(GLIBCXX_3.4.26): Export member functions of std::basic_string added
	in C++17.
	* include/bits/basic_string.h (basic_string(__sv_wrapper, const A&)):
	Make non-standard constructor private.
	[!_GLIBCXX_USE_CXX11_ABI] (basic_string(__sv_wrapper, const A&)):
	Likewise.
	* include/bits/basic_string.tcc (std::string, std::wstring): Declare
	explicit instantiations for C++17 as well as earlier dialects.
	* src/c++17/Makefile.am: Add new source files.
	* src/c++17/Makefile.in: Regenerate.
	* src/c++17/cow-string-inst.cc: New file defining explicit
	instantiations for basic_string member functions added in C++17.
	* src/c++17/string-inst.cc: Likewise.

Tested powerpc64le-linux, committed to trunk.

More new C++17 symbols still to follow shortly.


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 22676 bytes --]

commit 4b6d5774d685f61a73519dca8901fc8f032ba6da
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Jan 3 23:05:14 2019 +0000

    Export explicit instantiations for C++17 members of std::string
    
    The C++17 standard added some new members to std::basic_string, which
    were not previously instantiated in the library. This meant that the
    extern template declarations had to be disabled for C++17 mode. With
    this patch the new members are instantiated in the library and so the
    explicit instantiation declarations can be used for C++17.
    
    The new members added by C++2a are still not exported, and so the
    explicit instantiation declarations are still disabled for C++2a.
    
            * config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Make patterns less greedy
            for const member functions of std::basic_string.
            (GLIBCXX_3.4.26): Export member functions of std::basic_string added
            in C++17.
            * include/bits/basic_string.h (basic_string(__sv_wrapper, const A&)):
            Make non-standard constructor private.
            [!_GLIBCXX_USE_CXX11_ABI] (basic_string(__sv_wrapper, const A&)):
            Likewise.
            * include/bits/basic_string.tcc (std::string, std::wstring): Declare
            explicit instantiations for C++17 as well as earlier dialects.
            * src/c++17/Makefile.am: Add new source files.
            * src/c++17/Makefile.in: Regenerate.
            * src/c++17/cow-string-inst.cc: New file defining explicit
            instantiations for basic_string member functions added in C++17.
            * src/c++17/string-inst.cc: Likewise.

diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 1d157288fcf..6c18caa6d8a 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1742,7 +1742,8 @@ GLIBCXX_3.4.21 {
     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]Ev;
     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]I[PN]*;
     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE[Daip]*;
-    _ZNKSt7__cxx1112basic_string*;
+    _ZNKSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE[1-9]*;
+    _ZNKSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EEixE[jmy];
 
     # operator+ for ABI-tagged std::basic_string
     _ZStplI[cw]St11char_traitsI[cw]ESaI[cw]EENSt7__cxx1112basic_stringIT_T0_T1_EE*;
@@ -2077,6 +2078,27 @@ GLIBCXX_3.4.26 {
     _ZNSbIwSt11char_traitsIwESaIwEEC[12]ERKS2_RKS1_;
     _ZNSbIwSt11char_traitsIwESaIwEEC[12]EOS2_RKS1_;
 
+    # basic_string<C, T, A>::operator basic_string_view<C, T>() const
+    _ZNKSscvSt17basic_string_viewIcSt11char_traitsIcEEEv;
+    _ZNKSbIwSt11char_traitsIwESaIwEEcvSt17basic_string_viewIwS0_EEv;
+    _ZNKSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EEcvSt17basic_string_viewI[cw]S2_EEv;
+    # basic_string<C, T, A>::data()
+    _ZNSs4dataEv;
+    _ZNSbIwSt11char_traitsIwESaIwEE4dataEv;
+    _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE4dataEv;
+    # basic_string<C, T, A>::_S_to_string_view(basic_string_view<C, T>)
+    _ZNSs17_S_to_string_viewESt17basic_string_viewIcSt11char_traitsIcEE;
+    _ZNSbIwSt11char_traitsIwESaIwEE17_S_to_string_viewESt17basic_string_viewIwS0_E;
+    _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE17_S_to_string_viewESt17basic_string_viewI[cw]S2_E;
+    # basic_string<C, T, A>::__sv_wrapper::__sv_wrapper(basic_string_view<C, T>)
+    _ZNSs12__sv_wrapperC[12]ESt17basic_string_viewIcSt11char_traitsIcEE;
+    _ZNSbIwSt11char_traitsIwESaIwEE12__sv_wrapperC[12]ESt17basic_string_viewIwS0_E;
+    _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE12__sv_wrapperC[12]ESt17basic_string_viewI[cw]S2_E;
+    # basic_string<C, T, A>::basic_string(__sv_wrapper, const allocator_type&)
+    _ZNSsC[12]ENSs12__sv_wrapperERKSaIcE;
+    _ZNSbIwSt11char_traitsIwESaIwEEC[12]ENS2_12__sv_wrapperERKS1_;
+    _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]ENS4_12__sv_wrapperERKS3_;
+
 } GLIBCXX_3.4.25;
 
 # Symbols in the support library (libsupc++) have their own tag.
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 43460df5d1f..28ed337bdb6 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -44,7 +44,7 @@
 #include <initializer_list>
 #endif
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
 # include <string_view>
 #endif
 
@@ -109,7 +109,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 #endif
 
     private:
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       // A helper type for avoiding boiler-plate.
       typedef basic_string_view<_CharT, _Traits> __sv_type;
 
@@ -134,6 +134,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 	explicit __sv_wrapper(__sv_type __sv) noexcept : _M_sv(__sv) { }
 	__sv_type _M_sv;
       };
+
+      /**
+       *  @brief  Only internally used: Construct string from a string view
+       *          wrapper.
+       *  @param  __svw  string view wrapper.
+       *  @param  __a  Allocator to use.
+       */
+      explicit
+      basic_string(__sv_wrapper __svw, const _Alloc& __a)
+      : basic_string(__svw._M_sv.data(), __svw._M_sv.size(), __a) { }
 #endif
 
       // Use empty-base optimization: http://www.cantrip.org/emptyopt.html
@@ -617,7 +627,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 	: _M_dataplus(_M_local_data(), __a)
 	{ _M_construct(__beg, __end); }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Construct string from a substring of a string_view.
        *  @param  __t   Source object convertible to string view.
@@ -639,16 +649,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 	explicit
 	basic_string(const _Tp& __t, const _Alloc& __a = _Alloc())
 	: basic_string(__sv_wrapper(_S_to_string_view(__t)), __a) { }
-
-      /**
-       *  @brief  Only internally used: Construct string from a string view
-       *          wrapper.
-       *  @param  __svw  string view wrapper.
-       *  @param  __a  Allocator to use.
-       */
-      explicit
-      basic_string(__sv_wrapper __svw, const _Alloc& __a)
-      : basic_string(__svw._M_sv.data(), __svw._M_sv.size(), __a) { }
 #endif // C++17
 
       /**
@@ -799,7 +799,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       }
 #endif // C++11
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Set value to string constructed from a string_view.
        *  @param  __svt  An object convertible to string_view.
@@ -1200,7 +1200,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       { return this->append(__l.begin(), __l.size()); }
 #endif // C++11
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Append a string_view.
        *  @param __svt  An object convertible to string_view to be appended.
@@ -1309,7 +1309,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
         append(_InputIterator __first, _InputIterator __last)
         { return this->replace(end(), end(), __first, __last); }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Append a string_view.
        *  @param __svt  An object convertible to string_view to be appended.
@@ -1481,7 +1481,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       { return this->assign(__l.begin(), __l.size()); }
 #endif // C++11
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Set value from a string_view.
        *  @param __svt  The source object convertible to string_view.
@@ -1750,7 +1750,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 	return iterator(_M_data() + __pos);
       }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Insert a string_view.
        *  @param __pos  Iterator referencing position in string to insert at.
@@ -2181,7 +2181,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       { return this->replace(__i1, __i2, __l.begin(), __l.size()); }
 #endif // C++11
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Replace range of characters with string_view.
        *  @param __pos  The position to replace at.
@@ -2309,7 +2309,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       data() const _GLIBCXX_NOEXCEPT
       { return _M_data(); }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Return non-const pointer to contents.
        *
@@ -2359,7 +2359,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       _GLIBCXX_NOEXCEPT
       { return this->find(__str.data(), __pos, __str.size()); }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Find position of a string_view.
        *  @param __svt  The object convertible to string_view to locate.
@@ -2421,7 +2421,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       _GLIBCXX_NOEXCEPT
       { return this->rfind(__str.data(), __pos, __str.size()); }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Find last position of a string_view.
        *  @param __svt  The object convertible to string_view to locate.
@@ -2500,7 +2500,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       _GLIBCXX_NOEXCEPT
       { return this->find_first_of(__str.data(), __pos, __str.size()); }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Find position of a character of a string_view.
        *  @param __svt  An object convertible to string_view containing
@@ -2584,7 +2584,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       _GLIBCXX_NOEXCEPT
       { return this->find_last_of(__str.data(), __pos, __str.size()); }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Find last position of a character of string.
        *  @param __svt  An object convertible to string_view containing
@@ -2667,7 +2667,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       _GLIBCXX_NOEXCEPT
       { return this->find_first_not_of(__str.data(), __pos, __str.size()); }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Find position of a character not in a string_view.
        *  @param __svt  A object convertible to string_view containing
@@ -2749,7 +2749,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       _GLIBCXX_NOEXCEPT
       { return this->find_last_not_of(__str.data(), __pos, __str.size()); }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Find last position of a character not in a string_view.
        *  @param __svt  An object convertible to string_view containing
@@ -2859,7 +2859,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 	return __r;
       }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Compare to a string_view.
        *  @param __svt An object convertible to string_view to compare against.
@@ -3493,7 +3493,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
       _S_empty_rep() _GLIBCXX_NOEXCEPT
       { return _Rep::_S_empty_rep(); }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       // A helper type for avoiding boiler-plate.
       typedef basic_string_view<_CharT, _Traits> __sv_type;
 
@@ -3518,6 +3518,16 @@ _GLIBCXX_END_NAMESPACE_CXX11
 	explicit __sv_wrapper(__sv_type __sv) noexcept : _M_sv(__sv) { }
 	__sv_type _M_sv;
       };
+
+      /**
+       *  @brief  Only internally used: Construct string from a string view
+       *          wrapper.
+       *  @param  __svw  string view wrapper.
+       *  @param  __a  Allocator to use.
+       */
+      explicit
+      basic_string(__sv_wrapper __svw, const _Alloc& __a)
+      : basic_string(__svw._M_sv.data(), __svw._M_sv.size(), __a) { }
 #endif
 
     public:
@@ -3662,7 +3672,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
         basic_string(_InputIterator __beg, _InputIterator __end,
 		     const _Alloc& __a = _Alloc());
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Construct string from a substring of a string_view.
        *  @param  __t   Source object convertible to string view.
@@ -3684,16 +3694,6 @@ _GLIBCXX_END_NAMESPACE_CXX11
 	explicit
 	basic_string(const _Tp& __t, const _Alloc& __a = _Alloc())
 	: basic_string(__sv_wrapper(_S_to_string_view(__t)), __a) { }
-
-      /**
-       *  @brief  Only internally used: Construct string from a string view
-       *          wrapper.
-       *  @param  __svw  string view wrapper.
-       *  @param  __a  Allocator to use.
-       */
-      explicit
-      basic_string(__sv_wrapper __svw, const _Alloc& __a)
-      : basic_string(__svw._M_sv.data(), __svw._M_sv.size(), __a) { }
 #endif // C++17
 
       /**
@@ -3761,7 +3761,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
       }
 #endif // C++11
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Set value to string constructed from a string_view.
        *  @param  __svt An object convertible to  string_view.
@@ -4183,7 +4183,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
       { return this->append(__l.begin(), __l.size()); }
 #endif // C++11
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Append a string_view.
        *  @param __svt The object convertible to string_view to be appended.
@@ -4275,7 +4275,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
         append(_InputIterator __first, _InputIterator __last)
         { return this->replace(_M_iend(), _M_iend(), __first, __last); }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Append a string_view.
        *  @param __svt The object convertible to string_view to be appended.
@@ -4433,7 +4433,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
       { return this->assign(__l.begin(), __l.size()); }
 #endif // C++11
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Set value from a string_view.
        *  @param __svt The source object convertible to string_view.
@@ -4640,7 +4640,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
 	return iterator(_M_data() + __pos);
       }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Insert a string_view.
        *  @param __pos  Iterator referencing position in string to insert at.
@@ -5030,7 +5030,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
       { return this->replace(__i1, __i2, __l.begin(), __l.end()); }
 #endif // C++11
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Replace range of characters with string_view.
        *  @param __pos  The position to replace at.
@@ -5203,7 +5203,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
       data() const _GLIBCXX_NOEXCEPT
       { return _M_data(); }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Return non-const pointer to contents.
        *
@@ -5286,7 +5286,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
       size_type
       find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Find position of a string_view.
        *  @param __svt  The object convertible to string_view to locate.
@@ -5364,7 +5364,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
       size_type
       rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT;
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Find last position of a string_view.
        *  @param __svt  The object convertible to string_view to locate.
@@ -5447,7 +5447,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
       find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
       { return this->find(__c, __pos); }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Find position of a character of a string_view.
        *  @param __svt  An object convertible to string_view containing
@@ -5531,7 +5531,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
       find_last_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT
       { return this->rfind(__c, __pos); }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Find last position of a character of string.
        *  @param __svt  An object convertible to string_view containing
@@ -5612,7 +5612,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
       find_first_not_of(_CharT __c, size_type __pos = 0) const
       _GLIBCXX_NOEXCEPT;
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Find position of a character not in a string_view.
        *  @param __svt  An object convertible to string_view containing
@@ -5694,7 +5694,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
       find_last_not_of(_CharT __c, size_type __pos = npos) const
       _GLIBCXX_NOEXCEPT;
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Find last position of a character not in a string_view.
        *  @param __svt  An object convertible to string_view containing
@@ -5756,7 +5756,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
 	return __r;
       }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
       /**
        *  @brief  Compare to a string_view.
        *  @param __svt An object convertible to string_view to compare against.
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index 0eaf8e64c40..314b8fe207f 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -1604,7 +1604,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // Until those definitions are compiled as C++17 suppress the declaration,
   // so C++17 code will implicitly instantiate std::string and std::wstring
   // as needed.
-# if __cplusplus <= 201402L && _GLIBCXX_EXTERN_TEMPLATE > 0
+# if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0
   extern template class basic_string<char>;
 # elif ! _GLIBCXX_USE_CXX11_ABI
   // Still need to prevent implicit instantiation of the COW empty rep,
@@ -1627,7 +1627,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     getline(basic_istream<char>&, string&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-# if __cplusplus <= 201402L && _GLIBCXX_EXTERN_TEMPLATE > 0
+# if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0
   extern template class basic_string<wchar_t>;
 # elif ! _GLIBCXX_USE_CXX11_ABI
   extern template basic_string<wchar_t>::size_type
diff --git a/libstdc++-v3/src/c++17/Makefile.am b/libstdc++-v3/src/c++17/Makefile.am
index c26e5276f94..afa119eecb6 100644
--- a/libstdc++-v3/src/c++17/Makefile.am
+++ b/libstdc++-v3/src/c++17/Makefile.am
@@ -28,10 +28,11 @@ noinst_LTLIBRARIES = libc++17convenience.la
 headers =
 
 sources = \
-	memory_resource.cc
+	memory_resource.cc \
+	string-inst.cc
 
 if ENABLE_DUAL_ABI
-extra_string_inst_sources =
+extra_string_inst_sources = cow-string-inst.cc
 else
 extra_string_inst_sources =
 endif
diff --git a/libstdc++-v3/src/c++17/cow-string-inst.cc b/libstdc++-v3/src/c++17/cow-string-inst.cc
new file mode 100644
index 00000000000..b47a6e50d87
--- /dev/null
+++ b/libstdc++-v3/src/c++17/cow-string-inst.cc
@@ -0,0 +1,34 @@
+// Reference-counted COW string instantiations for C++17 -*- C++ -*-
+
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:2017 24  Strings library
+//
+
+#define _GLIBCXX_USE_CXX11_ABI 0
+#include "string-inst.cc"
+
+#if ! _GLIBCXX_USE_DUAL_ABI
+# error This file should not be compiled for this configuration.
+#endif
diff --git a/libstdc++-v3/src/c++17/string-inst.cc b/libstdc++-v3/src/c++17/string-inst.cc
new file mode 100644
index 00000000000..c095a90587e
--- /dev/null
+++ b/libstdc++-v3/src/c++17/string-inst.cc
@@ -0,0 +1,50 @@
+// string instantiations for C++17 -*- C++ -*-
+
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:2017 24  Strings library
+//
+
+#include <string>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+template basic_string<char>::basic_string(__sv_wrapper, const allocator_type&);
+template basic_string<char>::__sv_wrapper::__sv_wrapper(string_view);
+template string_view basic_string<char>::_S_to_string_view(string_view);
+template basic_string<char>::operator string_view() const noexcept;
+template char* basic_string<char>::data() noexcept;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+template basic_string<wchar_t>::basic_string(__sv_wrapper, const allocator_type&);
+template basic_string<wchar_t>::__sv_wrapper::__sv_wrapper(wstring_view);
+template wstring_view basic_string<wchar_t>::_S_to_string_view(wstring_view);
+template basic_string<wchar_t>::operator wstring_view() const noexcept;
+template wchar_t* basic_string<wchar_t>::data() noexcept;
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std

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

* Re: [PATCH] Export explicit instantiations for C++17 members of std::string
  2019-01-04 23:24 [PATCH] Export explicit instantiations for C++17 members of std::string Jonathan Wakely
@ 2019-01-06 17:00 ` Rainer Orth
  2019-01-06 17:18   ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: Rainer Orth @ 2019-01-06 17:00 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

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

Hi Jonathan,

> The C++17 standard added some new members to std::basic_string, which
> were not previously instantiated in the library. This meant that the
> extern template declarations had to be disabled for C++17 mode. With
> this patch the new members are instantiated in the library and so the
> explicit instantiation declarations can be used for C++17.
>
> The new members added by C++2a are still not exported, and so the
> explicit instantiation declarations are still disabled for C++2a.
>
> 	* config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Make patterns less greedy
> 	for const member functions of std::basic_string.
> 	(GLIBCXX_3.4.26): Export member functions of std::basic_string added
> 	in C++17.
> 	* include/bits/basic_string.h (basic_string(__sv_wrapper, const A&)):
> 	Make non-standard constructor private.
> 	[!_GLIBCXX_USE_CXX11_ABI] (basic_string(__sv_wrapper, const A&)):
> 	Likewise.
> 	* include/bits/basic_string.tcc (std::string, std::wstring): Declare
> 	explicit instantiations for C++17 as well as earlier dialects.
> 	* src/c++17/Makefile.am: Add new source files.
> 	* src/c++17/Makefile.in: Regenerate.
> 	* src/c++17/cow-string-inst.cc: New file defining explicit
> 	instantiations for basic_string member functions added in C++17.
> 	* src/c++17/string-inst.cc: Likewise.
>
> Tested powerpc64le-linux, committed to trunk.

this patch broke Solaris bootstrap:

ld: fatal: libstdc++-symbols.ver-sun: 6705: symbol 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator std::basic_string_view<char, std::char_traits<char> >() const': symbol version conflict
ld: fatal: libstdc++-symbols.ver-sun: 6707: symbol 'std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::operator std::basic_string_view<wchar_t, std::char_traits<wchar_t> >() const': symbol version conflict
ld: fatal: libstdc++-symbols.ver-sun: 6712: symbol 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::data()': symbol version conflict
ld: fatal: libstdc++-symbols.ver-sun: 6714: symbol 'std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::data()': symbol version conflict
ld: fatal: libstdc++-symbols.ver-sun: 6723: symbol 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_to_string_view(std::basic_string_view<char, std::char_traits<char> >)': symbol version conflict
ld: fatal: libstdc++-symbols.ver-sun: 6724: symbol 'std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_S_to_string_view(std::basic_string_view<wchar_t, std::char_traits<wchar_t> >)': symbol version conflict
collect2: error: ld returned 1 exit status
make[6]: *** [Makefile:696: libstdc++.la] Error 1

Rerunning with COLLECT_NO_DEMANGLE=1 gives (with symbol versions and
patterns matched extracted from libstdc++-symbols.ver-sun):

d: fatal: libstdc++-symbols.ver-sun: 6705: symbol '_ZNKSscvSt17basic_string_viewIcSt11char_traitsIcEEEv': symbol version conflict

  GLIBCXX_3.4
    ##_ZNKSs[a-z]* (glob)
    _ZNKSscvSt17basic_string_viewIcSt11char_traitsIcEEEv;
  GLIBCXX_3.4.26
    ##_ZNKSscvSt17basic_string_viewIcSt11char_traitsIcEEEv (glob)
    _ZNKSscvSt17basic_string_viewIcSt11char_traitsIcEEEv;

ld: fatal: libstdc++-symbols.ver-sun: 6707: symbol '_ZNKSbIwSt11char_traitsIwESaIwEEcvSt17basic_string_viewIwS0_EEv': symbol version conflict

  GLIBCXX_3.4
    ##_ZNKSbIwSt11char_traitsIwESaIwEE[a-z]* (glob)    
    _ZNKSbIwSt11char_traitsIwESaIwEEcvSt17basic_string_viewIwS0_EEv;
  GLIBCXX_3.4.26
    ##_ZNKSbIwSt11char_traitsIwESaIwEE[a-z]* (glob)
    _ZNKSbIwSt11char_traitsIwESaIwEEcvSt17basic_string_viewIwS0_EEv;

ld: fatal: libstdc++-symbols.ver-sun: 6712: symbol '_ZNSs4dataEv': symbol version conflict

  GLIBCXX_3.4
    ##_ZNSs[0-58-9][c-e]* (glob)    
    _ZNSs4dataEv;
  GLIBCXX_3.4.26
    ##_ZNSs4dataEv (glob)
    _ZNSs4dataEv;

ld: fatal: libstdc++-symbols.ver-sun: 6714: symbol '_ZNSbIwSt11char_traitsIwESaIwEE4dataEv': symbol version conflict

  GLIBCXX_3.4
    ##_ZNSbIwSt11char_traitsIwESaIwEE[0-58-9][c-e]* (glob)
    _ZNSbIwSt11char_traitsIwESaIwEE4dataEv;
  GLIBCXX_3.4.26
    ##_ZNSbIwSt11char_traitsIwESaIwEE4dataEv (glob)
    _ZNSbIwSt11char_traitsIwESaIwEE4dataEv;

ld: fatal: libstdc++-symbols.ver-sun: 6723: symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE17_S_to_string_viewESt17basic_string_viewIcS2_E': symbol version conflict

  GLIBCXX_3.4.21
    ##_ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE1[5-9]* (glob)
    _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE17_S_to_string_viewESt17basic_string_viewIcS2_E;
  GLIBCXX_3.4.26
    ##_ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE17_S_to_string_viewESt17basic_string_viewI[cw]S2_E (glob)
    _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE17_S_to_string_viewESt17basic_string_viewIcS2_E;

ld: fatal: libstdc++-symbols.ver-sun: 6724: symbol '_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE17_S_to_string_viewESt17basic_string_viewIwS2_E': symbol version conflict

  GLIBCXX_3.4.21
    ##_ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE1[5-9]* (glob)
    _ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE17_S_to_string_viewESt17basic_string_viewIwS2_E;
  GLIBCXX_3.4.26
    ##_ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE17_S_to_string_viewESt17basic_string_viewI[cw]S2_E (glob)
    _ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE17_S_to_string_viewESt17basic_string_viewIwS2_E;

The following patch allowed the build to finish.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sol2-lver.patch --]
[-- Type: text/x-patch, Size: 2168 bytes --]

diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -217,7 +217,7 @@ GLIBCXX_3.4 {
     _ZNSsD*;
     _ZNSs[0-58-9]a*;
     _ZNSs5beginEv;
-    _ZNSs[0-58-9][c-e]*;
+    _ZNSs[0-358-9][c-e]*;
     _ZNSs[0-59][g-z]*;
 #   _ZNSs[67][a-z]*E[PRcjmvy]*;
     _ZNSs6appendE[PRcjmvy]*;
@@ -258,7 +258,7 @@ GLIBCXX_3.4 {
     _ZNKSs[0-9][g-z]*;
     _ZNKSs[0-9][0-9][a-z]*;
     _ZNKSs4find*;
-    _ZNKSs[a-z]*;
+    _ZNKSs[abd-z]*;
     _ZNKSs4_Rep12_M_is_leakedEv;
     _ZNKSs4_Rep12_M_is_sharedEv;
     _ZNKSs6_M_repEv;
@@ -284,7 +284,7 @@ GLIBCXX_3.4 {
     _ZNSbIwSt11char_traitsIwESaIwEED*;
     _ZNSbIwSt11char_traitsIwESaIwEE[0-58-9]a*;
     _ZNSbIwSt11char_traitsIwESaIwEE5beginEv;
-    _ZNSbIwSt11char_traitsIwESaIwEE[0-58-9][c-e]*;
+    _ZNSbIwSt11char_traitsIwESaIwEE[0-358-9][c-e]*;
     _ZNSbIwSt11char_traitsIwESaIwEE[0-59][g-z]*;
 #   _ZNSbIwSt11char_traitsIwESaIwEE[67][a-b]*E[PRwjmvy]*;
     _ZNSbIwSt11char_traitsIwESaIwEE6appendE[PRwjmvy]*;
@@ -324,7 +324,7 @@ GLIBCXX_3.4 {
     _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][d-e]*;
     _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][g-z]*;
     _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][0-9][a-z]*;
-    _ZNKSbIwSt11char_traitsIwESaIwEE[a-z]*;
+    _ZNKSbIwSt11char_traitsIwESaIwEE[abd-z]*;
     _ZNKSbIwSt11char_traitsIwESaIwEE4find*;
     _ZNKSbIwSt11char_traitsIwESaIwEE4_Rep12_M_is_leakedEv;
     _ZNKSbIwSt11char_traitsIwESaIwEE4_Rep12_M_is_sharedEv;
@@ -1702,7 +1702,7 @@ GLIBCXX_3.4.21 {
     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE12_M*;
     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE13*;
     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE14_M_replace_aux*;
-    _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE1[5-9]*;
+    _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE1[568-9]*;
     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE2at*;
     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE3end*;
     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE4back*;

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

* Re: [PATCH] Export explicit instantiations for C++17 members of std::string
  2019-01-06 17:00 ` Rainer Orth
@ 2019-01-06 17:18   ` Jonathan Wakely
  2019-01-06 17:25     ` Jonathan Wakely
  2019-01-08 12:08     ` Rainer Orth
  0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Wakely @ 2019-01-06 17:18 UTC (permalink / raw)
  To: Rainer Orth; +Cc: libstdc++, gcc-patches

On 06/01/19 17:59 +0100, Rainer Orth wrote:
>Hi Jonathan,
>
>> The C++17 standard added some new members to std::basic_string, which
>> were not previously instantiated in the library. This meant that the
>> extern template declarations had to be disabled for C++17 mode. With
>> this patch the new members are instantiated in the library and so the
>> explicit instantiation declarations can be used for C++17.
>>
>> The new members added by C++2a are still not exported, and so the
>> explicit instantiation declarations are still disabled for C++2a.
>>
>> 	* config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Make patterns less greedy
>> 	for const member functions of std::basic_string.
>> 	(GLIBCXX_3.4.26): Export member functions of std::basic_string added
>> 	in C++17.
>> 	* include/bits/basic_string.h (basic_string(__sv_wrapper, const A&)):
>> 	Make non-standard constructor private.
>> 	[!_GLIBCXX_USE_CXX11_ABI] (basic_string(__sv_wrapper, const A&)):
>> 	Likewise.
>> 	* include/bits/basic_string.tcc (std::string, std::wstring): Declare
>> 	explicit instantiations for C++17 as well as earlier dialects.
>> 	* src/c++17/Makefile.am: Add new source files.
>> 	* src/c++17/Makefile.in: Regenerate.
>> 	* src/c++17/cow-string-inst.cc: New file defining explicit
>> 	instantiations for basic_string member functions added in C++17.
>> 	* src/c++17/string-inst.cc: Likewise.
>>
>> Tested powerpc64le-linux, committed to trunk.
>
>this patch broke Solaris bootstrap:
>
>ld: fatal: libstdc++-symbols.ver-sun: 6705: symbol 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator std::basic_string_view<char, std::char_traits<char> >() const': symbol version conflict
>ld: fatal: libstdc++-symbols.ver-sun: 6707: symbol 'std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::operator std::basic_string_view<wchar_t, std::char_traits<wchar_t> >() const': symbol version conflict
>ld: fatal: libstdc++-symbols.ver-sun: 6712: symbol 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::data()': symbol version conflict
>ld: fatal: libstdc++-symbols.ver-sun: 6714: symbol 'std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::data()': symbol version conflict
>ld: fatal: libstdc++-symbols.ver-sun: 6723: symbol 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_to_string_view(std::basic_string_view<char, std::char_traits<char> >)': symbol version conflict
>ld: fatal: libstdc++-symbols.ver-sun: 6724: symbol 'std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_S_to_string_view(std::basic_string_view<wchar_t, std::char_traits<wchar_t> >)': symbol version conflict
>collect2: error: ld returned 1 exit status
>make[6]: *** [Makefile:696: libstdc++.la] Error 1

Sorry :-(

[...]

>The following patch allowed the build to finish.

OK for trunk, thanks.

I'll make sure to run my script to check for such conflicts before
adding any more symbols.

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

* Re: [PATCH] Export explicit instantiations for C++17 members of std::string
  2019-01-06 17:18   ` Jonathan Wakely
@ 2019-01-06 17:25     ` Jonathan Wakely
  2019-01-08 12:08     ` Rainer Orth
  1 sibling, 0 replies; 5+ messages in thread
From: Jonathan Wakely @ 2019-01-06 17:25 UTC (permalink / raw)
  To: Rainer Orth; +Cc: libstdc++, gcc-patches

On 06/01/19 17:18 +0000, Jonathan Wakely wrote:
>On 06/01/19 17:59 +0100, Rainer Orth wrote:
>>Hi Jonathan,
>>
>>>The C++17 standard added some new members to std::basic_string, which
>>>were not previously instantiated in the library. This meant that the
>>>extern template declarations had to be disabled for C++17 mode. With
>>>this patch the new members are instantiated in the library and so the
>>>explicit instantiation declarations can be used for C++17.
>>>
>>>The new members added by C++2a are still not exported, and so the
>>>explicit instantiation declarations are still disabled for C++2a.
>>>
>>>	* config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Make patterns less greedy
>>>	for const member functions of std::basic_string.
>>>	(GLIBCXX_3.4.26): Export member functions of std::basic_string added
>>>	in C++17.
>>>	* include/bits/basic_string.h (basic_string(__sv_wrapper, const A&)):
>>>	Make non-standard constructor private.
>>>	[!_GLIBCXX_USE_CXX11_ABI] (basic_string(__sv_wrapper, const A&)):
>>>	Likewise.
>>>	* include/bits/basic_string.tcc (std::string, std::wstring): Declare
>>>	explicit instantiations for C++17 as well as earlier dialects.
>>>	* src/c++17/Makefile.am: Add new source files.
>>>	* src/c++17/Makefile.in: Regenerate.
>>>	* src/c++17/cow-string-inst.cc: New file defining explicit
>>>	instantiations for basic_string member functions added in C++17.
>>>	* src/c++17/string-inst.cc: Likewise.
>>>
>>>Tested powerpc64le-linux, committed to trunk.
>>
>>this patch broke Solaris bootstrap:
>>
>>ld: fatal: libstdc++-symbols.ver-sun: 6705: symbol 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator std::basic_string_view<char, std::char_traits<char> >() const': symbol version conflict
>>ld: fatal: libstdc++-symbols.ver-sun: 6707: symbol 'std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::operator std::basic_string_view<wchar_t, std::char_traits<wchar_t> >() const': symbol version conflict
>>ld: fatal: libstdc++-symbols.ver-sun: 6712: symbol 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::data()': symbol version conflict
>>ld: fatal: libstdc++-symbols.ver-sun: 6714: symbol 'std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::data()': symbol version conflict
>>ld: fatal: libstdc++-symbols.ver-sun: 6723: symbol 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_to_string_view(std::basic_string_view<char, std::char_traits<char> >)': symbol version conflict
>>ld: fatal: libstdc++-symbols.ver-sun: 6724: symbol 'std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_S_to_string_view(std::basic_string_view<wchar_t, std::char_traits<wchar_t> >)': symbol version conflict
>>collect2: error: ld returned 1 exit status
>>make[6]: *** [Makefile:696: libstdc++.la] Error 1
>
>Sorry :-(
>
>[...]
>
>>The following patch allowed the build to finish.
>
>OK for trunk, thanks.
>
>I'll make sure to run my script to check for such conflicts before
>adding any more symbols.


The good news is that even with my soon-to-be-committed changes, I
only see the same problems you already found:

Symbol matches more than one version:
_ZNKSbIwSt11char_traitsIwESaIwEEcvSt17basic_string_viewIwS0_EEv
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::operator std::basic_string_view<wchar_t, std::char_traits<wchar_t> >() const
  GLIBCXX_3.4        _ZNKSbIwSt11char_traitsIwESaIwEE[a-z]* (line 327)
  GLIBCXX_3.4.26     _ZNKSbIwSt11char_traitsIwESaIwEEcvSt17basic_string_viewIwS0_EEv (line 2098)

Symbol matches more than one version:
_ZNKSscvSt17basic_string_viewIcSt11char_traitsIcEEEv
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator std::basic_string_view<char, std::char_traits<char> >() const
  GLIBCXX_3.4        _ZNKSs[a-z]* (line 261)
  GLIBCXX_3.4.26     _ZNKSscvSt17basic_string_viewIcSt11char_traitsIcEEEv (line 2097)

Symbol matches more than one version:
_ZNSbIwSt11char_traitsIwESaIwEE4dataEv
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::data()
  GLIBCXX_3.4        _ZNSbIwSt11char_traitsIwESaIwEE[0-58-9][c-e]* (line 287)
  GLIBCXX_3.4.26     _ZNSbIwSt11char_traitsIwESaIwEE4dataEv (line 2102)

Symbol matches more than one version:
_ZNSs4dataEv
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::data()
  GLIBCXX_3.4        _ZNSs[0-58-9][c-e]* (line 220)
  GLIBCXX_3.4.26     _ZNSs4dataEv (line 2101)

Symbol matches more than one version:
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE17_S_to_string_viewESt17basic_string_viewIcS2_E
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_to_string_view(std::basic_string_view<char, std::char_traits<char> >)
  GLIBCXX_3.4.21     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE1[5-9]* (line 1720)
  GLIBCXX_3.4.26     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE17_S_to_string_viewESt17basic_string_viewI[cw]S2_E (line 2107)

Symbol matches more than one version:
_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE17_S_to_string_viewESt17basic_string_viewIwS2_E
std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_S_to_string_view(std::basic_string_view<wchar_t, std::char_traits<wchar_t> >)
  GLIBCXX_3.4.21     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE1[5-9]* (line 1720)
  GLIBCXX_3.4.26     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE17_S_to_string_viewESt17basic_string_viewI[cw]S2_E (line 2107)


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

* Re: [PATCH] Export explicit instantiations for C++17 members of std::string
  2019-01-06 17:18   ` Jonathan Wakely
  2019-01-06 17:25     ` Jonathan Wakely
@ 2019-01-08 12:08     ` Rainer Orth
  1 sibling, 0 replies; 5+ messages in thread
From: Rainer Orth @ 2019-01-08 12:08 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

Hi Jonathan,

> On 06/01/19 17:59 +0100, Rainer Orth wrote:
>>Hi Jonathan,
>>
>>> The C++17 standard added some new members to std::basic_string, which
>>> were not previously instantiated in the library. This meant that the
>>> extern template declarations had to be disabled for C++17 mode. With
>>> this patch the new members are instantiated in the library and so the
>>> explicit instantiation declarations can be used for C++17.
>>>
>>> The new members added by C++2a are still not exported, and so the
>>> explicit instantiation declarations are still disabled for C++2a.
>>>
>>> 	* config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Make patterns less greedy
>>> 	for const member functions of std::basic_string.
>>> 	(GLIBCXX_3.4.26): Export member functions of std::basic_string added
>>> 	in C++17.
>>> 	* include/bits/basic_string.h (basic_string(__sv_wrapper, const A&)):
>>> 	Make non-standard constructor private.
>>> 	[!_GLIBCXX_USE_CXX11_ABI] (basic_string(__sv_wrapper, const A&)):
>>> 	Likewise.
>>> 	* include/bits/basic_string.tcc (std::string, std::wstring): Declare
>>> 	explicit instantiations for C++17 as well as earlier dialects.
>>> 	* src/c++17/Makefile.am: Add new source files.
>>> 	* src/c++17/Makefile.in: Regenerate.
>>> 	* src/c++17/cow-string-inst.cc: New file defining explicit
>>> 	instantiations for basic_string member functions added in C++17.
>>> 	* src/c++17/string-inst.cc: Likewise.
>>>
>>> Tested powerpc64le-linux, committed to trunk.
>>
>>this patch broke Solaris bootstrap:
>>
>>ld: fatal: libstdc++-symbols.ver-sun: 6705: symbol
>> 'std::basic_string<char, std::char_traits<char>, std::allocator<char>
>> >::operator std::basic_string_view<char, std::char_traits<char> >()
>> const': symbol version conflict
>>ld: fatal: libstdc++-symbols.ver-sun: 6707: symbol
>> 'std::basic_string<wchar_t, std::char_traits<wchar_t>,
>> std::allocator<wchar_t> >::operator std::basic_string_view<wchar_t,
>> std::char_traits<wchar_t> >() const': symbol version conflict
>>ld: fatal: libstdc++-symbols.ver-sun: 6712: symbol
>> 'std::basic_string<char, std::char_traits<char>, std::allocator<char>
>> >::data()': symbol version conflict
>>ld: fatal: libstdc++-symbols.ver-sun: 6714: symbol
>> 'std::basic_string<wchar_t, std::char_traits<wchar_t>,
>> std::allocator<wchar_t> >::data()': symbol version conflict
>>ld: fatal: libstdc++-symbols.ver-sun: 6723: symbol
>> 'std::__cxx11::basic_string<char, std::char_traits<char>,
>> std::allocator<char> >::_S_to_string_view(std::basic_string_view<char,
>> std::char_traits<char> >)': symbol version conflict
>>ld: fatal: libstdc++-symbols.ver-sun: 6724: symbol
>> 'std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>,
>> std::allocator<wchar_t>
>> >::_S_to_string_view(std::basic_string_view<wchar_t,
>> std::char_traits<wchar_t> >)': symbol version conflict
>>collect2: error: ld returned 1 exit status
>>make[6]: *** [Makefile:696: libstdc++.la] Error 1
>
> Sorry :-(
>
> [...]
>
>>The following patch allowed the build to finish.
>
> OK for trunk, thanks.

installed now with the following ChangeLog entry:

2019-01-07  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* config/abi/pre/gnu.ver (GLIBCXX_3.4): Tighten existing patterns.
	(GLIBCXX_3.4.21): Likewise.

> I'll make sure to run my script to check for such conflicts before
> adding any more symbols.

Thanks for double-checking.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

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

end of thread, other threads:[~2019-01-08 12:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-04 23:24 [PATCH] Export explicit instantiations for C++17 members of std::string Jonathan Wakely
2019-01-06 17:00 ` Rainer Orth
2019-01-06 17:18   ` Jonathan Wakely
2019-01-06 17:25     ` Jonathan Wakely
2019-01-08 12:08     ` Rainer Orth

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).