public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed 1/2] libstdc++: Export basic_stringbuf constructor [PR 97729]
@ 2020-11-05 18:01 Jonathan Wakely
  2020-11-05 18:03 ` [committed 1/2] libstdc++: Fix multiple definitions of std::exception_ptr functions " Jonathan Wakely
  2020-11-06 10:56 ` [committed 1/2] libstdc++: Export basic_stringbuf constructor " Rainer Orth
  0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Wakely @ 2020-11-05 18:01 UTC (permalink / raw)
  To: libstdc++, gcc-patches

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

libstdc++-v3/ChangeLog:

	PR libstdc++/97729
	* config/abi/pre/gnu.ver (GLIBCXX_3.4.29): Add exports.
	* src/c++20/sstream-inst.cc (basic_stringbuf): Instantiate
	private constructor taking __xfer_bufptrs.

Tested powerpc64le-linux. Committed to trunk.


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

commit 50b840ac5e1d6534e345c3fee9a97ae45ced6bc7
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Nov 5 13:41:40 2020

    libstdc++: Export basic_stringbuf constructor [PR 97729]
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/97729
            * config/abi/pre/gnu.ver (GLIBCXX_3.4.29): Add exports.
            * src/c++20/sstream-inst.cc (basic_stringbuf): Instantiate
            private constructor taking __xfer_bufptrs.

diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 707539a17c3a..ed68ffa28723 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -2346,6 +2346,7 @@ GLIBCXX_3.4.29 {
 
     # basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator const&)
     _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS4_RKS3_;
+    _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS4_RKS3_ONS4_14__xfer_bufptrsE;
 
     # basic_stringbuf::get_allocator()
     _ZNKSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE13get_allocatorEv;
diff --git a/libstdc++-v3/src/c++20/sstream-inst.cc b/libstdc++-v3/src/c++20/sstream-inst.cc
index ada3eabac1f5..7d275de5cc24 100644
--- a/libstdc++-v3/src/c++20/sstream-inst.cc
+++ b/libstdc++-v3/src/c++20/sstream-inst.cc
@@ -41,6 +41,9 @@ template basic_stringbuf<char>::basic_stringbuf(__string_type&&,
 						ios_base::openmode);
 template basic_stringbuf<char>::basic_stringbuf(basic_stringbuf&&,
 						const allocator_type&);
+template basic_stringbuf<char>::basic_stringbuf(basic_stringbuf&&,
+						const allocator_type&,
+						__xfer_bufptrs&&);
 template basic_stringbuf<char>::allocator_type
 basic_stringbuf<char>::get_allocator() const noexcept;
 template string_view
@@ -75,6 +78,9 @@ template basic_stringbuf<wchar_t>::basic_stringbuf(__string_type&&,
 						   ios_base::openmode);
 template basic_stringbuf<wchar_t>::basic_stringbuf(basic_stringbuf&&,
 						   const allocator_type&);
+template basic_stringbuf<wchar_t>::basic_stringbuf(basic_stringbuf&&,
+						   const allocator_type&,
+						   __xfer_bufptrs&&);
 template basic_stringbuf<wchar_t>::allocator_type
 basic_stringbuf<wchar_t>::get_allocator() const noexcept;
 

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

* Re: [committed 1/2] libstdc++: Fix multiple definitions of std::exception_ptr functions [PR 97729]
  2020-11-05 18:01 [committed 1/2] libstdc++: Export basic_stringbuf constructor [PR 97729] Jonathan Wakely
@ 2020-11-05 18:03 ` Jonathan Wakely
  2020-11-09 14:31   ` Jonathan Wakely
  2020-11-06 10:56 ` [committed 1/2] libstdc++: Export basic_stringbuf constructor " Rainer Orth
  1 sibling, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2020-11-05 18:03 UTC (permalink / raw)
  To: libstdc++, gcc-patches

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

This fixes some multiple definition errors caused by the changes for
PR libstdc++/90295. The previous solution for inlining the members of
std::exception_ptr but still exporting them from the library was to
suppress the 'inline' keyword on those functions when compiling
libsupc++/eh_ptr.cc, so they get defined in that file. That produces ODR
violations though, because there are now both inline and non-inline
definitions in the library, due to the use of std::exception_ptr in
other files sucg as src/c++11/future.cc.

The new solution is to define all the relevant members as 'inline'
unconditionally, but use __attribute__((used)) to cause definitions to
be emitted in libsupc++/eh_ptr.cc as before. This doesn't quite work
however, because PR c++/67453 means the attribute is ignored on
constructors and destructors. As a workaround, the old solution
(conditionally inline) is still used for those members, but they are
given the always_inline attribute so that they aren't emitted in
src/c++11/future.o as inline definitions.


Tested powerpc64le-linux. Committed to trunk.



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

commit 710508c7b1a2c8e1d75d4c4f1ac79473dbf2b2bb
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Nov 5 16:19:15 2020

    libstdc++: Fix multiple definitions of std::exception_ptr functions [PR 97729]
    
    This fixes some multiple definition errors caused by the changes for
    PR libstdc++/90295. The previous solution for inlining the members of
    std::exception_ptr but still exporting them from the library was to
    suppress the 'inline' keyword on those functions when compiling
    libsupc++/eh_ptr.cc, so they get defined in that file. That produces ODR
    violations though, because there are now both inline and non-inline
    definitions in the library, due to the use of std::exception_ptr in
    other files sucg as src/c++11/future.cc.
    
    The new solution is to define all the relevant members as 'inline'
    unconditionally, but use __attribute__((used)) to cause definitions to
    be emitted in libsupc++/eh_ptr.cc as before. This doesn't quite work
    however, because PR c++/67453 means the attribute is ignored on
    constructors and destructors. As a workaround, the old solution
    (conditionally inline) is still used for those members, but they are
    given the always_inline attribute so that they aren't emitted in
    src/c++11/future.o as inline definitions.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/97729
            * include/std/future (__basic_future::_M_get_result): Use
            nullptr for null pointer constant.
            * libsupc++/eh_ptr.cc (operator==, operator!=): Remove
            definitions.
            * libsupc++/exception_ptr.h (_GLIBCXX_EH_PTR_USED): Define
            macro to conditionally add __attribute__((__used__)).
            (operator==, operator!=, exception_ptr::exception_ptr())
            (exception_ptr::exception_ptr(const exception_ptr&))
            (exception_ptr::~exception_ptr())
            (exception_ptr::operator=(const exception_ptr&))
            (exception_ptr::swap(exception_ptr&)): Always define as
            inline. Add macro to be conditionally "used".

diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
index 3c2aaa1fab19..5d948018c75c 100644
--- a/libstdc++-v3/include/std/future
+++ b/libstdc++-v3/include/std/future
@@ -709,7 +709,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       {
         _State_base::_S_check(_M_state);
         _Result_base& __res = _M_state->wait();
-        if (!(__res._M_error == 0))
+        if (!(__res._M_error == nullptr))
           rethrow_exception(__res._M_error);
         return static_cast<__result_type>(__res);
       }
diff --git a/libstdc++-v3/libsupc++/eh_ptr.cc b/libstdc++-v3/libsupc++/eh_ptr.cc
index c41bdca234c7..7e6863550ce4 100644
--- a/libstdc++-v3/libsupc++/eh_ptr.cc
+++ b/libstdc++-v3/libsupc++/eh_ptr.cc
@@ -25,7 +25,12 @@
 #include <bits/c++config.h>
 #include "eh_atomics.h"
 
+#if ! _GLIBCXX_INLINE_VERSION
+// This macro causes exception_ptr to declare an older API (with corresponding
+// definitions in this file) and to mark some inline functions as "used" so
+// that definitions will be emitted in this translation unit.
 #define _GLIBCXX_EH_PTR_COMPAT
+#endif
 
 #include <exception>
 #include <bits/exception_ptr.h>
@@ -61,6 +66,8 @@ static_assert( adjptr<__cxa_exception>()
 #endif
 }
 
+// Define non-inline functions.
+
 std::__exception_ptr::exception_ptr::exception_ptr(void* obj) noexcept
 : _M_exception_object(obj)  { _M_addref(); }
 
@@ -130,19 +137,6 @@ std::__exception_ptr::exception_ptr::__cxa_exception_type() const noexcept
   return eh->exceptionType;
 }
 
-// Retained for compatibility with CXXABI_1.3.12.
-bool
-std::__exception_ptr::operator==(const exception_ptr& lhs,
-				 const exception_ptr& rhs) noexcept
-{ return lhs._M_exception_object == rhs._M_exception_object; }
-
-// Retained for compatibility with CXXABI_1.3.12.
-bool
-std::__exception_ptr::operator!=(const exception_ptr& lhs,
-				 const exception_ptr& rhs) noexcept
-{ return !(lhs == rhs); }
-
-
 std::exception_ptr
 std::current_exception() noexcept
 {
diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h
index 4497d0e8581b..001343ac0498 100644
--- a/libstdc++-v3/libsupc++/exception_ptr.h
+++ b/libstdc++-v3/libsupc++/exception_ptr.h
@@ -39,6 +39,12 @@
 #include <typeinfo>
 #include <new>
 
+#ifdef _GLIBCXX_EH_PTR_COMPAT
+# define _GLIBCXX_EH_PTR_USED __attribute__((__used__))
+#else
+# define _GLIBCXX_EH_PTR_USED
+#endif
+
 extern "C++" {
 
 namespace std 
@@ -146,20 +152,17 @@ namespace std
       { return _M_exception_object; }
 #endif
 
-#ifdef _GLIBCXX_EH_PTR_COMPAT
-      friend bool
-      operator==(const exception_ptr&, const exception_ptr&)
-	_GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
-#elif __cpp_impl_three_way_comparison >= 201907L
+#if __cpp_impl_three_way_comparison >= 201907L \
+      && ! defined _GLIBCXX_EH_PTR_COMPAT
       friend bool
       operator==(const exception_ptr&, const exception_ptr&) noexcept = default;
 #else
-      friend bool
+      friend _GLIBCXX_EH_PTR_USED bool
       operator==(const exception_ptr& __x, const exception_ptr& __y)
       _GLIBCXX_USE_NOEXCEPT
       { return __x._M_exception_object == __y._M_exception_object; }
 
-      friend bool
+      friend _GLIBCXX_EH_PTR_USED bool
       operator!=(const exception_ptr& __x, const exception_ptr& __y)
       _GLIBCXX_USE_NOEXCEPT
       { return __x._M_exception_object != __y._M_exception_object; }
@@ -170,25 +173,30 @@ namespace std
 	__attribute__ ((__pure__));
     };
 
-#ifndef _GLIBCXX_EH_PTR_COMPAT
+    _GLIBCXX_EH_PTR_USED
+#ifndef  _GLIBCXX_EH_PTR_COMPAT
+    __attribute__((__always_inline__)) // XXX see PR 97729
     inline
 #endif
     exception_ptr::exception_ptr() _GLIBCXX_NOEXCEPT
     : _M_exception_object(0)
     { }
 
-#ifndef _GLIBCXX_EH_PTR_COMPAT
+    _GLIBCXX_EH_PTR_USED
+#ifndef  _GLIBCXX_EH_PTR_COMPAT
+    __attribute__((__always_inline__))
     inline
 #endif
-    exception_ptr::exception_ptr(const exception_ptr& __other)
-      _GLIBCXX_NOEXCEPT
+    exception_ptr::exception_ptr(const exception_ptr& __other) _GLIBCXX_NOEXCEPT
     : _M_exception_object(__other._M_exception_object)
     {
       if (_M_exception_object)
 	_M_addref();
     }
 
-#ifndef _GLIBCXX_EH_PTR_COMPAT
+    _GLIBCXX_EH_PTR_USED
+#ifndef  _GLIBCXX_EH_PTR_COMPAT
+    __attribute__((__always_inline__))
     inline
 #endif
     exception_ptr::~exception_ptr() _GLIBCXX_USE_NOEXCEPT
@@ -197,20 +205,16 @@ namespace std
 	_M_release();
     }
 
-#ifndef _GLIBCXX_EH_PTR_COMPAT
-    inline
-#endif
-    exception_ptr&
+    _GLIBCXX_EH_PTR_USED
+    inline exception_ptr&
     exception_ptr::operator=(const exception_ptr& __other) _GLIBCXX_USE_NOEXCEPT
     {
       exception_ptr(__other).swap(*this);
       return *this;
     }
 
-#ifndef _GLIBCXX_EH_PTR_COMPAT
-    inline
-#endif
-    void
+    _GLIBCXX_EH_PTR_USED
+    inline void
     exception_ptr::swap(exception_ptr &__other) _GLIBCXX_USE_NOEXCEPT
     {
       void *__tmp = _M_exception_object;
@@ -218,16 +222,6 @@ namespace std
       __other._M_exception_object = __tmp;
     }
 
-#ifdef _GLIBCXX_EH_PTR_COMPAT
-    bool 
-    operator==(const exception_ptr&, const exception_ptr&)
-      _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
-
-    bool 
-    operator!=(const exception_ptr&, const exception_ptr&)
-      _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
-#endif
-
     /// @relates exception_ptr
     inline void
     swap(exception_ptr& __lhs, exception_ptr& __rhs)
@@ -276,6 +270,8 @@ namespace std
 #endif
     }
 
+#undef _GLIBCXX_EH_PTR_USED
+
   // @} group exceptions
 } // namespace std
 

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

* Re: [committed 1/2] libstdc++: Export basic_stringbuf constructor [PR 97729]
  2020-11-05 18:01 [committed 1/2] libstdc++: Export basic_stringbuf constructor [PR 97729] Jonathan Wakely
  2020-11-05 18:03 ` [committed 1/2] libstdc++: Fix multiple definitions of std::exception_ptr functions " Jonathan Wakely
@ 2020-11-06 10:56 ` Rainer Orth
  2020-11-06 20:15   ` Jonathan Wakely
  1 sibling, 1 reply; 5+ messages in thread
From: Rainer Orth @ 2020-11-06 10:56 UTC (permalink / raw)
  To: Jonathan Wakely via Gcc-patches; +Cc: libstdc++, Jonathan Wakely

Hi Jonathan,

> libstdc++-v3/ChangeLog:
>
> 	PR libstdc++/97729
> 	* config/abi/pre/gnu.ver (GLIBCXX_3.4.29): Add exports.
> 	* src/c++20/sstream-inst.cc (basic_stringbuf): Instantiate
> 	private constructor taking __xfer_bufptrs.
>
> Tested powerpc64le-linux. Committed to trunk.

unfortunately, this broke Solaris bootstrap again:

ld: fatal: libstdc++-symbols.ver-sun: 7314: symbol '_ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEC1EOS4_RKS3_ONS4_14__xfer_bufptrsE': symbol version conflict
ld: fatal: libstdc++-symbols.ver-sun: 7315: symbol '_ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEC2EOS4_RKS3_ONS4_14__xfer_bufptrsE': symbol version conflict
ld: fatal: libstdc++-symbols.ver-sun: 7316: symbol '_ZNSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEEC1EOS4_RKS3_ONS4_14__xfer_bufptrsE': symbol version conflict
ld: fatal: libstdc++-symbols.ver-sun: 7317: symbol '_ZNSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEEC2EOS4_RKS3_ONS4_14__xfer_bufptrsE': symbol version conflict

Those are matched by both

    ##_ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS4_RKS3_ONS4_14__xfer_bufptrsE (glob)

but also by the previous

    ##_ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]*__xfer_bufptrs* (glob)

I do have a hacky patch to avoid this, but I guess I best leave it to
you how to best tighten the previous pattern.

	Rainer

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

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

* Re: [committed 1/2] libstdc++: Export basic_stringbuf constructor [PR 97729]
  2020-11-06 10:56 ` [committed 1/2] libstdc++: Export basic_stringbuf constructor " Rainer Orth
@ 2020-11-06 20:15   ` Jonathan Wakely
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Wakely @ 2020-11-06 20:15 UTC (permalink / raw)
  To: Rainer Orth; +Cc: Jonathan Wakely via Gcc-patches, libstdc++

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

On 06/11/20 11:56 +0100, Rainer Orth wrote:
>Hi Jonathan,
>
>> libstdc++-v3/ChangeLog:
>>
>> 	PR libstdc++/97729
>> 	* config/abi/pre/gnu.ver (GLIBCXX_3.4.29): Add exports.
>> 	* src/c++20/sstream-inst.cc (basic_stringbuf): Instantiate
>> 	private constructor taking __xfer_bufptrs.
>>
>> Tested powerpc64le-linux. Committed to trunk.
>
>unfortunately, this broke Solaris bootstrap again:
>
>ld: fatal: libstdc++-symbols.ver-sun: 7314: symbol '_ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEC1EOS4_RKS3_ONS4_14__xfer_bufptrsE': symbol version conflict
>ld: fatal: libstdc++-symbols.ver-sun: 7315: symbol '_ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEC2EOS4_RKS3_ONS4_14__xfer_bufptrsE': symbol version conflict
>ld: fatal: libstdc++-symbols.ver-sun: 7316: symbol '_ZNSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEEC1EOS4_RKS3_ONS4_14__xfer_bufptrsE': symbol version conflict
>ld: fatal: libstdc++-symbols.ver-sun: 7317: symbol '_ZNSt7__cxx1115basic_stringbufIwSt11char_traitsIwESaIwEEC2EOS4_RKS3_ONS4_14__xfer_bufptrsE': symbol version conflict
>
>Those are matched by both
>
>    ##_ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS4_RKS3_ONS4_14__xfer_bufptrsE (glob)
>
>but also by the previous
>
>    ##_ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]*__xfer_bufptrs* (glob)
>
>I do have a hacky patch to avoid this, but I guess I best leave it to
>you how to best tighten the previous pattern.

It should be fixed at 887515acd27e49c176395ab76d5826959d89cb9b which
is the attached patch. Only tested on x86_64-linux, but my script no
longer shows the conflicts.

I'll try to incorporate that script into the testsuite for gcc-11, or
rewrite it as aprt of testsuite/util/testsuite_abi.cc



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

commit 887515acd27e49c176395ab76d5826959d89cb9b
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Nov 6 19:53:36 2020

    libstdc++: Fix symbol version conflict in linker script
    
    The change in r11-4748-50b840ac5e1d6534e345c3fee9a97ae45ced6bc7 causes
    a build error on Solaris, due to the new explicit instantiation matching
    patterns for two different symbol versions.
    
    libstdc++-v3/ChangeLog:
    
            * config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Tighten up patterns
            for basic_stringbuf that refer to __xfer_bufptrs.

diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index ed68ffa28723..2d0f87aa7cc7 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1774,7 +1774,8 @@ GLIBCXX_3.4.21 {
     _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]ERKNS_12basic_stringI[cw]S2_S3_EESt13_Ios_Openmode;
     _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]ESt13_Ios_Openmode;
     _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EED[012]Ev;
