[libcxx-commits] [libcxx] [libc++] Remove _LIBCPP_DISABLE_NODISCARD_EXTENSIONS and refactor the tests (PR #87094)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Mar 29 10:48:26 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 1403cf67a628712bddbe0055161ec68c7ebb468d 0c70d1a77548bec27dce658d465ebeccf84ed5bc -- libcxx/test/libcxx/diagnostics/array.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/cstdlib.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/deque.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/filesystem.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/forward_list.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/future.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/iterator.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/list.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/map.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/memory.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/memory_resource.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/mutex.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/new.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/queue.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/ranges.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/regex.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/scoped_allocator.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/set.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/stack.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/string.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/string_view.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/unordered_set.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/utility.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/vector.nodiscard.verify.cpp libcxx/include/__algorithm/adjacent_find.h libcxx/include/__algorithm/all_of.h libcxx/include/__algorithm/any_of.h libcxx/include/__algorithm/binary_search.h libcxx/include/__algorithm/clamp.h libcxx/include/__algorithm/count.h libcxx/include/__algorithm/count_if.h libcxx/include/__algorithm/equal.h libcxx/include/__algorithm/equal_range.h libcxx/include/__algorithm/find.h libcxx/include/__algorithm/find_end.h libcxx/include/__algorithm/find_first_of.h libcxx/include/__algorithm/find_if.h libcxx/include/__algorithm/find_if_not.h libcxx/include/__algorithm/fold.h libcxx/include/__algorithm/includes.h libcxx/include/__algorithm/is_heap.h libcxx/include/__algorithm/is_heap_until.h libcxx/include/__algorithm/is_partitioned.h libcxx/include/__algorithm/is_permutation.h libcxx/include/__algorithm/is_sorted.h libcxx/include/__algorithm/is_sorted_until.h libcxx/include/__algorithm/lexicographical_compare.h libcxx/include/__algorithm/lexicographical_compare_three_way.h libcxx/include/__algorithm/lower_bound.h libcxx/include/__algorithm/max.h libcxx/include/__algorithm/max_element.h libcxx/include/__algorithm/min.h libcxx/include/__algorithm/min_element.h libcxx/include/__algorithm/minmax.h libcxx/include/__algorithm/minmax_element.h libcxx/include/__algorithm/mismatch.h libcxx/include/__algorithm/none_of.h libcxx/include/__algorithm/pstl_any_all_none_of.h libcxx/include/__algorithm/pstl_is_partitioned.h libcxx/include/__algorithm/ranges_adjacent_find.h libcxx/include/__algorithm/ranges_all_of.h libcxx/include/__algorithm/ranges_any_of.h libcxx/include/__algorithm/ranges_binary_search.h libcxx/include/__algorithm/ranges_clamp.h libcxx/include/__algorithm/ranges_contains.h libcxx/include/__algorithm/ranges_contains_subrange.h libcxx/include/__algorithm/ranges_count.h libcxx/include/__algorithm/ranges_count_if.h libcxx/include/__algorithm/ranges_ends_with.h libcxx/include/__algorithm/ranges_equal.h libcxx/include/__algorithm/ranges_equal_range.h libcxx/include/__algorithm/ranges_find.h libcxx/include/__algorithm/ranges_find_end.h libcxx/include/__algorithm/ranges_find_first_of.h libcxx/include/__algorithm/ranges_find_if.h libcxx/include/__algorithm/ranges_find_if_not.h libcxx/include/__algorithm/ranges_includes.h libcxx/include/__algorithm/ranges_is_heap.h libcxx/include/__algorithm/ranges_is_heap_until.h libcxx/include/__algorithm/ranges_is_partitioned.h libcxx/include/__algorithm/ranges_is_permutation.h libcxx/include/__algorithm/ranges_is_sorted.h libcxx/include/__algorithm/ranges_is_sorted_until.h libcxx/include/__algorithm/ranges_lexicographical_compare.h libcxx/include/__algorithm/ranges_lower_bound.h libcxx/include/__algorithm/ranges_max.h libcxx/include/__algorithm/ranges_max_element.h libcxx/include/__algorithm/ranges_min.h libcxx/include/__algorithm/ranges_min_element.h libcxx/include/__algorithm/ranges_minmax.h libcxx/include/__algorithm/ranges_minmax_element.h libcxx/include/__algorithm/ranges_mismatch.h libcxx/include/__algorithm/ranges_none_of.h libcxx/include/__algorithm/ranges_remove.h libcxx/include/__algorithm/ranges_remove_if.h libcxx/include/__algorithm/ranges_search.h libcxx/include/__algorithm/ranges_search_n.h libcxx/include/__algorithm/ranges_starts_with.h libcxx/include/__algorithm/ranges_unique.h libcxx/include/__algorithm/ranges_upper_bound.h libcxx/include/__algorithm/remove.h libcxx/include/__algorithm/remove_if.h libcxx/include/__algorithm/search.h libcxx/include/__algorithm/search_n.h libcxx/include/__algorithm/unique.h libcxx/include/__algorithm/upper_bound.h libcxx/include/__bit/bit_cast.h libcxx/include/__bit/bit_ceil.h libcxx/include/__bit/bit_floor.h libcxx/include/__bit/bit_width.h libcxx/include/__bit/byteswap.h libcxx/include/__bit/countl.h libcxx/include/__bit/countr.h libcxx/include/__bit/has_single_bit.h libcxx/include/__bit/popcount.h libcxx/include/__chrono/time_zone.h libcxx/include/__chrono/time_zone_link.h libcxx/include/__chrono/tzdb_list.h libcxx/include/__config libcxx/include/__filesystem/path.h libcxx/include/__format/format_functions.h libcxx/include/__functional/identity.h libcxx/include/__iterator/empty.h libcxx/include/__math/abs.h libcxx/include/__math/copysign.h libcxx/include/__math/min_max.h libcxx/include/__math/roots.h libcxx/include/__math/rounding_functions.h libcxx/include/__math/traits.h libcxx/include/__memory/allocator.h libcxx/include/__memory/allocator_traits.h libcxx/include/__memory/temporary_buffer.h libcxx/include/__memory_resource/memory_resource.h libcxx/include/__memory_resource/polymorphic_allocator.h libcxx/include/__mutex/lock_guard.h libcxx/include/__node_handle libcxx/include/__ranges/as_rvalue_view.h libcxx/include/__ranges/chunk_by_view.h libcxx/include/__ranges/drop_view.h libcxx/include/__ranges/repeat_view.h libcxx/include/__ranges/split_view.h libcxx/include/__ranges/take_view.h libcxx/include/__ranges/to.h libcxx/include/__utility/as_const.h libcxx/include/__utility/forward.h libcxx/include/__utility/move.h libcxx/include/__utility/to_underlying.h libcxx/include/array libcxx/include/cstddef libcxx/include/deque libcxx/include/forward_list libcxx/include/future libcxx/include/limits libcxx/include/list libcxx/include/map libcxx/include/math.h libcxx/include/new libcxx/include/queue libcxx/include/regex libcxx/include/scoped_allocator libcxx/include/set libcxx/include/stack libcxx/include/stdlib.h libcxx/include/string libcxx/include/string_view libcxx/include/unordered_map libcxx/include/unordered_set libcxx/include/vector libcxx/src/tzdb.cpp libcxx/test/libcxx/diagnostics/algorithm.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/bit.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/cmath.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/cstddef.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/format.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/functional.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/limits.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/node_handle.nodiscard.verify.cpp libcxx/test/libcxx/diagnostics/pstl.nodiscard.verify.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/__algorithm/count_if.h b/libcxx/include/__algorithm/count_if.h
index 102b9e687a..25782069d0 100644
--- a/libcxx/include/__algorithm/count_if.h
+++ b/libcxx/include/__algorithm/count_if.h
@@ -21,8 +21,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _Predicate>
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- typename iterator_traits<_InputIterator>::difference_type
- count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
+typename iterator_traits<_InputIterator>::difference_type
+count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
typename iterator_traits<_InputIterator>::difference_type __r(0);
for (; __first != __last; ++__first)
if (__pred(*__first))
diff --git a/libcxx/include/__algorithm/minmax_element.h b/libcxx/include/__algorithm/minmax_element.h
index d87ad62911..43cb23347c 100644
--- a/libcxx/include/__algorithm/minmax_element.h
+++ b/libcxx/include/__algorithm/minmax_element.h
@@ -90,9 +90,8 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __com
}
template <class _ForwardIterator>
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair<_ForwardIterator, _ForwardIterator>
- minmax_element(_ForwardIterator __first, _ForwardIterator __last) {
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_ForwardIterator, _ForwardIterator>
+minmax_element(_ForwardIterator __first, _ForwardIterator __last) {
return std::minmax_element(__first, __last, __less<>());
}
diff --git a/libcxx/include/__algorithm/ranges_mismatch.h b/libcxx/include/__algorithm/ranges_mismatch.h
index f7899b8a12..14a0d3734d 100644
--- a/libcxx/include/__algorithm/ranges_mismatch.h
+++ b/libcxx/include/__algorithm/ranges_mismatch.h
@@ -71,8 +71,7 @@ struct __fn {
class _Proj1 = identity,
class _Proj2 = identity>
requires indirectly_comparable<iterator_t<_R1>, iterator_t<_R2>, _Pred, _Proj1, _Proj2>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr mismatch_result<borrowed_iterator_t<_R1>,
- borrowed_iterator_t<_R2>>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr mismatch_result<borrowed_iterator_t<_R1>, borrowed_iterator_t<_R2>>
operator()(_R1&& __r1, _R2&& __r2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
return __go(
ranges::begin(__r1), ranges::end(__r1), ranges::begin(__r2), ranges::end(__r2), __pred, __proj1, __proj2);
diff --git a/libcxx/include/__memory/allocator.h b/libcxx/include/__memory/allocator.h
index 0a1f1a69f9..215d3832f9 100644
--- a/libcxx/include/__memory/allocator.h
+++ b/libcxx/include/__memory/allocator.h
@@ -153,8 +153,7 @@ public:
return std::addressof(__x);
}
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 _Tp*
- allocate(size_t __n, const void*) {
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 _Tp* allocate(size_t __n, const void*) {
return allocate(__n);
}
@@ -230,8 +229,7 @@ public:
return std::addressof(__x);
}
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 const _Tp*
- allocate(size_t __n, const void*) {
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 const _Tp* allocate(size_t __n, const void*) {
return allocate(__n);
}
diff --git a/libcxx/include/__memory_resource/memory_resource.h b/libcxx/include/__memory_resource/memory_resource.h
index 78b774d48c..e605838bf5 100644
--- a/libcxx/include/__memory_resource/memory_resource.h
+++ b/libcxx/include/__memory_resource/memory_resource.h
@@ -33,8 +33,7 @@ public:
virtual ~memory_resource();
[[nodiscard]] [[using __gnu__: __returns_nonnull__, __alloc_size__(2), __alloc_align__(3)]]
- _LIBCPP_HIDE_FROM_ABI void*
- allocate(size_t __bytes, size_t __align = __max_align) {
+ _LIBCPP_HIDE_FROM_ABI void* allocate(size_t __bytes, size_t __align = __max_align) {
return do_allocate(__bytes, __align);
}
diff --git a/libcxx/include/__mutex/lock_guard.h b/libcxx/include/__mutex/lock_guard.h
index ed31509e1e..739d1683b3 100644
--- a/libcxx/include/__mutex/lock_guard.h
+++ b/libcxx/include/__mutex/lock_guard.h
@@ -29,8 +29,8 @@ private:
mutex_type& __m_;
public:
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI explicit lock_guard(mutex_type& __m)
- _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m))
+ _LIBCPP_NODISCARD
+ _LIBCPP_HIDE_FROM_ABI explicit lock_guard(mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m))
: __m_(__m) {
__m_.lock();
}
diff --git a/libcxx/test/libcxx/diagnostics/algorithm.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/algorithm.nodiscard.verify.cpp
index 29a2af9fe8..1153565f9a 100644
--- a/libcxx/test/libcxx/diagnostics/algorithm.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/algorithm.nodiscard.verify.cpp
@@ -18,7 +18,7 @@ struct P {
};
void test() {
- int arr[1] = { 1 };
+ int arr[1] = {1};
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
std::adjacent_find(std::begin(arr), std::end(arr));
@@ -62,32 +62,27 @@ void test() {
std::equal(std::begin(arr), std::end(arr), std::begin(arr));
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::equal(std::begin(arr), std::end(arr), std::begin(arr),
- std::greater<int>());
+ std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::greater<int>());
#if TEST_STD_VER >= 14
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr));
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr),
- std::greater<int>());
+ std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater<int>());
#endif
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
std::find_end(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr));
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::find_end(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr),
- std::greater<int>());
+ std::find_end(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater<int>());
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::find_first_of(std::begin(arr), std::end(arr), std::begin(arr),
- std::end(arr));
+ std::find_first_of(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr));
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::find_first_of(std::begin(arr), std::end(arr), std::begin(arr),
- std::end(arr), std::greater<int>());
+ std::find_first_of(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater<int>());
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
std::find_if_not(std::begin(arr), std::end(arr), P());
@@ -105,8 +100,7 @@ void test() {
std::includes(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr));
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::includes(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr),
- std::greater<int>());
+ std::includes(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater<int>());
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
std::is_heap_until(std::begin(arr), std::end(arr));
@@ -127,17 +121,14 @@ void test() {
std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr));
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr),
- std::greater<int>());
+ std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr), std::greater<int>());
#if TEST_STD_VER >= 14
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr),
- std::end(arr));
+ std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr));
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr),
- std::end(arr), std::greater<int>());
+ std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater<int>());
#endif
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
@@ -153,19 +144,18 @@ void test() {
std::is_sorted(std::begin(arr), std::end(arr), std::greater<int>());
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::lexicographical_compare(std::begin(arr), std::end(arr), std::begin(arr),
- std::end(arr));
+ std::lexicographical_compare(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr));
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::lexicographical_compare(std::begin(arr), std::end(arr), std::begin(arr),
- std::end(arr), std::greater<int>());
+ std::lexicographical_compare(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater<int>());
#if TEST_STD_VER >= 20
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
std::lexicographical_compare_three_way(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr));
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::lexicographical_compare_three_way(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::compare_three_way());
+ std::lexicographical_compare_three_way(
+ std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::compare_three_way());
#endif
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
@@ -232,16 +222,14 @@ void test() {
std::mismatch(std::begin(arr), std::end(arr), std::begin(arr));
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::mismatch(std::begin(arr), std::end(arr), std::begin(arr),
- std::greater<int>());
+ std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::greater<int>());
#if TEST_STD_VER >= 14
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr));
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr),
- std::greater<int>());
+ std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater<int>());
#endif
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
@@ -263,13 +251,11 @@ void test() {
std::search(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr));
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::search(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr),
- std::greater<int>());
+ std::search(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater<int>());
#if TEST_STD_VER >= 17
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::search(std::begin(arr), std::end(arr),
- std::default_searcher(std::begin(arr), std::end(arr)));
+ std::search(std::begin(arr), std::end(arr), std::default_searcher(std::begin(arr), std::end(arr)));
#endif
// expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
@@ -288,77 +274,170 @@ void test() {
int range[1];
int* iter = range;
auto pred = [](auto...) { return true; };
- std::ranges::adjacent_find(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::adjacent_find(iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::all_of(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::all_of(iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::any_of(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::any_of(iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::binary_search(range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::binary_search(iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::clamp(1, 2, 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::count_if(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::count_if(iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::count(range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::count(iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::equal_range(range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::equal_range(iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::equal(range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::equal(iter, iter, iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::find_end(range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::find_end(iter, iter, iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::find_first_of(range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::find_first_of(iter, iter, iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::find_if_not(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::find_if_not(iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::find_if(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::find_if(iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::find(range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::find(iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::includes(range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::includes(iter, iter, iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::is_heap_until(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::is_heap_until(iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::is_heap(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::is_heap(iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::is_partitioned(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::is_partitioned(iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::is_permutation(range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::is_permutation(iter, iter, iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::is_sorted_until(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::is_sorted_until(iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::is_sorted(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::is_sorted(iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::lexicographical_compare(range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::lexicographical_compare(iter, iter, iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::lower_bound(range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::lower_bound(iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::max_element(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::max_element(iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::adjacent_find(
+ range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::adjacent_find(
+ iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::all_of(
+ range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::all_of(
+ iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::any_of(
+ range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::any_of(
+ iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::binary_search(
+ range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::binary_search(
+ iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::clamp(
+ 1, 2, 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::count_if(
+ range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::count_if(
+ iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::count(
+ range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::count(
+ iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::equal_range(
+ range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::equal_range(
+ iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::equal(
+ range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::equal(
+ iter,
+ iter,
+ iter,
+ iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::find_end(
+ range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::find_end(
+ iter,
+ iter,
+ iter,
+ iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::find_first_of(
+ range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::find_first_of(
+ iter,
+ iter,
+ iter,
+ iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::find_if_not(
+ range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::find_if_not(
+ iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::find_if(
+ range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::find_if(
+ iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::find(
+ range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::find(
+ iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::includes(
+ range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::includes(
+ iter,
+ iter,
+ iter,
+ iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::is_heap_until(
+ range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::is_heap_until(
+ iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::is_heap(
+ range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::is_heap(
+ iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::is_partitioned(
+ range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::is_partitioned(
+ iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::is_permutation(
+ range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::is_permutation(
+ iter,
+ iter,
+ iter,
+ iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::is_sorted_until(
+ range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::is_sorted_until(
+ iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::is_sorted(
+ range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::is_sorted(
+ iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::lexicographical_compare(
+ range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::lexicographical_compare(
+ iter,
+ iter,
+ iter,
+ iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::lower_bound(
+ range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::lower_bound(
+ iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::max_element(
+ range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::max_element(
+ iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
std::ranges::max(1, 2); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::max({1, 2, 3}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::max(
+ {1, 2, 3}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
std::ranges::max(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::minmax_element(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::minmax_element(iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::minmax(1, 2); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::minmax({1, 2, 3}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::minmax(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::mismatch(range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::mismatch(iter, iter, iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::none_of(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::none_of(iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::remove_if(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::remove_if(iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::remove(range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::remove(iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::search_n(range, 1, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::search_n(iter, iter, 1, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::search(range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::search(iter, iter, iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::unique(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::unique(iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::upper_bound(range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::upper_bound(iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::minmax_element(
+ range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::minmax_element(
+ iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::minmax(
+ 1, 2); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::minmax(
+ {1, 2, 3}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::minmax(
+ range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::mismatch(
+ range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::mismatch(
+ iter,
+ iter,
+ iter,
+ iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::none_of(
+ range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::none_of(
+ iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::remove_if(
+ range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::remove_if(
+ iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::remove(
+ range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::remove(
+ iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::search_n(
+ range, 1, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::search_n(
+ iter, iter, 1, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::search(
+ range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::search(
+ iter,
+ iter,
+ iter,
+ iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::unique(
+ range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::unique(
+ iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::upper_bound(
+ range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::upper_bound(
+ iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
#endif
#if TEST_STD_VER >= 23
diff --git a/libcxx/test/libcxx/diagnostics/bit.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/bit.nodiscard.verify.cpp
index 79cb56a6f4..ce34a8ff4d 100644
--- a/libcxx/test/libcxx/diagnostics/bit.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/bit.nodiscard.verify.cpp
@@ -15,17 +15,18 @@
#include "test_macros.h"
void func() {
- std::bit_cast<unsigned int>(42); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::bit_ceil(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::bit_cast<unsigned int>(
+ 42); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::bit_ceil(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
std::bit_floor(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
std::bit_width(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
#if TEST_STD_VER >= 23
std::byteswap(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
#endif
- std::countl_zero(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::countl_one(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::countr_zero(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::countr_one(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::countl_zero(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::countl_one(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::countr_zero(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::countr_one(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
std::has_single_bit(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::popcount(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::popcount(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/libcxx/diagnostics/cmath.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/cmath.nodiscard.verify.cpp
index dabeda7aa0..5d26290f3b 100644
--- a/libcxx/test/libcxx/diagnostics/cmath.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/cmath.nodiscard.verify.cpp
@@ -23,143 +23,163 @@ void test() {
// Without that attribute being added implicitly, this test can't be checked consistently because its result depends
// on whether we're getting libc++'s own `std::foo(double)` or the underlying C library's `foo(double)`.
#ifdef TEST_COMPILER_CLANG
- std::ceil(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
- std::fabs(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
- std::floor(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
- std::cbrt(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
- std::copysign(0., 0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
- std::fmax(0., 0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
- std::fmin(0., 0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
- std::nearbyint(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
- std::rint(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
- std::round(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
- std::trunc(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+ std::ceil(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+ std::fabs(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+ std::floor(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+ std::cbrt(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+ std::copysign(0., 0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+ std::fmax(0., 0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+ std::fmin(0., 0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+ std::nearbyint(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+ std::rint(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+ std::round(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
+ std::trunc(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}}
#endif
- std::signbit(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::signbit(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::signbit(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::signbit(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::signbit(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::fpclassify(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::fpclassify(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::fpclassify(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::fpclassify(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::fpclassify(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::isfinite(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isfinite(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isfinite(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isfinite(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isfinite(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::isinf(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isinf(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isinf(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isinf(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isinf(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::isnan(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isnan(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isnan(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isnan(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isnan(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::isnormal(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isnormal(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isnormal(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isnormal(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isnormal(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::isgreater(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isgreater(0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isgreater(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isgreater(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isgreater(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::isgreaterequal(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isgreaterequal(0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isgreaterequal(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isgreaterequal(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isgreaterequal(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::isless(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isless(0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isless(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isless(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isless(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::islessequal(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::islessequal(0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::islessequal(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::islessequal(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::islessequal(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::islessgreater(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::islessgreater(0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::islessgreater(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::islessgreater(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::islessgreater(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::isunordered(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isunordered(0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isunordered(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isunordered(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::isunordered(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::ceil(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ceil(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ceil(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ceil(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::fabs(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::fabs(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::fabs(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::fabs(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::floor(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::floor(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::floor(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::floor(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::cbrt(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::cbrt(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::cbrt(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::cbrt(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::copysign(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::copysign(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::copysign(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::copysign(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::fmax(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::fmax(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::fmax(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::fmax(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::fmin(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::fmin(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::fmin(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::fmin(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::nearbyint(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::nearbyint(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::nearbyint(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::nearbyint(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::rint(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::rint(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::rint(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::rint(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::round(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::round(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::round(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::round(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
- std::trunc(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::trunc(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::trunc(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::trunc(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::signbit(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::signbit(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::signbit(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::signbit(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::signbit(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::fpclassify(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::fpclassify(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::fpclassify(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::fpclassify(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::fpclassify(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::isfinite(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isfinite(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isfinite(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isfinite(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isfinite(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::isinf(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isinf(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isinf(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isinf(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isinf(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::isnan(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isnan(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isnan(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isnan(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isnan(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::isnormal(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isnormal(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isnormal(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isnormal(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isnormal(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::isgreater(
+ 0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isgreater(0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isgreater(
+ 0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isgreater(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isgreater(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::isgreaterequal(
+ 0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isgreaterequal(
+ 0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isgreaterequal(
+ 0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isgreaterequal(
+ 0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isgreaterequal(
+ 0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::isless(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isless(0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isless(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isless(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isless(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::islessequal(
+ 0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::islessequal(
+ 0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::islessequal(
+ 0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::islessequal(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::islessequal(
+ 0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::islessgreater(
+ 0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::islessgreater(
+ 0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::islessgreater(
+ 0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::islessgreater(
+ 0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::islessgreater(
+ 0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::isunordered(
+ 0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isunordered(
+ 0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isunordered(
+ 0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isunordered(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::isunordered(
+ 0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::ceil(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ceil(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ceil(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ceil(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::fabs(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::fabs(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::fabs(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::fabs(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::floor(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::floor(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::floor(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::floor(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::cbrt(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::cbrt(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::cbrt(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::cbrt(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::copysign(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::copysign(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::copysign(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::copysign(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::fmax(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::fmax(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::fmax(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::fmax(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::fmin(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::fmin(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::fmin(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::fmin(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::nearbyint(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::nearbyint(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::nearbyint(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::nearbyint(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::rint(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::rint(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::rint(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::rint(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::round(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::round(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::round(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::round(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+ std::trunc(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::trunc(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::trunc(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::trunc(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/libcxx/diagnostics/cstdlib.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/cstdlib.nodiscard.verify.cpp
index 50b025f690..b7493ae098 100644
--- a/libcxx/test/libcxx/diagnostics/cstdlib.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/cstdlib.nodiscard.verify.cpp
@@ -14,9 +14,9 @@
#include "test_macros.h"
void test() {
- std::abs(0l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::abs(0l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
std::abs(0ll); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
std::abs(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::abs(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::abs(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
std::abs(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/libcxx/diagnostics/future.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/future.nodiscard.verify.cpp
index 51c242998e..7e6a346898 100644
--- a/libcxx/test/libcxx/diagnostics/future.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/future.nodiscard.verify.cpp
@@ -14,5 +14,6 @@
void test() {
std::async([]() {}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::async(std::launch::any, []() {}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::async(std::launch::any, []() {
+ }); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/libcxx/diagnostics/iterator.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/iterator.nodiscard.verify.cpp
index afe60c0f64..298cdc2dff 100644
--- a/libcxx/test/libcxx/diagnostics/iterator.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/iterator.nodiscard.verify.cpp
@@ -18,7 +18,8 @@ void test() {
int c_array[] = {1, 2, 3};
std::initializer_list<int> initializer_list;
- std::empty(container); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::empty(c_array); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::empty(initializer_list); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::empty(container); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::empty(c_array); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::empty(
+ initializer_list); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/libcxx/diagnostics/memory.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/memory.nodiscard.verify.cpp
index 038d345c70..41c1e6cb8c 100644
--- a/libcxx/test/libcxx/diagnostics/memory.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/memory.nodiscard.verify.cpp
@@ -17,35 +17,44 @@
#include "test_macros.h"
void test() {
- std::get_temporary_buffer<int>(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::get_temporary_buffer<int>(
+ 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
void test_allocator_traits() {
std::allocator<int> allocator;
std::allocator_traits<std::allocator<int>> allocator_traits;
- allocator_traits.allocate(allocator, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- allocator_traits.allocate(allocator, 1, nullptr); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ allocator_traits.allocate(
+ allocator, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ allocator_traits.allocate(
+ allocator,
+ 1,
+ nullptr); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
void test_allocator() {
std::allocator<int> allocator;
- allocator.allocate(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ allocator.allocate(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
#if TEST_STD_VER <= 17
- allocator.allocate(1, nullptr); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ allocator.allocate(
+ 1, nullptr); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
#endif
#if TEST_STD_VER >= 23
- allocator.allocate_at_least(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ allocator.allocate_at_least(
+ 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
#endif
}
void test_const_allocator() {
std::allocator<const int> allocator;
- allocator.allocate(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ allocator.allocate(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
#if TEST_STD_VER <= 17
- allocator.allocate(1, nullptr); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ allocator.allocate(
+ 1, nullptr); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
#endif
#if TEST_STD_VER >= 23
- allocator.allocate_at_least(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ allocator.allocate_at_least(
+ 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
#endif
}
diff --git a/libcxx/test/libcxx/diagnostics/memory_resource.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/memory_resource.nodiscard.verify.cpp
index 8859f639f9..de5f7b88d0 100644
--- a/libcxx/test/libcxx/diagnostics/memory_resource.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/memory_resource.nodiscard.verify.cpp
@@ -19,5 +19,6 @@ void test() {
resource->allocate(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
std::pmr::polymorphic_allocator<int> polymorphic_allocator;
- polymorphic_allocator.allocate(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ polymorphic_allocator.allocate(
+ 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/libcxx/diagnostics/mutex.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/mutex.nodiscard.verify.cpp
index d0570c132f..74a025ec1d 100644
--- a/libcxx/test/libcxx/diagnostics/mutex.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/mutex.nodiscard.verify.cpp
@@ -17,5 +17,7 @@
void test() {
std::mutex mutex;
std::lock_guard{mutex}; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::lock_guard{mutex, std::adopt_lock}; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::lock_guard{
+ mutex,
+ std::adopt_lock}; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/libcxx/diagnostics/new.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/new.nodiscard.verify.cpp
index ddb6c20cd1..d73d949c6e 100644
--- a/libcxx/test/libcxx/diagnostics/new.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/new.nodiscard.verify.cpp
@@ -15,14 +15,27 @@
#include "test_macros.h"
void test() {
- ::operator new(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- ::operator new(0, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- ::operator new[](0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- ::operator new[](0, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- ::operator new(0, std::align_val_t{1}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- ::operator new(0, std::align_val_t{1}, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- ::operator new[](0, std::align_val_t{1}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- ::operator new[](0, std::align_val_t{1}, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ ::operator new(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ ::operator new(
+ 0, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ ::operator new[](0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ ::operator new[](
+ 0, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ ::operator new(0,
+ std::align_val_t{
+ 1}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ ::operator new(
+ 0,
+ std::align_val_t{1},
+ std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ ::operator new[](
+ 0,
+ std::align_val_t{
+ 1}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ ::operator new[](
+ 0,
+ std::align_val_t{1},
+ std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
#if TEST_STD_VER >= 17
int* ptr = nullptr;
diff --git a/libcxx/test/libcxx/diagnostics/pstl.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/pstl.nodiscard.verify.cpp
index ed1a0cc7d3..0c6966f1cd 100644
--- a/libcxx/test/libcxx/diagnostics/pstl.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/pstl.nodiscard.verify.cpp
@@ -17,10 +17,23 @@
#include <iterator>
void test() {
- int a[] = {1};
+ int a[] = {1};
auto pred = [](auto) { return false; };
- std::all_of(std::execution::par, std::begin(a), std::end(a), pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::any_of(std::execution::par, std::begin(a), std::end(a), pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::none_of(std::execution::par, std::begin(a), std::end(a), pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::is_partitioned(std::execution::par, std::begin(a), std::end(a), pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::all_of(std::execution::par,
+ std::begin(a),
+ std::end(a),
+ pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::any_of(std::execution::par,
+ std::begin(a),
+ std::end(a),
+ pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::none_of(std::execution::par,
+ std::begin(a),
+ std::end(a),
+ pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::is_partitioned(
+ std::execution::par,
+ std::begin(a),
+ std::end(a),
+ pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/libcxx/diagnostics/ranges.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/ranges.nodiscard.verify.cpp
index 9197696cd9..0d9c56fd5a 100644
--- a/libcxx/test/libcxx/diagnostics/ranges.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/ranges.nodiscard.verify.cpp
@@ -21,33 +21,54 @@ void test() {
std::allocator<int> alloc;
auto rvalue_view = std::views::as_rvalue(range);
- std::views::as_rvalue(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::views::as_rvalue(rvalue_view); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::views::as_rvalue(
+ range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::views::as_rvalue(
+ rvalue_view); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::views::chunk_by(pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::views::chunk_by(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::views::chunk_by(
+ pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::views::chunk_by(
+ range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::views::drop(pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::views::drop(std::views::repeat(1)); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::views::drop(pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::views::drop(std::views::repeat(
+ 1)); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::views::repeat(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::views::repeat(1, std::unreachable_sentinel); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::views::repeat(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::views::repeat(
+ 1,
+ std::
+ unreachable_sentinel); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::views::split(range, 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::views::split(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::views::split(
+ range, 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::views::split(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::views::take(range, 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::views::take(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::views::take(
+ range, 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::views::take(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::views::take(std::views::repeat(3), 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::views::take(std::views::repeat(3, std::unreachable_sentinel), 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::views::take(std::views::repeat(3),
+ 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::views::take(std::views::repeat(3, std::unreachable_sentinel),
+ 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::to<std::vector<int>>(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::to<std::vector<int>>(range, alloc); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::to<std::vector>(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::ranges::to<std::vector>(range, alloc); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- range | std::ranges::to<std::vector<int>>(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- range | std::ranges::to<std::vector<int>>(alloc); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- range | std::ranges::to<std::vector>(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- range | std::ranges::to<std::vector>(alloc); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::to<std::vector<int>>(
+ range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::to<std::vector<int>>(
+ range, alloc); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::to<std::vector>(
+ range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::ranges::to<std::vector>(
+ range, alloc); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ range | std::ranges::to<std::vector<
+ int>>(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ range | std::ranges::to<std::vector<int>>(
+ alloc); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ range |
+ std::ranges::to<
+ std::vector>(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ range | std::ranges::to<std::vector>(
+ alloc); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/libcxx/diagnostics/scoped_allocator.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/scoped_allocator.nodiscard.verify.cpp
index 4c4110e825..6165554a9b 100644
--- a/libcxx/test/libcxx/diagnostics/scoped_allocator.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/scoped_allocator.nodiscard.verify.cpp
@@ -16,5 +16,6 @@
void test() {
std::scoped_allocator_adaptor<std::allocator<int>> alloc;
alloc.allocate(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- alloc.allocate(1, nullptr); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ alloc.allocate(
+ 1, nullptr); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp
index 0ca56adc82..28e0a532db 100644
--- a/libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/unordered_map.nodiscard.verify.cpp
@@ -19,5 +19,6 @@ void unordered_map_test() {
void unordered_multimap_test() {
std::unordered_multimap<int, int> unordered_multimap;
- unordered_multimap.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ unordered_multimap
+ .empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/libcxx/diagnostics/unordered_set.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/unordered_set.nodiscard.verify.cpp
index 3c939edb0e..bdcb7ec3ef 100644
--- a/libcxx/test/libcxx/diagnostics/unordered_set.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/unordered_set.nodiscard.verify.cpp
@@ -19,5 +19,6 @@ void unordered_set_test() {
void unordered_multiset_test() {
std::unordered_multiset<int> unordered_multiset;
- unordered_multiset.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ unordered_multiset
+ .empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/libcxx/diagnostics/utility.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/utility.nodiscard.verify.cpp
index e39e52de31..ed45d647eb 100644
--- a/libcxx/test/libcxx/diagnostics/utility.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/utility.nodiscard.verify.cpp
@@ -15,10 +15,11 @@
void test() {
int i = 0;
- std::forward<int>(i); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::forward<int>(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::move(i); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::move_if_noexcept(i); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::forward<int>(i); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::forward<int>(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::move(i); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::move_if_noexcept(
+ i); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
#if TEST_STD_VER >= 17
std::as_const(i); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
``````````
</details>
https://github.com/llvm/llvm-project/pull/87094
More information about the libcxx-commits
mailing list