diff options
| author | Eric Fiselier <eric@efcs.ca> | 2019-04-03 21:17:34 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2019-04-03 21:17:34 +0000 |
| commit | 4d50879d9c93cdadfd6b0918931907c821d06520 (patch) | |
| tree | 11c0164243e3df5e6ef468f4a67f4bc15f61acb0 /libcxx/test | |
| parent | 0b874c7c60583d8a4a0ed63ca188c01fc375fc07 (diff) | |
| download | bcm5719-llvm-4d50879d9c93cdadfd6b0918931907c821d06520.tar.gz bcm5719-llvm-4d50879d9c93cdadfd6b0918931907c821d06520.zip | |
Cleanup test failures in no discard tests.
llvm-svn: 357637
Diffstat (limited to 'libcxx/test')
| -rw-r--r-- | libcxx/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp | 10 | ||||
| -rw-r--r-- | libcxx/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp | 16 |
2 files changed, 26 insertions, 0 deletions
diff --git a/libcxx/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp b/libcxx/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp index 91a63f09e9f..543fd2456f6 100644 --- a/libcxx/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp +++ b/libcxx/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp @@ -54,11 +54,13 @@ int main(int, char**) { // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} std::binary_search(std::begin(arr), std::end(arr), 1, std::greater<int>()); +#if TEST_STD_VER >= 17 // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} std::clamp(2, 1, 3); // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} std::clamp(2, 1, 3, std::greater<int>()); +#endif // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} std::count_if(std::begin(arr), std::end(arr), P()); @@ -79,12 +81,14 @@ int main(int, char**) { std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::greater<int>()); +#if TEST_STD_VER >= 14 // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater<int>()); +#endif // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} std::find_end(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); @@ -142,6 +146,7 @@ int main(int, char**) { std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr), std::greater<int>()); +#if TEST_STD_VER >= 14 // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); @@ -149,6 +154,7 @@ int main(int, char**) { // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater<int>()); +#endif // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} std::is_sorted_until(std::begin(arr), std::end(arr)); @@ -237,12 +243,14 @@ int main(int, char**) { std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::greater<int>()); +#if TEST_STD_VER >= 14 // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater<int>()); +#endif // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} std::none_of(std::begin(arr), std::end(arr), P()); @@ -266,9 +274,11 @@ int main(int, char**) { std::search(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater<int>()); +#if TEST_STD_VER >= 17 // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} std::search(std::begin(arr), std::end(arr), std::default_searcher(std::begin(arr), std::end(arr))); +#endif // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} std::unique(std::begin(arr), std::end(arr)); diff --git a/libcxx/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp b/libcxx/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp index efc2bc82dcc..e06ad97d97a 100644 --- a/libcxx/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp +++ b/libcxx/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp @@ -37,8 +37,10 @@ int main(int, char**) { std::any_of(std::begin(arr), std::end(arr), P()); std::binary_search(std::begin(arr), std::end(arr), 1); std::binary_search(std::begin(arr), std::end(arr), 1, std::greater<int>()); +#if TEST_STD_VER >= 17 std::clamp(2, 1, 3); std::clamp(2, 1, 3, std::greater<int>()); +#endif std::count_if(std::begin(arr), std::end(arr), P()); std::count(std::begin(arr), std::end(arr), 1); std::equal_range(std::begin(arr), std::end(arr), 1); @@ -46,9 +48,11 @@ int main(int, char**) { std::equal(std::begin(arr), std::end(arr), std::begin(arr)); std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::greater<int>()); +#if TEST_STD_VER >= 14 std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater<int>()); +#endif std::find_end(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); std::find_end(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater<int>()); @@ -71,10 +75,12 @@ int main(int, char**) { std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr)); std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr), std::greater<int>()); +#if TEST_STD_VER >= 14 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), std::greater<int>()); +#endif std::is_sorted_until(std::begin(arr), std::end(arr)); std::is_sorted_until(std::begin(arr), std::end(arr), std::greater<int>()); std::is_sorted(std::begin(arr), std::end(arr)); @@ -89,26 +95,34 @@ int main(int, char**) { std::max_element(std::begin(arr), std::end(arr), std::greater<int>()); std::max(1, 2); std::max(1, 2, std::greater<int>()); +#if TEST_STD_VER >= 11 std::max({1, 2, 3}); std::max({1, 2, 3}, std::greater<int>()); +#endif std::min_element(std::begin(arr), std::end(arr)); std::min_element(std::begin(arr), std::end(arr), std::greater<int>()); std::min(1, 2); std::min(1, 2, std::greater<int>()); +#if TEST_STD_VER >= 11 std::min({1, 2, 3}); std::min({1, 2, 3}, std::greater<int>()); +#endif std::minmax_element(std::begin(arr), std::end(arr)); std::minmax_element(std::begin(arr), std::end(arr), std::greater<int>()); std::minmax(1, 2); std::minmax(1, 2, std::greater<int>()); +#if TEST_STD_VER >= 11 std::minmax({1, 2, 3}); std::minmax({1, 2, 3}, std::greater<int>()); +#endif std::mismatch(std::begin(arr), std::end(arr), std::begin(arr)); std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::greater<int>()); +#if TEST_STD_VER >= 14 std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater<int>()); +#endif std::none_of(std::begin(arr), std::end(arr), P()); std::remove_if(std::begin(arr), std::end(arr), P()); std::remove(std::begin(arr), std::end(arr), 1); @@ -117,8 +131,10 @@ int main(int, char**) { std::search(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); std::search(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater<int>()); +#if TEST_STD_VER >= 17 std::search(std::begin(arr), std::end(arr), std::default_searcher(std::begin(arr), std::end(arr))); +#endif std::unique(std::begin(arr), std::end(arr)); std::unique(std::begin(arr), std::end(arr), std::greater<int>()); std::upper_bound(std::begin(arr), std::end(arr), 1); |

