Fix after P0600.
authorUlrich Drepper <drepper@redhat.com>
Mon, 21 Jan 2019 11:47:30 +0000 (11:47 +0000)
committerUlrich Drepper <drepper@gcc.gnu.org>
Mon, 21 Jan 2019 11:47:30 +0000 (11:47 +0000)
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

70 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/init/new39.C
libstdc++-v3/ChangeLog
libstdc++-v3/include/backward/hash_map
libstdc++-v3/include/backward/hash_set
libstdc++-v3/include/backward/hashtable.h
libstdc++-v3/include/bits/alloc_traits.h
libstdc++-v3/include/bits/basic_string.h
libstdc++-v3/include/bits/forward_list.h
libstdc++-v3/include/bits/hashtable.h
libstdc++-v3/include/bits/regex.h
libstdc++-v3/include/bits/stl_deque.h
libstdc++-v3/include/bits/stl_list.h
libstdc++-v3/include/bits/stl_map.h
libstdc++-v3/include/bits/stl_multimap.h
libstdc++-v3/include/bits/stl_multiset.h
libstdc++-v3/include/bits/stl_queue.h
libstdc++-v3/include/bits/stl_set.h
libstdc++-v3/include/bits/stl_stack.h
libstdc++-v3/include/bits/stl_tree.h
libstdc++-v3/include/bits/stl_vector.h
libstdc++-v3/include/bits/unordered_map.h
libstdc++-v3/include/bits/unordered_set.h
libstdc++-v3/include/debug/array
libstdc++-v3/include/experimental/any
libstdc++-v3/include/experimental/bits/fs_path.h
libstdc++-v3/include/experimental/internet
libstdc++-v3/include/experimental/memory_resource
libstdc++-v3/include/experimental/string_view
libstdc++-v3/include/ext/alloc_traits.h
libstdc++-v3/include/ext/array_allocator.h
libstdc++-v3/include/ext/bitmap_allocator.h
libstdc++-v3/include/ext/debug_allocator.h
libstdc++-v3/include/ext/extptr_allocator.h
libstdc++-v3/include/ext/mt_allocator.h
libstdc++-v3/include/ext/new_allocator.h
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp
libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
libstdc++-v3/include/ext/pb_ds/detail/tree_trace_base.hpp
libstdc++-v3/include/ext/pb_ds/trie_policy.hpp
libstdc++-v3/include/ext/pool_allocator.h
libstdc++-v3/include/ext/rope
libstdc++-v3/include/ext/slist
libstdc++-v3/include/ext/throw_allocator.h
libstdc++-v3/include/ext/vstring.h
libstdc++-v3/include/profile/array
libstdc++-v3/include/std/array
libstdc++-v3/include/std/future
libstdc++-v3/include/std/scoped_allocator
libstdc++-v3/include/tr1/array
libstdc++-v3/include/tr1/hashtable.h
libstdc++-v3/include/tr1/regex
libstdc++-v3/include/tr2/dynamic_bitset
libstdc++-v3/libsupc++/eh_alloc.cc
libstdc++-v3/libsupc++/new

index 853224023fd1711326502294c411ea5c9a62df5e..a629dcdd84b771d02d3116311e389ddaed898808 100644 (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.
index f274ebb7b9d69e599225a77269b3cdf0593fa136..430701db6843664a903f268967b0564163610556 100644 (file)
@@ -57,7 +57,7 @@ int
 main ()
 {
   try {
-    ::operator new(size_t(-1));
+    (void) ::operator new(size_t(-1));
     abort ();
   } catch (std::bad_alloc &) {
   }
index 4ca096d7b75e3a7ffcd40fce7e8ec827b0e6c4fe..cb7f1a61af7a59e4ffe24c0874676743e7ddc674 100644 (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
index 9f47970767d0126bd3913422d3cdb8fc5116a0eb..66a5218fc6fccfe75288fbd61335aaac155c0058 100644 (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(); }
 
index 2515cd1dafa15289a6492ade89c021efda469ca7..2dc0ed774fa95925b75ec0c586e5eaf00cab20bc 100644 (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(); }
 
index a8cf149873bcc78a08c7078b1d7cb96b100405f8..28c487a71c2fd8b47d537396f8ce0c0062a9d9e7 100644 (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; }
 
index cea28e04500d4d1c193776e2b410e36f6956e677..ed61ce845f83b82a01159ce90ba8a9cbae4401c8 100644 (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); }
 
index 28ed337bdb6fdef11c6849192457e346c4f88d79..0a6dd3cbc7149bc1b07df819a743b5070b6d7fff 100644 (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; }
 
index 4741c43376c5773b34f1f1cb581ea0e19383b851..4c277845a51d9dc4a28c66287b31e0503f43fc70 100644 (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; }
 
index 34946c75b0bbb8995d83a88dc240e1d029eeda6c..31794fb12c2519ae1c71eb004507b45e5e9805fc 100644 (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; }
 
index 79645948af2476d53349beb10a63cf587e580f0c..7576cd7a9c069bffa51971941f4ff10ef21e76a3 100644 (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; }
 
index 341682c03a541a8ec9a14156c0dbe653ba2b07a2..1574895a2c648b4e0f098539f130790ddf753fb9 100644 (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; }
 
index 14a7881d0f5e43cb9dab1df6c188e0998823eae0..68bab94af1e052d0aab3b74ec515862e943a5f97 100644 (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; }
 
index c2c974a2003b7ad590c66d58ec1f52ab6ce8b721..a61d23cac680d392beb0520ce1078fd7e3ad351d 100644 (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(); }
 
index 98796fd2878ab9e61b0b6759bd170eddad13b00a..29a96d8a45bc2b98df8d44e49d7f4df189bde21f 100644 (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(); }
 
index 175e0755543cbbbd660b2af073f6e5d9c68a37b1..7a0fb832480566ba210d4be1ba989894805444cc 100644 (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(); }
 
index 575cbf9bed884ddcbf3e1d754fcf2e9b256b9c50..aa8dd02ed6eab1dcd357e885589d0eea679dfcbe 100644 (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(); }
 
index 7779007c2e2d260313b07818d3fbd53117c5a677..7c903cf3a9a3f46fc6afbe1d538761cfc8f0c654 100644 (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(); }
 
index 88650c15ba6e6155510196c60bd49b429c46f643..8581dce210c7ef6996cdabe95be5235efcdfda61 100644 (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(); }
 
index 252ef959fcc8f3f01c1a9a3250d51c72e15f03b6..47ae0ae9531f1ec280562384607825b6b90e5b14 100644 (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; }
 
index ebf105aa8fad0a1837b7a803a7cb1e5edc671cfc..54de0e09ce7ef4e32804539d94b1fbc505d57b3d 100644 (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(); }
 
index 4b71db5d10a9502f6811b1d50e9f6a67a29fece0..ecb3ef411fc3a2bdde99891a3361a0fa3c1bb475 100644 (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(); }
 
index e1ac398e363be370c3046a797043e501e7afc7fb..3e1180f323adefe16d02c443d13d12d0512e7de4 100644 (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(); }
 
index 0ca2fcae9375a0cc0ef5bbcc21232e0d946ad41b..9e94e656c0418a81cfd2f3447e70944023512322 100644 (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.
index f8cd4a788214a95dc943dc2867b3865cda126f95..ed7a115f6b2b894821e5081883081bebc2208c8d 100644 (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.
index e9d6619876accfa709fc40f7e11261dd3c5a44db..239776df313eaa353f8e3c1641c797bc846de144 100644 (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;
index 07c62e697cd6600a726ae679052513dd33dac4fb..80682efed530824041026d57ef99227462d753f8 100644 (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(); }
index 4d96466f21855f33618243b61c37b490d8f44987..e9fece55cd0233785aba5179fe7aedd88b04494e 100644 (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))); }
 
index d233ecc743b571ebc60cfa096170fcaed8bfcc64..8cc0e90246b05f7ec5357fc6dd085dc139d9d406 100644 (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; }
 
index 5571d2692fb1903c5c224e815274af92ebcd0e0f..65fa3de271c87a3aaffc999b50de65dac8e1fef2 100644 (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); }
 
index 6dd23cdbb8205e1594fcf00f4ff56333f43eb03c..c0d4a3497dc36b2b90b5b8dba0c8f9fea7295085 100644 (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())
index 400030bfbc5b1eab9e1a633235499c9c6870a3b3..532bad295b6af503cb00461ca53ea3ca3f89325c 100644 (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); }
 
