public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Extend aligned_membuf<> usage
@ 2018-02-01 21:48 François Dumont
  2018-02-05 17:16 ` Jonathan Wakely
  0 siblings, 1 reply; 6+ messages in thread
From: François Dumont @ 2018-02-01 21:48 UTC (permalink / raw)
  To: libstdc++, gcc-patches

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

Hi

     As we just bump version namespace it might be interesting to do the 
following change now. What do you think ?

François


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

diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h
index 56b3ac5..05abd43 100644
--- a/libstdc++-v3/include/bits/forward_list.h
+++ b/libstdc++-v3/include/bits/forward_list.h
@@ -116,7 +116,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       {
 	_Fwd_list_node() = default;
 
+#if _GLIBCXX_INLINE_VERSION
+	__gnu_cxx::__aligned_membuf<_Tp> _M_storage;
+#else
 	__gnu_cxx::__aligned_buffer<_Tp> _M_storage;
+#endif
 
 	_Tp*
 	_M_valptr() noexcept
diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
index 3ff6b14..222a1b2 100644
--- a/libstdc++-v3/include/bits/hashtable_policy.h
+++ b/libstdc++-v3/include/bits/hashtable_policy.h
@@ -231,7 +231,11 @@ namespace __detail
     {
       typedef _Value value_type;
 
+#if _GLIBCXX_INLINE_VERSION
+      __gnu_cxx::__aligned_membuf<_Value> _M_storage;
+#else
       __gnu_cxx::__aligned_buffer<_Value> _M_storage;
+#endif
 
       _Value*
       _M_valptr() noexcept
@@ -1516,7 +1520,11 @@ namespace __detail
   template<typename _Tp, bool _IsEmpty = std::is_empty<_Tp>::value>
     struct _Hash_code_storage
     {
+#if _GLIBCXX_INLINE_VERSION
+      __gnu_cxx::__aligned_membuf<_Tp> _M_storage;
+#else
       __gnu_cxx::__aligned_buffer<_Tp> _M_storage;
+#endif
 
       _Tp*
       _M_h() { return _M_storage._M_ptr(); }
diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index b58273a..8e00f1b 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -534,7 +534,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 	_Alloc& _M_alloc() noexcept { return _A_base::_S_get(*this); }
 
+#if _GLIBCXX_INLINE_VERSION
+	__gnu_cxx::__aligned_membuf<_Tp> _M_storage;
+#else
 	__gnu_cxx::__aligned_buffer<_Tp> _M_storage;
+#endif
       };
 
     public:

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

* Re: Extend aligned_membuf<> usage
  2018-02-01 21:48 Extend aligned_membuf<> usage François Dumont
@ 2018-02-05 17:16 ` Jonathan Wakely
  2018-02-06 19:16   ` François Dumont
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2018-02-05 17:16 UTC (permalink / raw)
  To: François Dumont; +Cc: libstdc++, gcc-patches

On 01/02/18 22:48 +0100, François Dumont wrote:
>Hi
>
>    As we just bump version namespace it might be interesting to do 
>the following change now. What do you think ?

I'd rather not make the code harder to read in all those places just
for an optional mode that nobody uses.

Wouldn't it make more sense to simply make __aligned_buffer identical
to __aligned_membuf for the versioned-namespace? Then at least the
conditional code is only in one place.


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

* Re: Extend aligned_membuf<> usage
  2018-02-05 17:16 ` Jonathan Wakely
@ 2018-02-06 19:16   ` François Dumont
  2018-02-08  6:10     ` François Dumont
  0 siblings, 1 reply; 6+ messages in thread
From: François Dumont @ 2018-02-06 19:16 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

On 05/02/2018 18:16, Jonathan Wakely wrote:
> On 01/02/18 22:48 +0100, François Dumont wrote:
>> Hi
>>
>>     As we just bump version namespace it might be interesting to do 
>> the following change now. What do you think ?
>
> I'd rather not make the code harder to read in all those places just
> for an optional mode that nobody uses.
>

I just consider this mode as a nice way to track all abi changes that we 
will be able to commit one day when we decide an abi breaking change.

> Wouldn't it make more sense to simply make __aligned_buffer identical
> to __aligned_membuf for the versioned-namespace? Then at least the
> conditional code is only in one place.
>
Yes, __aligned_buffer is indeed not used, we could do that. I'll propose 
a patch to do so.

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

