[libcxx-commits] [libcxx] r357637 - Cleanup test failures in no discard tests.

Eric Fiselier via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 3 14:17:34 PDT 2019


Author: ericwf
Date: Wed Apr  3 14:17:34 2019
New Revision: 357637

URL: http://llvm.org/viewvc/llvm-project?rev=357637&view=rev
Log:
Cleanup test failures in no discard tests.

Modified:
    libcxx/trunk/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp
    libcxx/trunk/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp

Modified: libcxx/trunk/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp?rev=357637&r1=357636&r2=357637&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp (original)
+++ libcxx/trunk/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp Wed Apr  3 14:17:34 2019
@@ -54,11 +54,13 @@ int main(int, char**) {
   // expected-error-re at +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 at +1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
   std::clamp(2, 1, 3);
 
   // expected-error-re at +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 at +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 at +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 at +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 at +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 at +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 at +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 at +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 at +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 at +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 at +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 at +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 at +1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
   std::unique(std::begin(arr), std::end(arr));

Modified: libcxx/trunk/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp?rev=357637&r1=357636&r2=357637&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp (original)
+++ libcxx/trunk/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp Wed Apr  3 14:17:34 2019
@@ -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);




More information about the libcxx-commits mailing list