-    _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]*__xfer_bufptrs*;
+    _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS4_ONS4_14__xfer_bufptrsE;
+    _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]14__xfer_bufptrs[CD][12]*;
     _ZNSt7__cxx1115basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[a1346789]*;
 #   _ZNSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]*;
     _ZNSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS4_;

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

* Re: [committed 1/2] libstdc++: Fix multiple definitions of std::exception_ptr functions [PR 97729]
  2020-11-05 18:03 ` [committed 1/2] libstdc++: Fix multiple definitions of std::exception_ptr functions " Jonathan Wakely
@ 2020-11-09 14:31   ` Jonathan Wakely
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Wakely @ 2020-11-09 14:31 UTC (permalink / raw)
  To: libstdc++, gcc-patches

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

On 05/11/20 18:03 +0000, Jonathan Wakely wrote:
>This fixes some multiple definition errors caused by the changes for
>PR libstdc++/90295. The previous solution for inlining the members of
>std::exception_ptr but still exporting them from the library was to
>suppress the 'inline' keyword on those functions when compiling
>libsupc++/eh_ptr.cc, so they get defined in that file. That produces ODR
>violations though, because there are now both inline and non-inline
>definitions in the library, due to the use of std::exception_ptr in
>other files sucg as src/c++11/future.cc.
>
>The new solution is to define all the relevant members as 'inline'
>unconditionally, but use __attribute__((used)) to cause definitions to
>be emitted in libsupc++/eh_ptr.cc as before. This doesn't quite work
>however, because PR c++/67453 means the attribute is ignored on
>constructors and destructors. As a workaround, the old solution
>(conditionally inline) is still used for those members, but they are
>given the always_inline attribute so that they aren't emitted in
>src/c++11/future.o as inline definitions.

