gcc/libstdc++-v3/testsuite/ext
Jonathan Wakely df483ebd24 libstdc++: Add nodiscard in <algorithm>
Add the [[nodiscard]] attribute to several functions in <algorithm>.
These all have no side effects and are only called for their return
value (e.g. std::count) or produce a result that must not be discarded
for correctness (e.g. std::remove).

I was intending to add the attribute to a number of other functions like
std::copy_if, std::unique_copy, std::set_union, and std::set_difference.
I stopped when I noticed that MSVC doesn't use it on those functions,
which I suspect is because they're often used with an insert iterator
(e.g. std::back_insert_iterator). In that case it doesn't matter if
you discard the result, because you have the container to tell you how
many elements were copied to the output range.

libstdc++-v3/ChangeLog:

	* include/bits/stl_algo.h (find_end, all_of, none_of, any_of)
	(find_if_not, is_partitioned, partition_point, remove)
	(remove_if, unique, lower_bound, upper_bound, equal_range)
	(binary_search, includes, is_sorted, is_sorted_until, minmax)
	(minmax_element, is_permutation, clamp, find_if, find_first_of)
	(adjacent_find, count, count_if, search, search_n, min_element)
	(max_element): Add nodiscard attribute.
	* include/bits/stl_algobase.h (min, max, lower_bound, equal)
	(lexicographical_compare, lexicographical_compare_three_way)
	(mismatch): Likewise.
	* include/bits/stl_heap.h (is_heap, is_heap_until): Likewise.
	* testsuite/25_algorithms/equal/debug/1_neg.cc: Add dg-warning.
	* testsuite/25_algorithms/equal/debug/2_neg.cc: Likewise.
	* testsuite/25_algorithms/equal/debug/3_neg.cc: Likewise.
	* testsuite/25_algorithms/find_first_of/concept_check_1.cc:
	Likewise.
	* testsuite/25_algorithms/is_permutation/2.cc: Likewise.
	* testsuite/25_algorithms/lexicographical_compare/71545.cc:
	Likewise.
	* testsuite/25_algorithms/lower_bound/33613.cc: Likewise.
	* testsuite/25_algorithms/lower_bound/debug/irreflexive.cc:
	Likewise.
	* testsuite/25_algorithms/lower_bound/debug/partitioned_neg.cc:
	Likewise.
	* testsuite/25_algorithms/lower_bound/debug/partitioned_pred_neg.cc:
	Likewise.
	* testsuite/25_algorithms/minmax/3.cc: Likewise.
	* testsuite/25_algorithms/search/78346.cc: Likewise.
	* testsuite/25_algorithms/search_n/58358.cc: Likewise.
	* testsuite/25_algorithms/unique/1.cc: Likewise.
	* testsuite/25_algorithms/unique/11480.cc: Likewise.
	* testsuite/25_algorithms/upper_bound/33613.cc: Likewise.
	* testsuite/25_algorithms/upper_bound/debug/partitioned_neg.cc:
	Likewise.
	* testsuite/25_algorithms/upper_bound/debug/partitioned_pred_neg.cc:
	Likewise.
	* testsuite/ext/concept_checks.cc: Likewise.
	* testsuite/ext/is_heap/47709.cc: Likewise.
	* testsuite/ext/is_sorted/cxx0x.cc: Likewise.
2024-03-14 16:58:15 +00:00
..
bitmap_allocator Update copyright years. 2024-01-03 12:19:35 +01:00
char8_t
codecvt Update copyright years. 2024-01-03 12:19:35 +01:00
concurrence_lock_error Update copyright years. 2024-01-03 12:19:35 +01:00
concurrence_unlock_error Update copyright years. 2024-01-03 12:19:35 +01:00
debug_allocator Update copyright years. 2024-01-03 12:19:35 +01:00
enc_filebuf Update copyright years. 2024-01-03 12:19:35 +01:00
ext_pointer Update copyright years. 2024-01-03 12:19:35 +01:00
forced_error Update copyright years. 2024-01-03 12:19:35 +01:00
iota Update copyright years. 2024-01-03 12:19:35 +01:00
is_heap libstdc++: Add nodiscard in <algorithm> 2024-03-14 16:58:15 +00:00
is_sorted libstdc++: Add nodiscard in <algorithm> 2024-03-14 16:58:15 +00:00
malloc_allocator Update copyright years. 2024-01-03 12:19:35 +01:00
mt_allocator Update copyright years. 2024-01-03 12:19:35 +01:00
new_allocator Update copyright years. 2024-01-03 12:19:35 +01:00
numeric_traits Update copyright years. 2024-01-03 12:19:35 +01:00
pb_ds Update copyright years. 2024-01-03 12:19:35 +01:00
pool_allocator Update copyright years. 2024-01-03 12:19:35 +01:00
random Update copyright years. 2024-01-03 12:19:35 +01:00
rope Update copyright years. 2024-01-03 12:19:35 +01:00
shared_ptr Update copyright years. 2024-01-03 12:19:35 +01:00
slist Update copyright years. 2024-01-03 12:19:35 +01:00
special_functions Update copyright years. 2024-01-03 12:19:35 +01:00
stdio_filebuf Update copyright years. 2024-01-03 12:19:35 +01:00
stdio_sync_filebuf Update copyright years. 2024-01-03 12:19:35 +01:00
throw_allocator Update copyright years. 2024-01-03 12:19:35 +01:00
throw_value Update copyright years. 2024-01-03 12:19:35 +01:00
type_traits Update copyright years. 2024-01-03 12:19:35 +01:00
unicode libstdc++: Implement C++26 std::text_encoding (P1885R12) [PR113318] 2024-01-17 11:49:11 +00:00
vstring Update copyright years. 2024-01-03 12:19:35 +01:00
concept_checks.cc libstdc++: Add nodiscard in <algorithm> 2024-03-14 16:58:15 +00:00
headers.cc Update copyright years. 2024-01-03 12:19:35 +01:00
median.cc Update copyright years. 2024-01-03 12:19:35 +01:00
pod_char_traits.cc Update copyright years. 2024-01-03 12:19:35 +01:00