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
This commit is contained in:
Ulrich Drepper 2019-01-21 11:47:30 +00:00 committed by Ulrich Drepper
parent 91f1f6cd66
commit d715f55431
70 changed files with 193 additions and 90 deletions

View File

@ -1,3 +1,8 @@
2019-01-20 Ulrich Drepper <drepper@redhat.com>
Fix after C++ P0600 implementation.
* g++.dg/init/new39.C: Don't just ignore result of new.
2019-01-20 Iain Buclaw <ibuclaw@gdcproject.org>
* gdc.dg/runnable.d: Add more tests for comparing complex types.

View File

@ -57,7 +57,7 @@ int
main ()
{
try {
::operator new(size_t(-1));
(void) ::operator new(size_t(-1));
abort ();
} catch (std::bad_alloc &) {
}

View File

@ -1,3 +1,92 @@
2019-01-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.
2019-01-18 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/87514

View File

@ -166,7 +166,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
max_size() const
{ return _M_ht.max_size(); }
bool
_GLIBCXX_NODISCARD bool
empty() const
{ return _M_ht.empty(); }
@ -385,7 +385,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
max_size() const
{ return _M_ht.max_size(); }
bool
_GLIBCXX_NODISCARD bool
empty() const
{ return _M_ht.empty(); }

View File

@ -168,7 +168,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
max_size() const
{ return _M_ht.max_size(); }
bool
_GLIBCXX_NODISCARD bool
empty() const
{ return _M_ht.empty(); }
@ -369,7 +369,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
max_size() const
{ return _M_ht.max_size(); }
bool
_GLIBCXX_NODISCARD bool
empty() const
{ return _M_ht.empty(); }

View File

@ -379,7 +379,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
max_size() const
{ return size_type(-1); }
bool
_GLIBCXX_NODISCARD bool
empty() const
{ return size() == 0; }

View File

@ -301,7 +301,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*
* Calls @c a.allocate(n)
*/
static pointer
_GLIBCXX_NODISCARD static pointer
allocate(_Alloc& __a, size_type __n)
{ return __a.allocate(__n); }
@ -316,7 +316,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Returns <tt> a.allocate(n, hint) </tt> if that expression is
* well-formed, otherwise returns @c a.allocate(n)
*/
static pointer
_GLIBCXX_NODISCARD static pointer
allocate(_Alloc& __a, size_type __n, const_void_pointer __hint)
{ return _S_allocate(__a, __n, __hint, 0); }
@ -439,7 +439,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*
* Calls @c a.allocate(n)
*/
static pointer
_GLIBCXX_NODISCARD static pointer
allocate(allocator_type& __a, size_type __n)
{ return __a.allocate(__n); }
@ -453,7 +453,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*
* Returns <tt> a.allocate(n, hint) </tt>
*/
static pointer
_GLIBCXX_NODISCARD static pointer
allocate(allocator_type& __a, size_type __n, const_void_pointer __hint)
{ return __a.allocate(__n, __hint); }

View File

@ -1027,7 +1027,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
* Returns true if the %string is empty. Equivalent to
* <code>*this == ""</code>.
*/
bool
_GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return this->size() == 0; }
@ -4007,7 +4007,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
* Returns true if the %string is empty. Equivalent to
* <code>*this == ""</code>.
*/
bool
_GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return this->size() == 0; }

View File

@ -774,7 +774,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* Returns true if the %forward_list is empty. (Thus begin() would
* equal end().)
*/
bool
_GLIBCXX_NODISCARD bool
empty() const noexcept
{ return this->_M_impl._M_head._M_next == nullptr; }

View File

@ -533,7 +533,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
size() const noexcept
{ return _M_element_count; }
bool
_GLIBCXX_NODISCARD bool
empty() const noexcept
{ return size() == 0; }

View File

@ -1705,7 +1705,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
* @retval true The %match_results object is empty.
* @retval false The %match_results object is not empty.
*/
bool
_GLIBCXX_NODISCARD bool
empty() const noexcept
{ return size() == 0; }

View File