* Re: Extend aligned_membuf<> usage
  2018-02-06 19:16   ` François Dumont
@ 2018-02-08  6:10     ` François Dumont
  2018-02-20 19:59       ` Jonathan Wakely
  0 siblings, 1 reply; 6+ messages in thread
From: François Dumont @ 2018-02-08  6:10 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

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

On 06/02/2018 20:16, François Dumont wrote:
> On 05/02/2018 18:16, Jonathan Wakely wrote:
>> Wouldn't it make more sense to simply make __aligned_buffer identical
>> to __aligned_membuf for the versioned-namespace? Then at least the
>> conditional code is only in one place.
>>
> Yes, __aligned_buffer is indeed not used, we could do that. I'll 
> propose a patch to do so.
>
So here it is, ok to commit ?

François


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

diff --git a/libstdc++-v3/include/ext/aligned_buffer.h b/libstdc++-v3/include/ext/aligned_buffer.h
index 94a2ff0..81fb797 100644
--- a/libstdc++-v3/include/ext/aligned_buffer.h
+++ b/libstdc++-v3/include/ext/aligned_buffer.h
@@ -75,6 +75,10 @@ namespace __gnu_cxx
       { return static_cast<const _Tp*>(_M_addr()); }
     };
 
+#if _GLIBCXX_INLINE_VERSION
+  template<typename _Tp>
+    using __aligned_buffer = __aligned_membuf<_Tp>;
+#else
   // Similar to __aligned_membuf but aligned for complete objects, not members.
   // This type is used in <forward_list>, <future>, <bits/shared_ptr_base.h>
   // and <bits/hashtable_policy.h>, but ideally they would use __aligned_membuf
@@ -113,6 +117,7 @@ namespace __gnu_cxx
       _M_ptr() const noexcept
       { return static_cast<const _Tp*>(_M_addr()); }
     };
+#endif
 
 } // namespace
 

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

* Re: Extend aligned_membuf<> usage
  2018-02-08  6:10     ` François Dumont
@ 2018-02-20 19:59       ` Jonathan Wakely
  2018-02-20 21:00         ` François Dumont
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2018-02-20 19:59 UTC (permalink / raw)
  To: François Dumont; +Cc: Jonathan Wakely, libstdc++, gcc-patches

On 8 February 2018 at 06:10, François Dumont wrote:
> On 06/02/2018 20:16, François Dumont wrote:
>>
>> On 05/02/2018 18:16, Jonathan Wakely wrote:
>>>
>>> Wouldn't it make more sense to simply make __aligned_buffer identical
>>> to __aligned_membuf for the versioned-namespace? Then at least the
>>> conditional code is only in one place.
>>>
>> Yes, __aligned_buffer is indeed not used, we could do that. I'll propose a
>> patch to do so.
>>
> So here it is, ok to commit ?

OK, because it only affects the gnu-versioned-namespace mode.

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

* Re: Extend aligned_membuf<> usage
  2018-02-20 19:59       ` Jonathan Wakely
@ 2018-02-20 21:00         ` François Dumont
  0 siblings, 0 replies; 6+ messages in thread
From: François Dumont @ 2018-02-20 21:00 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Jonathan Wakely, libstdc++, gcc-patches

On 20/02/2018 20:59, Jonathan Wakely wrote:
> On 8 February 2018 at 06:10, François Dumont wrote:
>> On 06/02/2018 20:16, François Dumont wrote:
>>> On 05/02/2018 18:16, Jonathan Wakely wrote:
>>>> Wouldn't it make more sense to simply make __aligned_buffer identical
>>>> to __aligned_membuf for the versioned-namespace? Then at least the
>>>> conditional code is only in one place.
>>>>
>>> Yes, __aligned_buffer is indeed not used, we could do that. I'll propose a
>>> patch to do so.
>>>
>> So here it is, ok to commit ?
> OK, because it only affects the gnu-versioned-namespace mode.
>
Ok, done now.

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

end of thread, other threads:[~2018-02-20 21:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01 21:48 Extend aligned_membuf<> usage François Dumont
2018-02-05 17:16 ` Jonathan Wakely
2018-02-06 19:16   ` François Dumont
2018-02-08  6:10     ` François Dumont
2018-02-20 19:59       ` Jonathan Wakely
2018-02-20 21:00         ` 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).