diff options
author | Jason Merrill <jason@redhat.com> | 2018-05-18 16:02:14 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2018-05-18 16:02:14 -0400 |
commit | f07c22376848e9923aa8455d2c0a059d9d0e01d5 (patch) | |
tree | 06ecc73f75acf598f7943b6ed86b6357e68cbdba | |
parent | 1261e77e53cb834ad5aedfe185acd37a2511292a (diff) | |
download | gcc-f07c22376848e9923aa8455d2c0a059d9d0e01d5.zip gcc-f07c22376848e9923aa8455d2c0a059d9d0e01d5.tar.gz gcc-f07c22376848e9923aa8455d2c0a059d9d0e01d5.tar.bz2 |
Some libstdc++ fixes for -Wdeprecated-copy.
* include/bits/stl_deque.h (_Deque_iterator): Constrain constructor
for conversion to const_iterator. Add defaulted copy ops.
* libsupc++/new (bad_alloc): Add defaulted copy ops.
* libsupc++/exception.h (exception): Add defaulted copy ops.
* include/std/system_error (system_error): Add defaulted copy ops.
* include/std/stdexcept (domain_error, invalid_argument)
(length_error, out_of_range, range_error, overflow_error)
(underflow_error): Add defaulted copy ops.
* include/bits/stl_iterator.h (reverse_iterator): Add defaulted
copy assignment.
* include/bits/allocator.h (allocator): Add defaulted copy assignment.
* include/ext/throw_allocator.h (condition_base): Add defaulted
default and copy ctor and copy assignment.
From-SVN: r260380
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/Wattributes1.C | 2 | ||||
-rw-r--r-- | libstdc++-v3/ChangeLog | 16 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/allocator.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_deque.h | 14 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_iterator.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/ext/throw_allocator.h | 5 | ||||
-rw-r--r-- | libstdc++-v3/include/std/stdexcept | 14 | ||||
-rw-r--r-- | libstdc++-v3/include/std/system_error | 5 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/exception.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/new | 5 |
10 files changed, 72 insertions, 1 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wattributes1.C b/gcc/testsuite/g++.dg/cpp0x/Wattributes1.C index b0a1e86..b1c48d4 100644 --- a/gcc/testsuite/g++.dg/cpp0x/Wattributes1.C +++ b/gcc/testsuite/g++.dg/cpp0x/Wattributes1.C @@ -5,4 +5,4 @@ #include <new> __attribute__((visibility("hidden")))void*operator new(std::size_t); // { dg-warning "visibility attribute ignored" } -// { dg-message "previous declaration" "" { target *-*-* } 120 } +// { dg-message "previous declaration" "" { target *-*-* } 125 } diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2ccf585..c4e10f1 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,19 @@ +2018-05-18 Jason Merrill <jason@redhat.com> + + * include/bits/stl_deque.h (_Deque_iterator): Constrain constructor + for conversion to const_iterator. Add defaulted copy ops. + * libsupc++/new (bad_alloc): Add defaulted copy ops. + * libsupc++/exception.h (exception): Add defaulted copy ops. + * include/std/system_error (system_error): Add defaulted copy ops. + * include/std/stdexcept (domain_error, invalid_argument) + (length_error, out_of_range, range_error, overflow_error) + (underflow_error): Add defaulted copy ops. + * include/bits/stl_iterator.h (reverse_iterator): Add defaulted + copy assignment. + * include/bits/allocator.h (allocator): Add defaulted copy assignment. + * include/ext/throw_allocator.h (condition_base): Add defaulted + default and copy ctor and copy assignment. + 2018-05-18 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/85098 diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h index 0a4eb55..2da499f 100644 --- a/libstdc++-v3/include/bits/allocator.h +++ b/libstdc++-v3/include/bits/allocator.h @@ -132,6 +132,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION allocator(const allocator& __a) throw() : __allocator_base<_Tp>(__a) { } +#if __cplusplus >= 201103L + // Avoid implicit deprecation. + allocator& operator=(const allocator&) = default; +#endif template<typename _Tp1> allocator(const allocator<_Tp1>&) throw() { } diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h index 0d4390b..58a01c8 100644 --- a/libstdc++-v3/include/bits/stl_deque.h +++ b/libstdc++-v3/include/bits/stl_deque.h @@ -149,9 +149,23 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _Deque_iterator() _GLIBCXX_NOEXCEPT : _M_cur(), _M_first(), _M_last(), _M_node() { } +#if __cplusplus < 201103L + // Conversion from iterator to const_iterator. _Deque_iterator(const iterator& __x) _GLIBCXX_NOEXCEPT : _M_cur(__x._M_cur), _M_first(__x._M_first), _M_last(__x._M_last), _M_node(__x._M_node) { } +#else + // Conversion from iterator to const_iterator. + template<typename _Iter, + typename = _Require<is_same<_Self, const_iterator>, + is_same<_Iter, iterator>>> + _Deque_iterator(const _Iter& __x) noexcept + : _M_cur(__x._M_cur), _M_first(__x._M_first), + _M_last(__x._M_last), _M_node(__x._M_node) { } + + _Deque_iterator(const _Deque_iterator&) = default; + _Deque_iterator& operator=(const _Deque_iterator&) = default; +#endif iterator _M_const_cast() const _GLIBCXX_NOEXCEPT diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index 750b0c0..0d5f20b 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -138,6 +138,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION reverse_iterator(const reverse_iterator& __x) : current(__x.current) { } +#if __cplusplus >= 201103L + reverse_iterator& operator=(const reverse_iterator&) = default; +#endif + /** * A %reverse_iterator across other types can be copied if the * underlying %iterator can be converted to the type of @c current. diff --git a/libstdc++-v3/include/ext/throw_allocator.h b/libstdc++-v3/include/ext/throw_allocator.h index 5d9caa2..7fd2ca1 100644 --- a/libstdc++-v3/include/ext/throw_allocator.h +++ b/libstdc++-v3/include/ext/throw_allocator.h @@ -402,6 +402,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ struct condition_base { +#if __cplusplus >= 201103L + condition_base() = default; + condition_base(const condition_base&) = default; + condition_base& operator=(const condition_base&) = default; +#endif virtual ~condition_base() { }; }; diff --git a/libstdc++-v3/include/std/stdexcept b/libstdc++-v3/include/std/stdexcept index ddc056f..5267e56 100644 --- a/libstdc++-v3/include/std/stdexcept +++ b/libstdc++-v3/include/std/stdexcept @@ -150,6 +150,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION explicit domain_error(const string& __arg) _GLIBCXX_TXN_SAFE; #if __cplusplus >= 201103L explicit domain_error(const char*) _GLIBCXX_TXN_SAFE; + domain_error(const domain_error&) = default; + domain_error& operator=(const domain_error&) = default; #endif virtual ~domain_error() _GLIBCXX_USE_NOEXCEPT; }; @@ -161,6 +163,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION explicit invalid_argument(const string& __arg) _GLIBCXX_TXN_SAFE; #if __cplusplus >= 201103L explicit invalid_argument(const char*) _GLIBCXX_TXN_SAFE; + invalid_argument(const invalid_argument&) = default; + invalid_argument& operator=(const invalid_argument&) = default; #endif virtual ~invalid_argument() _GLIBCXX_USE_NOEXCEPT; }; @@ -173,6 +177,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION explicit length_error(const string& __arg) _GLIBCXX_TXN_SAFE; #if __cplusplus >= 201103L explicit length_error(const char*) _GLIBCXX_TXN_SAFE; + length_error(const length_error&) = default; + length_error& operator=(const length_error&) = default; #endif virtual ~length_error() _GLIBCXX_USE_NOEXCEPT; }; @@ -185,6 +191,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION explicit out_of_range(const string& __arg) _GLIBCXX_TXN_SAFE; #if __cplusplus >= 201103L explicit out_of_range(const char*) _GLIBCXX_TXN_SAFE; + out_of_range(const out_of_range&) = default; + out_of_range& operator=(const out_of_range&) = default; #endif virtual ~out_of_range() _GLIBCXX_USE_NOEXCEPT; }; @@ -233,6 +241,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION explicit range_error(const string& __arg) _GLIBCXX_TXN_SAFE; #if __cplusplus >= 201103L explicit range_error(const char*) _GLIBCXX_TXN_SAFE; + range_error(const range_error&) = default; + range_error& operator=(const range_error&) = default; #endif virtual ~range_error() _GLIBCXX_USE_NOEXCEPT; }; @@ -244,6 +254,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION explicit overflow_error(const string& __arg) _GLIBCXX_TXN_SAFE; #if __cplusplus >= 201103L explicit overflow_error(const char*) _GLIBCXX_TXN_SAFE; + overflow_error(const overflow_error&) = default; + overflow_error& operator=(const overflow_error&) = default; #endif virtual ~overflow_error() _GLIBCXX_USE_NOEXCEPT; }; @@ -255,6 +267,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION explicit underflow_error(const string& __arg) _GLIBCXX_TXN_SAFE; #if __cplusplus >= 201103L explicit underflow_error(const char*) _GLIBCXX_TXN_SAFE; + underflow_error(const underflow_error&) = default; + underflow_error& operator=(const underflow_error&) = default; #endif virtual ~underflow_error() _GLIBCXX_USE_NOEXCEPT; }; diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error index 4918ef3..150ec02 100644 --- a/libstdc++-v3/include/std/system_error +++ b/libstdc++-v3/include/std/system_error @@ -364,6 +364,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : runtime_error(__what + ": " + error_code(__v, __ecat).message()), _M_code(__v, __ecat) { } +#if __cplusplus >= 201103L + system_error (const system_error &) = default; + system_error &operator= (const system_error &) = default; +#endif + virtual ~system_error() noexcept; const error_code& diff --git a/libstdc++-v3/libsupc++/exception.h b/libstdc++-v3/libsupc++/exception.h index 3f1111d..1adfe7c 100644 --- a/libstdc++-v3/libsupc++/exception.h +++ b/libstdc++-v3/libsupc++/exception.h @@ -62,6 +62,10 @@ namespace std public: exception() _GLIBCXX_USE_NOEXCEPT { } virtual ~exception() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT; +#if __cplusplus >= 201103L + exception(const exception&) = default; + exception& operator=(const exception&) = default; +#endif /** Returns a C-style character string describing the general cause * of the current error. */ diff --git a/libstdc++-v3/libsupc++/new b/libstdc++-v3/libsupc++/new index 99c769c..73483c8 100644 --- a/libstdc++-v3/libsupc++/new +++ b/libstdc++-v3/libsupc++/new @@ -56,6 +56,11 @@ namespace std public: bad_alloc() throw() { } +#if __cplusplus >= 201103L + bad_alloc(const bad_alloc&) = default; + bad_alloc& operator=(const bad_alloc&) = default; +#endif + // This declaration is not useless: // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 virtual ~bad_alloc() throw(); |