@ -1377,7 +1377,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* Returns true if the %deque is empty. (Thus begin() would
* equal end().)
*/
bool
_GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return this->_M_impl._M_finish == this->_M_impl._M_start; }

View File

@ -1047,7 +1047,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
* Returns true if the %list is empty. (Thus begin() would equal
* end().)
*/
bool
_GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }

View File

@ -459,7 +459,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/** Returns true if the %map is empty. (Thus begin() would equal
* end().)
*/
bool
_GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return _M_t.empty(); }

View File

@ -452,7 +452,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// capacity
/** Returns true if the %multimap is empty. */
bool
_GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return _M_t.empty(); }

View File

@ -406,7 +406,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#endif
/// Returns true if the %set is empty.
bool
_GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return _M_t.empty(); }

View File

@ -185,7 +185,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* Returns true if the %queue is empty.
*/
bool
_GLIBCXX_NODISCARD bool
empty() const
{ return c.empty(); }
@ -563,7 +563,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* Returns true if the %queue is empty.
*/
bool
_GLIBCXX_NODISCARD bool
empty() const
{ return c.empty(); }

View File

@ -410,7 +410,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#endif
/// Returns true if the %set is empty.
bool
_GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return _M_t.empty(); }

View File

@ -181,7 +181,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* Returns true if the %stack is empty.
*/
bool
_GLIBCXX_NODISCARD bool
empty() const
{ return c.empty(); }

View File

@ -1027,7 +1027,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
rend() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(begin()); }
bool
_GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return _M_impl._M_node_count == 0; }

View File

@ -964,7 +964,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* Returns true if the %vector is empty. (Thus begin() would
* equal end().)
*/
bool
_GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return begin() == end(); }

View File

@ -300,7 +300,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// size and capacity:
/// Returns true if the %unordered_map is empty.
bool
_GLIBCXX_NODISCARD bool
empty() const noexcept
{ return _M_h.empty(); }
@ -1441,7 +1441,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// size and capacity:
/// Returns true if the %unordered_multimap is empty.
bool
_GLIBCXX_NODISCARD bool
empty() const noexcept
{ return _M_h.empty(); }

View File

@ -294,7 +294,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// size and capacity:
/// Returns true if the %unordered_set is empty.
bool
_GLIBCXX_NODISCARD bool
empty() const noexcept
{ return _M_h.empty(); }
@ -1102,7 +1102,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// size and capacity:
/// Returns true if the %unordered_multiset is empty.
bool
_GLIBCXX_NODISCARD bool
empty() const noexcept
{ return _M_h.empty(); }

View File

