mirror of git://gcc.gnu.org/git/gcc.git
Add __attribute__((malloc) to allocator and remove unused code
* include/bits/valarray_array.h (__valarray_get_memory): Remove. (__valarray_get_storage): Call operator new directly. Remove ignored top-level restrict qualifier and add malloc attribute instead. (_Array<_Tp>::_Array(size_t)): Remove unused constructor. From-SVN: r260230
This commit is contained in:
parent
6bfbebb063
commit
cd2f262b2f
|
|
@ -1,5 +1,10 @@
|
||||||
2018-05-14 Jonathan Wakely <jwakely@redhat.com>
|
2018-05-14 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
* include/bits/valarray_array.h (__valarray_get_memory): Remove.
|
||||||
|
(__valarray_get_storage): Call operator new directly. Remove ignored
|
||||||
|
top-level restrict qualifier and add malloc attribute instead.
|
||||||
|
(_Array<_Tp>::_Array(size_t)): Remove unused constructor.
|
||||||
|
|
||||||
PR libstdc++/67554
|
PR libstdc++/67554
|
||||||
* include/bits/valarray_array.h (_Array_copy_ctor<_Tp, true>)
|
* include/bits/valarray_array.h (_Array_copy_ctor<_Tp, true>)
|
||||||
(_Array_copier<_Tp, true>): Do not pass null pointers to memcpy.
|
(_Array_copier<_Tp, true>): Do not pass null pointers to memcpy.
|
||||||
|
|
|
||||||
|
|
@ -47,18 +47,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
// Helper functions on raw pointers
|
// Helper functions on raw pointers
|
||||||
//
|
//
|
||||||
|
|
||||||
// We get memory by the old fashion way
|
// We get memory the old fashioned way
|
||||||
inline void*
|
template<typename _Tp>
|
||||||
__valarray_get_memory(size_t __n)
|
_Tp*
|
||||||
{ return operator new(__n); }
|
__valarray_get_storage(size_t) __attribute__((__malloc__));
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
inline _Tp*__restrict__
|
inline _Tp*
|
||||||
__valarray_get_storage(size_t __n)
|
__valarray_get_storage(size_t __n)
|
||||||
{
|
{ return static_cast<_Tp*>(operator new(__n * sizeof(_Tp))); }
|
||||||
return static_cast<_Tp*__restrict__>
|
|
||||||
(std::__valarray_get_memory(__n * sizeof(_Tp)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return memory to the system
|
// Return memory to the system
|
||||||
inline void
|
inline void
|
||||||
|
|
@ -410,7 +407,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
struct _Array
|
struct _Array
|
||||||
{
|
{
|
||||||
explicit _Array(size_t);
|
|
||||||
explicit _Array(_Tp* const __restrict__);
|
explicit _Array(_Tp* const __restrict__);
|
||||||
explicit _Array(const valarray<_Tp>&);
|
explicit _Array(const valarray<_Tp>&);
|
||||||
_Array(const _Tp* __restrict__, size_t);
|
_Array(const _Tp* __restrict__, size_t);
|
||||||
|
|
@ -503,12 +499,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
__dst._M_data, __j._M_data);
|
__dst._M_data, __j._M_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp>
|
|
||||||
inline
|
|
||||||
_Array<_Tp>::_Array(size_t __n)
|
|
||||||
: _M_data(__valarray_get_storage<_Tp>(__n))
|
|
||||||
{ std::__valarray_default_construct(_M_data, _M_data + __n); }
|
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
inline
|
inline
|
||||||
_Array<_Tp>::_Array(_Tp* const __restrict__ __p)
|
_Array<_Tp>::_Array(_Tp* const __restrict__ __p)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue