mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-25 03:55:32 +08:00
240b01b021
This adds [[nodiscard]] throughout <iterator>, as proposed by P2377R0 (with some minor corrections). The attribute is added for all modes from C++11 up, using [[__nodiscard__]] or _GLIBCXX_NODISCARD where C++17 [[nodiscard]] can't be used directly. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/bits/iterator_concepts.h (iter_move): Add [[nodiscard]]. * include/bits/range_access.h (begin, end, cbegin, cend) (rbegin, rend, crbegin, crend, size, data, ssize): Likewise. * include/bits/ranges_base.h (ranges::begin, ranges::end) (ranges::cbegin, ranges::cend, ranges::rbegin, ranges::rend) (ranges::crbegin, ranges::crend, ranges::size, ranges::ssize) (ranges::empty, ranges::data, ranges::cdata): Likewise. * include/bits/stl_iterator.h (reverse_iterator, __normal_iterator) (back_insert_iterator, front_insert_iterator, insert_iterator) (move_iterator, move_sentinel, common_iterator) (counted_iterator): Likewise. * include/bits/stl_iterator_base_funcs.h (distance, next, prev): Likewise. * include/bits/stream_iterator.h (istream_iterator) (ostream_iterartor): Likewise. * include/bits/streambuf_iterator.h (istreambuf_iterator) (ostreambuf_iterator): Likewise. * include/std/ranges (views::single, views::iota, views::all) (views::filter, views::transform, views::take, views::take_while) (views::drop, views::drop_while, views::join, views::lazy_split) (views::split, views::counted, views::common, views::reverse) (views::elements): Likewise. * testsuite/20_util/rel_ops.cc: Use -Wno-unused-result. * testsuite/24_iterators/move_iterator/greedy_ops.cc: Likewise. * testsuite/24_iterators/normal_iterator/greedy_ops.cc: Likewise. * testsuite/24_iterators/reverse_iterator/2.cc: Likewise. * testsuite/24_iterators/reverse_iterator/greedy_ops.cc: Likewise. * testsuite/21_strings/basic_string/range_access/char/1.cc: Cast result to void. * testsuite/21_strings/basic_string/range_access/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/range_access/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc: Likewise. * testsuite/23_containers/array/range_access.cc: Likewise. * testsuite/23_containers/deque/range_access.cc: Likewise. * testsuite/23_containers/forward_list/range_access.cc: Likewise. * testsuite/23_containers/list/range_access.cc: Likewise. * testsuite/23_containers/map/range_access.cc: Likewise. * testsuite/23_containers/multimap/range_access.cc: Likewise. * testsuite/23_containers/multiset/range_access.cc: Likewise. * testsuite/23_containers/set/range_access.cc: Likewise. * testsuite/23_containers/unordered_map/range_access.cc: Likewise. * testsuite/23_containers/unordered_multimap/range_access.cc: Likewise. * testsuite/23_containers/unordered_multiset/range_access.cc: Likewise. * testsuite/23_containers/unordered_set/range_access.cc: Likewise. * testsuite/23_containers/vector/range_access.cc: Likewise. * testsuite/24_iterators/customization_points/iter_move.cc: Likewise. * testsuite/24_iterators/istream_iterator/sentinel.cc: Likewise. * testsuite/24_iterators/istreambuf_iterator/sentinel.cc: Likewise. * testsuite/24_iterators/move_iterator/dr2061.cc: Likewise. * testsuite/24_iterators/operations/prev_neg.cc: Likewise. * testsuite/24_iterators/ostreambuf_iterator/2.cc: Likewise. * testsuite/24_iterators/range_access/range_access.cc: Likewise. * testsuite/24_iterators/range_operations/100768.cc: Likewise. * testsuite/26_numerics/valarray/range_access2.cc: Likewise. * testsuite/28_regex/range_access.cc: Likewise. * testsuite/experimental/string_view/range_access/char/1.cc: Likewise. * testsuite/experimental/string_view/range_access/wchar_t/1.cc: Likewise. * testsuite/ext/vstring/range_access.cc: Likewise. * testsuite/std/ranges/adaptors/take.cc: Likewise. * testsuite/std/ranges/p2259.cc: Likewise. |
||
---|---|---|
.. | ||
associated_types | ||
back_insert_iterator | ||
bidirectional | ||
common_iterator | ||
contiguous | ||
counted_iterator | ||
customization_points | ||
forward | ||
front_insert_iterator | ||
headers/iterator | ||
indirect_callable | ||
input | ||
insert_iterator | ||
istream_iterator | ||
istreambuf_iterator | ||
move_iterator | ||
normal_iterator | ||
operations | ||
ostream_iterator | ||
ostreambuf_iterator | ||
output | ||
random_access | ||
range_access | ||
range_operations | ||
reverse_iterator | ||
aliases.cc | ||
container_access.cc |