@ -71,7 +71,7 @@ namespace __debug
template<std::size_t _Size>
struct _Array_check_nonempty
{
bool empty() { return _Size == 0; }
_GLIBCXX_NODISCARD bool empty() { return _Size == 0; }
_Array_check_nonempty()
{ __glibcxx_check_nonempty(); }
@ -145,7 +145,7 @@ namespace __debug
constexpr size_type
max_size() const noexcept { return _Nm; }
constexpr bool
_GLIBCXX_NODISCARD constexpr bool
empty() const noexcept { return size() == 0; }
// Element access.

View File

@ -266,7 +266,7 @@ inline namespace fundamentals_v1
// observers
/// Reports whether there is a contained object or not.
bool empty() const noexcept { return _M_manager == nullptr; }
_GLIBCXX_NODISCARD bool empty() const noexcept { return _M_manager == nullptr; }
#if __cpp_rtti
/// The @c typeid of the contained object, or @c typeid(void) if empty.

View File

@ -365,7 +365,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
// query
bool empty() const noexcept { return _M_pathname.empty(); }
_GLIBCXX_NODISCARD bool empty() const noexcept { return _M_pathname.empty(); }
bool has_root_name() const;
bool has_root_directory() const;
bool has_root_path() const;

View File

@ -1049,7 +1049,7 @@ namespace ip
iterator begin() const noexcept { return _M_begin; }
iterator end() const noexcept { return _M_end; }
bool empty() const noexcept { return _M_begin == _M_end; }
_GLIBCXX_NODISCARD bool empty() const noexcept { return _M_begin == _M_end; }
size_t
size() const noexcept { return _M_end->to_uint() - _M_begin->to_uint(); }
@ -1093,7 +1093,7 @@ namespace ip
iterator begin() const noexcept { return _M_begin; }
iterator end() const noexcept { return _M_end; }
bool empty() const noexcept { return _M_begin == _M_end; }
_GLIBCXX_NODISCARD bool empty() const noexcept { return _M_begin == _M_end; }
iterator
find(const address_v6& __addr) const noexcept
@ -1721,7 +1721,7 @@ namespace ip
// size:
size_type size() const noexcept { return _M_size; }
size_type max_size() const noexcept { return _M_results.max_size(); }
bool empty() const noexcept { return _M_results.empty(); }
_GLIBCXX_NODISCARD bool empty() const noexcept { return _M_results.empty(); }
// element access:
const_iterator begin() const { return _M_results.begin(); }

View File

@ -88,7 +88,7 @@ namespace pmr {
memory_resource& operator=(const memory_resource&) = default;
void*
_GLIBCXX_NODISCARD void*
allocate(size_t __bytes, size_t __alignment = _S_max_align)
{ return do_allocate(__bytes, __alignment); }
@ -145,7 +145,7 @@ namespace pmr {
polymorphic_allocator&
operator=(const polymorphic_allocator& __rhs) = default;
_Tp* allocate(size_t __n)
_GLIBCXX_NODISCARD _Tp* allocate(size_t __n)
{ return static_cast<_Tp*>(_M_resource->allocate(__n * sizeof(_Tp),
alignof(_Tp))); }

View File

@ -169,7 +169,7 @@ inline namespace fundamentals_v1
/ sizeof(value_type) / 4;
}
constexpr bool
_GLIBCXX_NODISCARD constexpr bool
empty() const noexcept
{ return this->_M_len == 0; }

View File

@ -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); }

View File

@ -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())

View File

@ -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); }

View File

@ -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);

View File

@ -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)

View File

@ -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*)
{

View File

@ -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())

View File

@ -39,6 +39,7 @@
*/
PB_DS_CLASS_T_DEC
_GLIBCXX_NODISCARD
inline bool
PB_DS_CLASS_C_DEC::
empty() const

View File

@ -144,7 +144,7 @@ namespace __gnu_pbds
~binary_heap();
inline bool
_GLIBCXX_NODISCARD inline bool
empty() const;
inline size_type

View File

@ -39,6 +39,7 @@
*/
PB_DS_CLASS_T_DEC
_GLIBCXX_NODISCARD
inline bool
PB_DS_CLASS_C_DEC::
empty() const

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -39,6 +39,7 @@
*/
PB_DS_CLASS_T_DEC
_GLIBCXX_NODISCARD
inline bool
PB_DS_CLASS_C_DEC::
empty() const

View File

@ -144,7 +144,7 @@ namespace __gnu_pbds
~left_child_next_sibling_heap();
inline bool
_GLIBCXX_NODISCARD inline bool
empty() const;
inline size_type

View File

@ -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

View File

@ -198,7 +198,7 @@ namespace __gnu_pbds
inline size_type
max_size() const;
inline bool
_GLIBCXX_NODISCARD inline bool
empty() const;
inline mapped_reference

View File

@ -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

View File

@ -239,7 +239,7 @@ namespace __gnu_pbds
inline size_type
max_size() const;
inline bool
_GLIBCXX_NODISCARD inline bool
empty() const;
inline size_type

View File

@ -39,6 +39,7 @@
*/
PB_DS_CLASS_T_DEC
_GLIBCXX_NODISCARD
inline bool
PB_DS_CLASS_C_DEC::
empty() const

View File

@ -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

View File

@ -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
{

View File

@ -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

View File

@ -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.

View File

@ -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;

View File

@ -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; }

View File

@ -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; }

View File

@ -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())

View File

@ -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; }

View File

@ -124,7 +124,7 @@ namespace __profile
constexpr size_type
max_size() const noexcept { return _Nm; }
constexpr bool
_GLIBCXX_NODISCARD constexpr bool
empty() const noexcept { return size() == 0; }
// Element access.

