aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/lib/java
diff options
context:
space:
mode:
authorTomasz Kamiński <tkaminsk@redhat.com>2025-08-14 16:54:16 +0200
committerTomasz Kamiński <tkaminsk@redhat.com>2025-08-18 14:05:06 +0200
commitea8ef439718f51592b4eadb989d2609d57d4b7db (patch)
tree5c1de428a464a564663e1f9460e83da30629b23e /libjava/classpath/lib/java
parent4a56ba8c8ec281ef794a598f64a5707204ca9088 (diff)
downloadgcc-ea8ef439718f51592b4eadb989d2609d57d4b7db.zip
gcc-ea8ef439718f51592b4eadb989d2609d57d4b7db.tar.gz
gcc-ea8ef439718f51592b4eadb989d2609d57d4b7db.tar.bz2
libstdc++: Add nodiscard attribute for ranges algorithm [PR121476]
This patch adds the [[nodiscard]] attribute to the operator() of ranges algorithm function objects if their std counterpart has it. Furthermore, we [[nodiscard]] the operator() of the following ranges algorithms that lack a std counterpart: * find_last, find_last_if, find_last_if_not (to match other find algorithms) * contains, contains_subrange (to match find/any_of and search) Finally, [[nodiscard]] is added to std::min and std::max overloads that accept std::initializer_list. This appears to be an oversight, as std::minmax is already marked, and other min overloads are as well. The same applies to corresponding operator() overloads of ranges::min and ranges::max. PR libstdc++/121476 libstdc++-v3/ChangeLog: * include/bits/ranges_algo.h (__all_of_fn::operator()): (__any_of_fn::operator(), __none_of_fn::operator()) (__find_first_of_fn::operator(), __count_fn::operator()) (__find_end_fn::operator(), __remove_if_fn::operator()) (__remove_fn::operator(), __unique_fn::operator()) (__is_sorted_until_fn::operator(), __is_sorted_fn::operator()) (__lower_bound_fn::operator(), __upper_bound_fn::operator()) (__equal_range_fn::operator(), __binary_search_fn::operator()) (__is_partitioned_fn::operator(), __partition_point_fn::operator()) (__minmax_fn::operator(), __min_element_fn::operator()) (__includes_fn::operator(), __max_fn::operator()) (__lexicographical_compare_fn::operator(), __clamp__fn::operator()) (__find_last_fn::operator(), __find_last_if_fn::operator()) (__find_last_if_not_fn::operator()): Add [[nodiscard]] attribute. * include/bits/ranges_algobase.h (__equal_fn::operator()): Add [[nodiscard]] attribute. * include/bits/ranges_util.h (__find_fn::operator()) (__find_if_fn::operator(), __find_if_not_fn::operator()) (__mismatch_fn::operator(), __search_fn::operator()) (__min_fn::operator(), __adjacent_find_fn::operator()): Add [[nodiscard]] attribute. * include/bits/stl_algo.h (std::min(initializer_list<T>)) (std::min(initializer_list<T>, _Compare)) (std::max(initializer_list<T>)) (std::mmax(initializer_list<T>, _Compare)): Add _GLIBCXX_NODISCARD. * testsuite/25_algorithms/min/constrained.cc: Silence nodiscard warning. * testsuite/25_algorithms/max/constrained.cc: Likewise. * testsuite/25_algorithms/minmax/constrained.cc: Likewise. * testsuite/25_algorithms/minmax_element/constrained.cc: Likewise.
Diffstat (limited to 'libjava/classpath/lib/java')
0 files changed, 0 insertions, 0 deletions