summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/experimental
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2019-01-21 11:47:30 +0000
committerUlrich Drepper <drepper@gcc.gnu.org>2019-01-21 11:47:30 +0000
commitd715f5543117af088e6d8099806b266aa2dac047 (patch)
tree8a278f392e532b7d9a500a1ea59be3d154a5bd0e /libstdc++-v3/include/experimental
parent91f1f6cd66d6b34c8938d11735708646a338e8d2 (diff)
downloadgcc-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/experimental')
-rw-r--r--libstdc++-v3/include/experimental/any2
-rw-r--r--libstdc++-v3/include/experimental/bits/fs_path.h2
-rw-r--r--libstdc++-v3/include/experimental/internet6
-rw-r--r--libstdc++-v3/include/experimental/memory_resource4
-rw-r--r--libstdc++-v3/include/experimental/string_view2
5 files changed, 8 insertions, 8 deletions
diff --git a/libstdc++-v3/include/experimental/any b/libstdc++-v3/include/experimental/any
index f8cd4a78821..ed7a115f6b2 100644
--- a/libstdc++-v3/include/experimental/any
+++ b/libstdc++-v3/include/experimental/any
@@ -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.
diff --git a/libstdc++-v3/include/experimental/bits/fs_path.h b/libstdc++-v3/include/experimental/bits/fs_path.h
index e9d6619876a..239776df313 100644
--- a/libstdc++-v3/include/experimental/bits/fs_path.h
+++ b/libstdc++-v3/include/experimental/bits/fs_path.h
@@ -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;
diff --git a/libstdc++-v3/include/experimental/internet b/libstdc++-v3/include/experimental/internet
index 07c62e697cd..80682efed53 100644
--- a/libstdc++-v3/include/experimental/internet
+++ b/libstdc++-v3/include/experimental/internet
@@ -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(); }
diff --git a/libstdc++-v3/include/experimental/memory_resource b/libstdc++-v3/include/experimental/memory_resource
index 4d96466f218..e9fece55cd0 100644
--- a/libstdc++-v3/include/experimental/memory_resource
+++ b/libstdc++-v3/include/experimental/memory_resource
@@ -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))); }
diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view
index d233ecc743b..8cc0e90246b 100644
--- a/libstdc++-v3/include/experimental/string_view
+++ b/libstdc++-v3/include/experimental/string_view
@@ -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; }