PR libstdc++/89090 avoid C++17 features in C++11/C++14 code
Although GCC and Clang both allow these features pre-C++17 in system headers, Clang does issue warnings with -Wsystem-headers. It can also complicate bisection and/or testcase reduction if # line markers are stripped, because the code won't be known to come from system headers. PR libstdc++/89090 * include/bits/stl_uninitialized.h (__relocate_a_1): Make unused parameter unnamed. Add message to static assertion. * include/bits/vector.tcc (vector::reserve, vector::_M_realloc_insert) (vector::_M_default_append): Use _GLIBCXX17_CONSTEXPR for if constexpr in C++11 code. From-SVN: r268536
This commit is contained in:
parent
e4b52fcaf5
commit
2781287255
|
@ -1,3 +1,12 @@
|
|||
2019-02-05 Jonathan Wakely <jwakely@redhat.com>
|
||||
|
||||
PR libstdc++/89090
|
||||
* include/bits/stl_uninitialized.h (__relocate_a_1): Make unused
|
||||
parameter unnamed. Add message to static assertion.
|
||||
* include/bits/vector.tcc (vector::reserve, vector::_M_realloc_insert)
|
||||
(vector::_M_default_append): Use _GLIBCXX17_CONSTEXPR for if constexpr
|
||||
in C++11 code.
|
||||
|
||||
2019-02-05 Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
PR libstdc++/87106
|
||||
|
|
|
@ -904,7 +904,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
template <typename _Tp, typename _Up>
|
||||
inline __enable_if_t<std::__is_bitwise_relocatable<_Tp>::value, _Tp*>
|
||||
__relocate_a_1(_Tp* __first, _Tp* __last,
|
||||
_Tp* __result, allocator<_Up>& __alloc) noexcept
|
||||
_Tp* __result, allocator<_Up>&) noexcept
|
||||
{
|
||||
ptrdiff_t __count = __last - __first;
|
||||
if (__count > 0)
|
||||
|
@ -925,7 +925,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
_ValueType;
|
||||
typedef typename iterator_traits<_ForwardIterator>::value_type
|
||||
_ValueType2;
|
||||
static_assert(std::is_same<_ValueType, _ValueType2>::value);
|
||||
static_assert(std::is_same<_ValueType, _ValueType2>::value,
|
||||
"relocation is only possible for values of the same type");
|
||||
_ForwardIterator __cur = __result;
|
||||
for (; __first != __last; ++__first, (void)++__cur)
|
||||
std::__relocate_object_a(std::__addressof(*__cur),
|
||||
|
|
|
@ -73,7 +73,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
const size_type __old_size = size();
|
||||
pointer __tmp;
|
||||
#if __cplusplus >= 201103L
|
||||
if constexpr (_S_use_relocate())
|
||||
if _GLIBCXX17_CONSTEXPR (_S_use_relocate())
|
||||
{
|
||||
__tmp = this->_M_allocate(__n);
|
||||
std::__relocate_a(this->_M_impl._M_start,
|
||||
|
@ -457,7 +457,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
__new_finish = pointer();
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
if constexpr (_S_use_relocate())
|
||||
if _GLIBCXX17_CONSTEXPR (_S_use_relocate())
|
||||
{
|
||||
__new_finish
|
||||
= std::__relocate_a
|
||||
|
@ -498,7 +498,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
__throw_exception_again;
|
||||
}
|
||||
#if __cplusplus >= 201103L
|
||||
if constexpr (!_S_use_relocate())
|
||||
if _GLIBCXX17_CONSTEXPR (!_S_use_relocate())
|
||||
#endif
|
||||
std::_Destroy(__old_start, __old_finish, _M_get_Tp_allocator());
|
||||
_GLIBCXX_ASAN_ANNOTATE_REINIT;
|
||||
|
@ -638,8 +638,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
const size_type __len =
|
||||
_M_check_len(__n, "vector::_M_default_append");
|
||||
pointer __new_start(this->_M_allocate(__len));
|
||||
#if __cplusplus >= 201103L
|
||||
if constexpr (_S_use_relocate())
|
||||
if _GLIBCXX17_CONSTEXPR (_S_use_relocate())
|
||||
{
|
||||
__try
|
||||
{
|
||||
|
@ -656,7 +655,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
__new_start, _M_get_Tp_allocator());
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
pointer __destroy_from = pointer();
|
||||
__try
|
||||
|
|
Loading…
Reference in New Issue