[libcxx-commits] [pstl] 7f607ac - [pstl] Use logical operator for loop condition in tests

via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 13 10:11:52 PDT 2021


Author: zoecarver
Date: 2021-05-13T10:11:40-07:00
New Revision: 7f607ac6af0e2ee8a7d721d3ba427536deffcd3f

URL: https://github.com/llvm/llvm-project/commit/7f607ac6af0e2ee8a7d721d3ba427536deffcd3f
DIFF: https://github.com/llvm/llvm-project/commit/7f607ac6af0e2ee8a7d721d3ba427536deffcd3f.diff

LOG: [pstl] Use logical operator for loop condition in tests

Fix a probable typo in two PSTL tests that causes warnings with GCC.

Patch by Jonathan Wakely (jwakely).

Reviewed By: zoecarver

Differential Revision: https://reviews.llvm.org/D102327

Added: 
    

Modified: 
    pstl/test/std/algorithms/alg.nonmodifying/find_end.pass.cpp
    pstl/test/std/algorithms/alg.nonmodifying/search_n.pass.cpp

Removed: 
    


################################################################################
diff  --git a/pstl/test/std/algorithms/alg.nonmodifying/find_end.pass.cpp b/pstl/test/std/algorithms/alg.nonmodifying/find_end.pass.cpp
index c72d6239273ec..1e07a96003a5c 100644
--- a/pstl/test/std/algorithms/alg.nonmodifying/find_end.pass.cpp
+++ b/pstl/test/std/algorithms/alg.nonmodifying/find_end.pass.cpp
@@ -81,7 +81,7 @@ test(const std::size_t bits)
             for (auto r : res)
             {
                 std::size_t i = r, isub = 0;
-                for (; i < n1 & isub < n2; ++i, ++isub)
+                for (; i < n1 && isub < n2; ++i, ++isub)
                     in[i] = sub[isub];
                 invoke_on_all_policies(test_one_policy(), in.begin(), in.begin() + n1, sub.begin(), sub.begin() + n2,
                                        std::equal_to<T>());

diff  --git a/pstl/test/std/algorithms/alg.nonmodifying/search_n.pass.cpp b/pstl/test/std/algorithms/alg.nonmodifying/search_n.pass.cpp
index 3e7868a11e5dc..d009df919a301 100644
--- a/pstl/test/std/algorithms/alg.nonmodifying/search_n.pass.cpp
+++ b/pstl/test/std/algorithms/alg.nonmodifying/search_n.pass.cpp
@@ -71,7 +71,7 @@ test()
             {
                 Sequence<T> in(n1, [](std::size_t) { return T(0); });
                 std::size_t i = r, isub = 0;
-                for (; i < n1 & isub < n2; ++i, ++isub)
+                for (; i < n1 && isub < n2; ++i, ++isub)
                     in[i] = value;
 
                 invoke_on_all_policies(test_one_policy(), in.begin(), in.begin() + n1, n2, value, std::equal_to<T>());


        


More information about the libcxx-commits mailing list