That workaround can be removed now.

Tested powerpc64le-linux. Committed to trunk.



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

commit 0af3930a497e022597a08fa1bcef5e453bfa636f
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Nov 9 10:16:07 2020

    libstdc++: Use 'inline' consistently in std::exception_ptr [PR 97729]
    
    With PR c++/67453 fixed we can rely on the 'used' attribute to emit
    inline constructors and destructors in libsupc++/eh_ptr.cc. This means
    we don't need to suppress the 'inline' keyword on them in that file, and
    don't need to force 'always_inline' on them in other files.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/97729
            * libsupc++/exception_ptr.h (exception_ptr::exception_ptr())
            (exception_ptr::exception_ptr(const exception_ptr&))
            (exception_ptr::~exception_ptr()): Remove 'always_inline'
            attributes. Use 'inline' unconditionally.

diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h
index 001343ac0498..6ae4d4ca944d 100644
--- a/libstdc++-v3/libsupc++/exception_ptr.h
+++ b/libstdc++-v3/libsupc++/exception_ptr.h
@@ -174,19 +174,13 @@ namespace std
     };
 
     _GLIBCXX_EH_PTR_USED
-#ifndef  _GLIBCXX_EH_PTR_COMPAT
-    __attribute__((__always_inline__)) // XXX see PR 97729
     inline
