Author: stl_msft
Date: Wed Nov 23 16:02:35 2016
New Revision: 287825

URL: http://llvm.org/viewvc/llvm-project?rev=287825&view=rev
Log:
[libcxx] [test] D27018: Fix MSVC warning C4018 "signed/unsigned mismatch", part 
5/12.

Various changes:

test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp
Change M from unsigned to int. It's compared against "int x",
and we binary_search() for it within a vector<int>.

test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp
test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp
Add static_cast<unsigned> when comparing int to unsigned.

test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
Change unsigned indices to int when we're being given int as a bound.

Modified:
    
libcxx/trunk/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp
    
libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp
    
libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp
    
libcxx/trunk/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp

Modified: 
libcxx/trunk/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp?rev=287825&r1=287824&r2=287825&view=diff
==============================================================================
--- 
libcxx/trunk/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp
 Wed Nov 23 16:02:35 2016
@@ -34,7 +34,7 @@ void
 test()
 {
     const unsigned N = 1000;
-    const unsigned M = 10;
+    const int M = 10;
     std::vector<int> v(N);
     int x = 0;
     for (std::size_t i = 0; i < v.size(); ++i)

Modified: 
libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp?rev=287825&r1=287824&r2=287825&view=diff
==============================================================================
--- 
libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp
 Wed Nov 23 16:02:35 2016
@@ -34,7 +34,7 @@ double
 I(double x, unsigned a, unsigned b)
 {
     double r = 0;
-    for (int j = a; j <= a+b-1; ++j)
+    for (int j = a; static_cast<unsigned>(j) <= a+b-1; ++j)
         r += fac(a+b-1)/(fac(j) * fac(a + b - 1 - j)) * std::pow(x, j) *
              std::pow(1-x, a+b-1-j);
     return r;

Modified: 
libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp?rev=287825&r1=287824&r2=287825&view=diff
==============================================================================
--- 
libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp
 Wed Nov 23 16:02:35 2016
@@ -34,7 +34,7 @@ double
 I(double x, unsigned a, unsigned b)
 {
     double r = 0;
-    for (int j = a; j <= a+b-1; ++j)
+    for (int j = a; static_cast<unsigned>(j) <= a+b-1; ++j)
         r += fac(a+b-1)/(fac(j) * fac(a + b - 1 - j)) * std::pow(x, j) *
              std::pow(1-x, a+b-1-j);
     return r;

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp?rev=287825&r1=287824&r2=287825&view=diff
==============================================================================
--- 
libcxx/trunk/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp 
Wed Nov 23 16:02:35 2016
@@ -62,7 +62,7 @@ test(Tp n, Tp c)
     S s2(n, c);
     LIBCPP_ASSERT(s2.__invariants());
     assert(s2.size() == n);
-    for (unsigned i = 0; i < n; ++i)
+    for (int i = 0; i < n; ++i)
         assert(s2[i] == c);
     assert(s2.get_allocator() == A());
     assert(s2.capacity() >= s2.size());
@@ -78,7 +78,7 @@ test(Tp n, Tp c, const A& a)
     S s2(n, c, a);
     LIBCPP_ASSERT(s2.__invariants());
     assert(s2.size() == n);
-    for (unsigned i = 0; i < n; ++i)
+    for (int i = 0; i < n; ++i)
         assert(s2[i] == c);
     assert(s2.get_allocator() == a);
     assert(s2.capacity() >= s2.size());


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to