index bf86470e8fc33d9ac5ebcf4d2ee56c687d6c8844..c5fc57e68dda25faf0ec8202de4a89594c269af7 100644 (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);
index 388edb2e622275457eb01f81a7dc2af5e42a89da..2ce87b60c44c5bb9a1727d814179e322899bbfe7 100644 (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)
index 7b07533f3df806c9e515d601a04ec83474972685..43e84f47fbd7db30bb8740db99abbc0e1d512447 100644 (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*)
     {
index 04db4bbc99f008c117e4e7d1c6f27ead47ae4ca9..e24539100f9e9885cf0d590a8801740c9fa521f6 100644 (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())
index 5e739551c5262ba7eeb8e0be2bc1ace7115aa3cb..4019f864307468f14854fc640b0ebe2afafe049f 100644 (file)
@@ -39,6 +39,7 @@
  */
 
 PB_DS_CLASS_T_DEC
+_GLIBCXX_NODISCARD
 inline bool
 PB_DS_CLASS_C_DEC::
 empty() const
index 40ddeed5aad7109b1fe885d26f7bc7b1ee99f299..dbfd612917e6435b4ad5b14fb9e255450dd7b963 100644 (file)
@@ -144,7 +144,7 @@ namespace __gnu_pbds
 
       ~binary_heap();
 
-      inline bool
+      _GLIBCXX_NODISCARD inline bool
       empty() const;
 
       inline size_type
index 29612faf13eddb886cdd1e77d4fb5aea241bebca..d81d5500659ae5e108c8ab3f36a5a98eb4b3960c 100644 (file)
@@ -39,6 +39,7 @@
  */
 
 PB_DS_CLASS_T_DEC
+_GLIBCXX_NODISCARD
 inline bool
 PB_DS_CLASS_C_DEC::
 empty() const
index 6706c1aab6ea636c47bc62e54aaca26a453322b5..1a6affc70b2324cca776c21607959e611fecc0a4 100644 (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.
index 7b5318b64ecfca6fdaacac661c72f3033be65c01..9d38890f7f687577d3cf86736c578d5b3b9197b0 100644 (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
index 500b92f0be06a5f313049ee411737b9a6e24b431..bcc1fc47b126190daa4c857eb390c6a92f101687 100644 (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
index bcac913597db44c2c3a096d8fb7adf761f2d362a..90dfd50ef8ec59f09a02c883ab586203af4cf35f 100644 (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.
index 64fa975e60149dccac93e65842809ed281bac059..464216e45dd9de7a1f91a3799c2b33f489fa53f3 100644 (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
index 8d31e5b711d6a30cc3b24c621a29b21d3c1fc2e4..d12710a1218e05841fa4790588ddb7dae3a6677e 100644 (file)
@@ -39,6 +39,7 @@
  */
 
 PB_DS_CLASS_T_DEC
+_GLIBCXX_NODISCARD
 inline bool
 PB_DS_CLASS_C_DEC::
 empty() const
index 746a3d8a39a46ff4adfea7fd786b8a37b3635505..32d67eb3d3ae1d161e32f0803ea5e2062bb739da 100644 (file)
@@ -144,7 +144,7 @@ namespace __gnu_pbds
 
       ~left_child_next_sibling_heap();
 
-      inline bool
+      _GLIBCXX_NODISCARD inline bool
       empty() const;
 
       inline size_type
index 2c44a513c8271c7649411bd6987ff16e25a2b38d..5d2e81ff4a7d21a7d023e731fa4a7b9d7d18771f 100644 (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
index e3539a57516dd1c7d943b6a06479db0b0c92329b..a3c0fb49c9a3b6f5925783ed7484108eef4aba5f 100644 (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
index 26f33bf5444e3f7575a37f5779fbca3936b5562b..81e7305e315ef2b12bd8aeb7df44aadf1c1260df 100644 (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
index efebc354cd6eb485ae5f71baced573777a1b09c0..0859da17d7a52d0e28f07d095fb892a345e3e63d 100644 (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
index 0f6eaf5c44a1366ce4df747f46323146014cb9a1..33fc3e14ccfd80a5c5aa75bcd8859007048c847d 100644 (file)
@@ -39,6 +39,7 @@
  */
 
 PB_DS_CLASS_T_DEC
+_GLIBCXX_NODISCARD
 inline bool
 PB_DS_CLASS_C_DEC::
 empty() const
index 13da3d4264a5cefea64fe5733a58f59ca63d0023..3f7e054e24941a0c725b8634a98285b3d86dc7ef 100644 (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
index 2d1b4e795a361bc9f752e4dfc652fd2ebb9e7c54..5c996d11e2850f03d00e54b931cceae876c7ead1 100644 (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
     {
index 980ff9788a2cfd64c62da7df7506effb2649078b..3b349c70d35a208a45c4a53d143abfd4a3f8c155 100644 (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
index 0b0683dec510e7cdf47f683476075cca5b337af1..9c750aa56b3b4a80df427c48efd4d2f9903b2460 100644 (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.
index 460f55dbbf09678ae9da84b8dda0fb475f1f08e5..4b23727abae2bf40a2d199cc3a4ad3d4aabc6a01 100644 (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;
index 4cc8285a67105927d1743a98e632f514f8587527..127d113c3498f00286ecd36b79fffe570edf0ae8 100644 (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; }
       
index 532235f8c53e85bff0a07534a5f45cfead37db4a..3b49ae20183e8961f6afbe97a6d2c43b74579541 100644 (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; }
 
index 52d58e6ffc65c880ad6ce567689d98e85a868bd9..38e80f721da80d47eb2c2619daa2b9f5409b88e2 100644 (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())
index ddffebf089392c5574d620b1853151d2e57d2076..5942218531f4c904fda66cd640daa3a21fe3f7a5 100644 (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; }
 
index dc7b594e29d63f198b605a6b57ea543070e11611..8f80e2a067fbf36ea904331d88a7b00848527e17 100644 (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.
index ba52e3c2c8945498e59ba1a9cc5a8493875a3efc..02c6f4b4dbe91d6a86280893f84cb720e4561728 100644 (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.
index 6cafde5ee6abc989e5f947754984300ad170a648..10136e57a84983448486b6c1ad6d2385d337b695 100644 (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,
index 5a8495db21bead3bd1db7bdd2b7d3244437c04c1..335df483f691d1fa1aa542ebe37771469e905810 100644 (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)
index e8266d7bc0313dd5f3dc585319a4e7cdd4aee993..5c0857b960e5b19c3aef2284ab731d19b12b1aae 100644 (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.
index eed79effb3cd80f776a3fe5aab1848029aba6e67..c1b5c9e8fdaf9d6f2cb0cc13d6780141d454c69e 100644 (file)
@@ -244,7 +244,7 @@ namespace tr1
       size() const
       { return _M_element_count; }
 
-      bool
+      _GLIBCXX_NODISCARD bool
       empty() const
       { return size() == 0; }
 
index f0d0742860ff8380c042641f851c33de505ded54..73c610d2bbdb1a67341948fd7807715c611e0037 100644 (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; }
       
index fb022f3b1887919e9fed97b84346237e208119ea..434a4cc87ec1c750974fa4e9273196483b1ccbb0 100644 (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); }
 
index ad16699e7b8f5abc132307cc96158edf6f82a2f1..005c28dbb1146c28715ac69f013ae41e3492f992 100644 (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 *);
index a35972b08b3093e81b92828be4bf214bf6c226bd..6347d21b26f74a938492a2db381b44563619d5c0 100644 (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.