-#endif
     exception_ptr::exception_ptr() _GLIBCXX_NOEXCEPT
     : _M_exception_object(0)
     { }
 
     _GLIBCXX_EH_PTR_USED
-#ifndef  _GLIBCXX_EH_PTR_COMPAT
-    __attribute__((__always_inline__))
     inline
-#endif
     exception_ptr::exception_ptr(const exception_ptr& __other) _GLIBCXX_NOEXCEPT
     : _M_exception_object(__other._M_exception_object)
     {
@@ -195,10 +189,7 @@ namespace std
     }
 
     _GLIBCXX_EH_PTR_USED
-#ifndef  _GLIBCXX_EH_PTR_COMPAT
-    __attribute__((__always_inline__))
     inline
-#endif
     exception_ptr::~exception_ptr() _GLIBCXX_USE_NOEXCEPT
     {
       if (_M_exception_object)

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

end of thread, other threads:[~2020-11-09 14:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05 18:01 [committed 1/2] libstdc++: Export basic_stringbuf constructor [PR 97729] Jonathan Wakely
2020-11-05 18:03 ` [committed 1/2] libstdc++: Fix multiple definitions of std::exception_ptr functions " Jonathan Wakely
2020-11-09 14:31   ` Jonathan Wakely
2020-11-06 10:56 ` [committed 1/2] libstdc++: Export basic_stringbuf constructor " Rainer Orth
2020-11-06 20:15   ` Jonathan Wakely

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