diff options
author | Ulrich Drepper <drepper@redhat.com> | 2019-01-21 11:47:30 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@gcc.gnu.org> | 2019-01-21 11:47:30 +0000 |
commit | d715f5543117af088e6d8099806b266aa2dac047 (patch) | |
tree | 8a278f392e532b7d9a500a1ea59be3d154a5bd0e /libstdc++-v3/include/ext | |
parent | 91f1f6cd66d6b34c8938d11735708646a338e8d2 (diff) | |
download | gcc-d715f5543117af088e6d8099806b266aa2dac047.tar.gz |
Fix after P0600.
gcc/testsuite/ChangeLog
2019-02-20 Ulrich Drepper <drepper@redhat.com>
Fix after P0600.
* g++.dg/init/new39.C: Don't just ignore result of new.
libstdc++/ChangeLog
2019-02-20 Ulrich Drepper <drepper@redhat.com>
Implement C++20 P0600r1.
* include/backward/hash_map: Add nodiscard attribute to empty.
* include/backward/hash_set: Likewise.
* backward/hashtable.h: Likewise.
* include/bits/basic_string.h: Likewise.
* include/bits/forward_list.h: Likewise.
* include/bits/hashtable.h: Likewise.
* include/bits/regex.h: Likewise.
* include/bits/stl_deque.h: Likewise.
* include/bits/stl_list.h: Likewise.
* include/bits/stl_map.h: Likewise.
* include/bits/stl_multimap.h: Likewise.
* include/bits/stl_multiset.h: Likewise.
* include/bits/stl_queue.h: Likewise.
* include/bits/stl_set.h: Likewise.
* include/bits/stl_stack.h: Likewise.
* include/bits/stl_tree.h: Likewise.
* include/bits/stl_vector.h: Likewise.
* include/bits/unordered_map.h: Likewise.
* include/bits/unordered_set.h: Likewise.
* include/debug/array: Likewise.
* include/experimental/any: Likewise.
* include/experimental/bits/fs_path.h: Likewise.
* include/experimental/internet: Likewise.
* include/experimental/string_view: Likewise.
* include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp:
Likewise.
* include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp:
Likewise.
* include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp:
Likewise.
* include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp:
Likewise.
* include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp:
Likewise.
* include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp:
Likewise.
* include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp:
Likewise.
* include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp:
Likewise.
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp:
Likewise.
*
include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp:
Likewise.
* include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp:
Likewise.
* include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp:
Likewise.
* include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp:
Likewise.
* include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hp:
Likewise.
* include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp:
Likewise.
* include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp:
Likewise.
* include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp:
Likewise.
* include/ext/pb_ds/detail/tree_trace_base.hpp: Likewise.
* include/ext/pb_ds/trie_policy.hpp: Likewise.
* include/ext/rope: Likewise.
* include/ext/slist: Likewise.
* include/ext/vstring.h: Likewise.
* include/profile/array: Likewise.
* include/std/array: Likewise.
* include/tr1/array: Likewise.
* include/tr1/hashtable.h: Likewise.
* include/tr1/regex: Likewise.
* include/tr2/dynamic_bitset: Likewise.
* include/bits/alloc_traits.h: Add nodiscard attribute to
allocate.
* include/experimental/memory_resource: Likewise.
* include/ext/alloc_traits.h: Likewise.
* include/ext/array_allocator.h: Likewise.
* include/ext/bitmap_allocator.h: Likewise.
* include/ext/debug_allocator.h: Likewise.
* include/ext/extptr_allocator.h: Likewise.
* include/ext/mt_allocator.h: Likewise.
* include/ext/new_allocator.h: Likewise.
* include/ext/pool_allocator.h: Likewise.
* include/ext/throw_allocator.h: Likewise.
* include/std/scoped_allocator: Likewise.
* libsupc++/eh_alloc.cc: Likewise.
* include/std/future: Add nodiscard attribute to async.
* libsupc++/new: Add nodiscard attribute to new.
From-SVN: r268111
Diffstat (limited to 'libstdc++-v3/include/ext')
31 files changed, 38 insertions, 29 deletions
diff --git a/libstdc++-v3/include/ext/alloc_traits.h b/libstdc++-v3/include/ext/alloc_traits.h index 5571d2692fb..65fa3de271c 100644 --- a/libstdc++-v3/include/ext/alloc_traits.h +++ b/libstdc++-v3/include/ext/alloc_traits.h @@ -128,7 +128,7 @@ template<typename _Alloc, typename = typename _Alloc::value_type> typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; - static pointer + _GLIBCXX_NODISCARD static pointer allocate(_Alloc& __a, size_type __n) { return __a.allocate(__n); } diff --git a/libstdc++-v3/include/ext/array_allocator.h b/libstdc++-v3/include/ext/array_allocator.h index 6dd23cdbb82..c0d4a3497dc 100644 --- a/libstdc++-v3/include/ext/array_allocator.h +++ b/libstdc++-v3/include/ext/array_allocator.h @@ -151,7 +151,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ~array_allocator() _GLIBCXX_USE_NOEXCEPT { } - pointer + _GLIBCXX_NODISCARD pointer allocate(size_type __n, const void* = 0) { if (_M_array == 0 || _M_used + __n > _M_array->size()) diff --git a/libstdc++-v3/include/ext/bitmap_allocator.h b/libstdc++-v3/include/ext/bitmap_allocator.h index 400030bfbc5..532bad295b6 100644 --- a/libstdc++-v3/include/ext/bitmap_allocator.h +++ b/libstdc++-v3/include/ext/bitmap_allocator.h @@ -90,7 +90,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_space_left() const throw() { return _M_end_of_storage - _M_finish; } - pointer + _GLIBCXX_NODISCARD pointer allocate(size_type __n) { return static_cast<pointer>(::operator new(__n * sizeof(_Tp))); } @@ -1009,7 +1009,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ~bitmap_allocator() _GLIBCXX_USE_NOEXCEPT { } - pointer + _GLIBCXX_NODISCARD pointer allocate(size_type __n) { if (__n > this->max_size()) @@ -1033,7 +1033,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } } - pointer + _GLIBCXX_NODISCARD pointer allocate(size_type __n, typename bitmap_allocator<void>::const_pointer) { return allocate(__n); } diff --git a/libstdc++-v3/include/ext/debug_allocator.h b/libstdc++-v3/include/ext/debug_allocator.h index bf86470e8fc..c5fc57e68dd 100644 --- a/libstdc++-v3/include/ext/debug_allocator.h +++ b/libstdc++-v3/include/ext/debug_allocator.h @@ -118,7 +118,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION debug_allocator(const _Alloc& __a) : _M_allocator(__a), _M_extra(_S_extra()) { } - pointer + _GLIBCXX_NODISCARD pointer allocate(size_type __n) { pointer __res = _M_allocator.allocate(__n + _M_extra); @@ -127,7 +127,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __res + _M_extra; } - pointer + _GLIBCXX_NODISCARD pointer allocate(size_type __n, const void* __hint) { pointer __res = _M_allocator.allocate(__n + _M_extra, __hint); diff --git a/libstdc++-v3/include/ext/extptr_allocator.h b/libstdc++-v3/include/ext/extptr_allocator.h index 388edb2e622..2ce87b60c44 100644 --- a/libstdc++-v3/include/ext/extptr_allocator.h +++ b/libstdc++-v3/include/ext/extptr_allocator.h @@ -92,7 +92,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const_pointer address(const_reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } - pointer allocate(size_type __n, void* __hint = 0) + _GLIBCXX_NODISCARD pointer allocate(size_type __n, void* __hint = 0) { return _M_real_alloc.allocate(__n,__hint); } void deallocate(pointer __p, size_type __n) diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h index 7b07533f3df..43e84f47fbd 100644 --- a/libstdc++-v3/include/ext/mt_allocator.h +++ b/libstdc++-v3/include/ext/mt_allocator.h @@ -665,7 +665,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ~__mt_alloc() _GLIBCXX_USE_NOEXCEPT { } - pointer + _GLIBCXX_NODISCARD pointer allocate(size_type __n, const void* = 0); void @@ -684,7 +684,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; template<typename _Tp, typename _Poolp> - typename __mt_alloc<_Tp, _Poolp>::pointer + _GLIBCXX_NODISCARD typename __mt_alloc<_Tp, _Poolp>::pointer __mt_alloc<_Tp, _Poolp>:: allocate(size_type __n, const void*) { diff --git a/libstdc++-v3/include/ext/new_allocator.h b/libstdc++-v3/include/ext/new_allocator.h index 04db4bbc99f..e24539100f9 100644 --- a/libstdc++-v3/include/ext/new_allocator.h +++ b/libstdc++-v3/include/ext/new_allocator.h @@ -98,7 +98,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // NB: __n is permitted to be 0. The C++ standard says nothing // about what the return value is when __n == 0. - pointer + _GLIBCXX_NODISCARD pointer allocate(size_type __n, const void* = static_cast<const void*>(0)) { if (__n > this->max_size()) diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp index 5e739551c52..4019f864307 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp @@ -39,6 +39,7 @@ */ PB_DS_CLASS_T_DEC +_GLIBCXX_NODISCARD inline bool PB_DS_CLASS_C_DEC:: empty() const diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp index 40ddeed5aad..dbfd612917e 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp @@ -144,7 +144,7 @@ namespace __gnu_pbds ~binary_heap(); - inline bool + _GLIBCXX_NODISCARD inline bool empty() const; inline size_type diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp index 29612faf13e..d81d5500659 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp @@ -39,6 +39,7 @@ */ PB_DS_CLASS_T_DEC +_GLIBCXX_NODISCARD inline bool PB_DS_CLASS_C_DEC:: empty() const diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp index 6706c1aab6e..1a6affc70b2 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp @@ -271,7 +271,7 @@ namespace __gnu_pbds max_size() const; /// True if size() == 0. - inline bool + _GLIBCXX_NODISCARD inline bool empty() const; /// Return current hash_fn. diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp index 7b5318b64ec..9d38890f7f6 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp @@ -52,6 +52,7 @@ max_size() const { return m_entry_allocator.max_size(); } PB_DS_CLASS_T_DEC +_GLIBCXX_NODISCARD inline bool PB_DS_CLASS_C_DEC:: empty() const diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp index 500b92f0be0..bcc1fc47b12 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp @@ -46,6 +46,7 @@ size() const { return m_num_used_e; } PB_DS_CLASS_T_DEC +_GLIBCXX_NODISCARD inline bool PB_DS_CLASS_C_DEC:: empty() const diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp index bcac913597d..90dfd50ef8e 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp @@ -279,7 +279,7 @@ namespace __gnu_pbds max_size() const; /// True if size() == 0. - inline bool + _GLIBCXX_NODISCARD inline bool empty() const; /// Return current hash_fn. diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp index 64fa975e601..464216e45dd 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp @@ -52,6 +52,7 @@ max_size() const { return s_entry_allocator.max_size(); } PB_DS_CLASS_T_DEC +_GLIBCXX_NODISCARD inline bool PB_DS_CLASS_C_DEC:: empty() const diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp index 8d31e5b711d..d12710a1218 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp @@ -39,6 +39,7 @@ */ PB_DS_CLASS_T_DEC +_GLIBCXX_NODISCARD inline bool PB_DS_CLASS_C_DEC:: empty() const diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp index 746a3d8a39a..32d67eb3d3a 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp @@ -144,7 +144,7 @@ namespace __gnu_pbds ~left_child_next_sibling_heap(); - inline bool + _GLIBCXX_NODISCARD inline bool empty() const; inline size_type diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp index 2c44a513c82..5d2e81ff4a7 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp @@ -51,6 +51,7 @@ max_size() const { return s_entry_allocator.max_size(); } PB_DS_CLASS_T_DEC +_GLIBCXX_NODISCARD inline bool PB_DS_CLASS_C_DEC:: empty() const diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp index e3539a57516..a3c0fb49c9a 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp @@ -198,7 +198,7 @@ namespace __gnu_pbds inline size_type max_size() const; - inline bool + _GLIBCXX_NODISCARD inline bool empty() const; inline mapped_reference diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp index 26f33bf5444..81e7305e315 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp @@ -54,6 +54,7 @@ max_size() const { return s_value_alloc.max_size(); } PB_DS_CLASS_T_DEC +_GLIBCXX_NODISCARD inline bool PB_DS_CLASS_C_DEC:: empty() const diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp index efebc354cd6..0859da17d7a 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp @@ -239,7 +239,7 @@ namespace __gnu_pbds inline size_type max_size() const; - inline bool + _GLIBCXX_NODISCARD inline bool empty() const; inline size_type diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp index 0f6eaf5c44a..33fc3e14ccf 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp @@ -39,6 +39,7 @@ */ PB_DS_CLASS_T_DEC +_GLIBCXX_NODISCARD inline bool PB_DS_CLASS_C_DEC:: empty() const diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp index 13da3d4264a..3f7e054e249 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp @@ -223,7 +223,7 @@ namespace __gnu_pbds } } - inline bool + _GLIBCXX_NODISCARD inline bool empty() const { return m_bag.empty(); } }; @@ -279,7 +279,7 @@ namespace __gnu_pbds ~PB_DS_PAT_TRIE_NAME(); - inline bool + _GLIBCXX_NODISCARD inline bool empty() const; inline size_type diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp index 2d1b4e795a3..5c996d11e28 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp @@ -87,7 +87,7 @@ namespace __gnu_pbds inline void pop(); - inline bool + _GLIBCXX_NODISCARD inline bool empty() const; inline size_type @@ -178,7 +178,7 @@ namespace __gnu_pbds } template<typename _Node, typename _Alloc> - inline bool + _GLIBCXX_NODISCARD inline bool rc<_Node, _Alloc>:: empty() const { diff --git a/libstdc++-v3/include/ext/pb_ds/detail/tree_trace_base.hpp b/libstdc++-v3/include/ext/pb_ds/detail/tree_trace_base.hpp index 980ff9788a2..3b349c70d35 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/tree_trace_base.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/tree_trace_base.hpp @@ -80,7 +80,7 @@ namespace __gnu_pbds void trace_node(node_const_iterator, size_type) const; - virtual bool + _GLIBCXX_NODISCARD virtual bool empty() const = 0; virtual node_const_iterator diff --git a/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp b/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp index 0b0683dec51..9c750aa56b3 100644 --- a/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp +++ b/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp @@ -315,7 +315,7 @@ namespace __gnu_pbds typedef typename __rebind_ma::reference metadata_reference; /// Returns true if the container is empty. - virtual bool + _GLIBCXX_NODISCARD virtual bool empty() const = 0; /// Returns the iterator associated with the trie's first element. diff --git a/libstdc++-v3/include/ext/pool_allocator.h b/libstdc++-v3/include/ext/pool_allocator.h index 460f55dbbf0..4b23727abae 100644 --- a/libstdc++-v3/include/ext/pool_allocator.h +++ b/libstdc++-v3/include/ext/pool_allocator.h @@ -188,7 +188,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION destroy(pointer __p) { __p->~_Tp(); } #endif - pointer + _GLIBCXX_NODISCARD pointer allocate(size_type __n, const void* = 0); void @@ -210,7 +210,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __pool_alloc<_Tp>::_S_force_new; template<typename _Tp> - _Tp* + _GLIBCXX_NODISCARD _Tp* __pool_alloc<_Tp>::allocate(size_type __n, const void*) { pointer __ret = 0; diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope index 4cc8285a671..127d113c349 100644 --- a/libstdc++-v3/include/ext/rope +++ b/libstdc++-v3/include/ext/rope @@ -1797,7 +1797,7 @@ protected: static int _S_compare(const _RopeRep* __x, const _RopeRep* __y); public: - bool + _GLIBCXX_NODISCARD bool empty() const { return 0 == this->_M_tree_ptr; } diff --git a/libstdc++-v3/include/ext/slist b/libstdc++-v3/include/ext/slist index 532235f8c53..3b49ae20183 100644 --- a/libstdc++-v3/include/ext/slist +++ b/libstdc++-v3/include/ext/slist @@ -458,7 +458,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION max_size() const { return size_type(-1); } - bool + _GLIBCXX_NODISCARD bool empty() const { return this->_M_head._M_next == 0; } diff --git a/libstdc++-v3/include/ext/throw_allocator.h b/libstdc++-v3/include/ext/throw_allocator.h index 52d58e6ffc6..38e80f721da 100644 --- a/libstdc++-v3/include/ext/throw_allocator.h +++ b/libstdc++-v3/include/ext/throw_allocator.h @@ -829,7 +829,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION address(const_reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } - pointer + _GLIBCXX_NODISCARD pointer allocate(size_type __n, std::allocator<void>::const_pointer hint = 0) { if (__n > this->max_size()) diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h index ddffebf0893..5942218531f 100644 --- a/libstdc++-v3/include/ext/vstring.h +++ b/libstdc++-v3/include/ext/vstring.h @@ -518,7 +518,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * Returns true if the %string is empty. Equivalent to * <code>*this == ""</code>. */ - bool + _GLIBCXX_NODISCARD bool empty() const _GLIBCXX_NOEXCEPT { return this->size() == 0; } |