View File

@ -177,7 +177,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
constexpr size_type
max_size() const noexcept { return _Nm; }
constexpr bool
_GLIBCXX_NODISCARD constexpr bool
empty() const noexcept { return size() == 0; }
// Element access.

View File

@ -1703,7 +1703,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// async
template<typename _Fn, typename... _Args>
future<__async_result_of<_Fn, _Args...>>
_GLIBCXX_NODISCARD future<__async_result_of<_Fn, _Args...>>
async(launch __policy, _Fn&& __fn, _Args&&... __args)
{
std::shared_ptr<__future_base::_State_base> __state;
@ -1736,7 +1736,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// async, potential overload
template<typename _Fn, typename... _Args>
inline future<__async_result_of<_Fn, _Args...>>
_GLIBCXX_NODISCARD inline future<__async_result_of<_Fn, _Args...>>
async(_Fn&& __fn, _Args&&... __args)
{
return std::async(launch::async|launch::deferred,

View File

@ -343,10 +343,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const outer_allocator_type& outer_allocator() const noexcept
{ return static_cast<const _OuterAlloc&>(*this); }
pointer allocate(size_type __n)
_GLIBCXX_NODISCARD pointer allocate(size_type __n)
{ return __traits::allocate(outer_allocator(), __n); }
pointer allocate(size_type __n, const_void_pointer __hint)
_GLIBCXX_NODISCARD pointer allocate(size_type __n, const_void_pointer __hint)
{ return __traits::allocate(outer_allocator(), __n, __hint); }
void deallocate(pointer __p, size_type __n)

View File

@ -119,7 +119,7 @@ namespace tr1
size_type
max_size() const { return _Nm; }
bool
_GLIBCXX_NODISCARD bool
empty() const { return size() == 0; }
// Element access.

View File

@ -244,7 +244,7 @@ namespace tr1
size() const
{ return _M_element_count; }
bool
_GLIBCXX_NODISCARD bool
empty() const
{ return size() == 0; }

View File

@ -1870,7 +1870,7 @@ namespace regex_constants
* @retval true The %match_results object is empty.
* @retval false The %match_results object is not empty.
*/
bool
_GLIBCXX_NODISCARD bool
empty() const
{ return size() == 0; }

View File

@ -1014,7 +1014,7 @@ namespace tr2
{ return this->_M_size(); }
/// Returns true if the dynamic_bitset is empty.
bool
_GLIBCXX_NODISCARD bool
empty() const noexcept
{ return (this->_M_Nb == 0); }

View File

@ -86,7 +86,7 @@ namespace
public:
pool();
void *allocate (std::size_t);
_GLIBCXX_NODISCARD void *allocate (std::size_t);
void free (void *);
bool in_pool (void *);

View File

@ -122,9 +122,9 @@ namespace std
* Placement new and delete signatures (take a memory address argument,
* does nothing) may not be replaced by a user's program.
*/
void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
_GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
__attribute__((__externally_visible__));
void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
_GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
__attribute__((__externally_visible__));
void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__));
@ -136,26 +136,26 @@ void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__));
#endif
void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
_GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__, __malloc__));
void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
_GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__, __malloc__));
void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__));
void operator delete[](void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__));
#if __cpp_aligned_new
void* operator new(std::size_t, std::align_val_t)
_GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
__attribute__((__externally_visible__));
void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
_GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__, __malloc__));
void operator delete(void*, std::align_val_t)
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
void operator delete(void*, std::align_val_t, const std::nothrow_t&)
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
void* operator new[](std::size_t, std::align_val_t)
_GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
__attribute__((__externally_visible__));
void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
_GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__, __malloc__));
void operator delete[](void*, std::align_val_t)
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
@ -170,9 +170,9 @@ void operator delete[](void*, std::size_t, std::align_val_t)
#endif // __cpp_aligned_new
// Default placement versions of operator new.
inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
_GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
{ return __p; }
inline void* operator new[](std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
_GLIBCXX_NODISCARD inline void* operator new[](std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
{ return __p; }
// Default placement versions of operator delete.