[libcxx] r287822 - [libcxx] [test] D27014: Fix MSVC warning C4018 "signed/unsigned mismatch", part 2/12.
Stephan T. Lavavej via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 23 14:01:59 PST 2016
Author: stl_msft
Date: Wed Nov 23 16:01:58 2016
New Revision: 287822
URL: http://llvm.org/viewvc/llvm-project?rev=287822&view=rev
Log:
[libcxx] [test] D27014: Fix MSVC warning C4018 "signed/unsigned mismatch", part 2/12.
Add static_cast<std::size_t> when comparing int to std::size_t.
Also, include <cstddef> when it wasn't already being included.
Modified:
libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp
libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp
libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp
libcxx/trunk/test/std/containers/associative/map/map.access/iterator.pass.cpp
libcxx/trunk/test/std/containers/associative/set/iterator.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp (original)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp Wed Nov 23 16:01:58 2016
@@ -19,6 +19,7 @@
#include <functional>
#include <vector>
#include <cassert>
+#include <cstddef>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
@@ -77,7 +78,7 @@ int main()
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::vector<std::unique_ptr<int> > v(1000);
- for (int i = 0; i < v.size(); ++i)
+ for (int i = 0; static_cast<std::size_t>(i) < v.size(); ++i)
v[i].reset(new int(i));
std::nth_element(v.begin(), v.begin() + v.size()/2, v.end(), indirect_less());
assert(*v[v.size()/2] == v.size()/2);
Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp (original)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp Wed Nov 23 16:01:58 2016
@@ -19,6 +19,7 @@
#include <vector>
#include <functional>
#include <cassert>
+#include <cstddef>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
@@ -83,10 +84,10 @@ int main()
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::vector<std::unique_ptr<int> > v(1000);
- for (int i = 0; i < v.size(); ++i)
+ for (int i = 0; static_cast<std::size_t>(i) < v.size(); ++i)
v[i].reset(new int(i));
std::partial_sort(v.begin(), v.begin() + v.size()/2, v.end(), indirect_less());
- for (int i = 0; i < v.size()/2; ++i)
+ for (int i = 0; static_cast<std::size_t>(i) < v.size()/2; ++i)
assert(*v[i] == i);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp (original)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp Wed Nov 23 16:01:58 2016
@@ -19,6 +19,7 @@
#include <functional>
#include <vector>
#include <cassert>
+#include <cstddef>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
@@ -35,7 +36,7 @@ int main()
{
{
std::vector<int> v(1000);
- for (int i = 0; i < v.size(); ++i)
+ for (int i = 0; static_cast<std::size_t>(i) < v.size(); ++i)
v[i] = i;
std::sort(v.begin(), v.end(), std::greater<int>());
std::reverse(v.begin(), v.end());
@@ -45,7 +46,7 @@ int main()
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::vector<std::unique_ptr<int> > v(1000);
- for (int i = 0; i < v.size(); ++i)
+ for (int i = 0; static_cast<std::size_t>(i) < v.size(); ++i)
v[i].reset(new int(i));
std::sort(v.begin(), v.end(), indirect_less());
assert(std::is_sorted(v.begin(), v.end(), indirect_less()));
Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp (original)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp Wed Nov 23 16:01:58 2016
@@ -19,6 +19,7 @@
#include <functional>
#include <vector>
#include <cassert>
+#include <cstddef>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
@@ -71,7 +72,7 @@ int main()
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::vector<std::unique_ptr<int> > v(1000);
- for (int i = 0; i < v.size(); ++i)
+ for (int i = 0; static_cast<std::size_t>(i) < v.size(); ++i)
v[i].reset(new int(i));
std::stable_sort(v.begin(), v.end(), indirect_less());
assert(std::is_sorted(v.begin(), v.end(), indirect_less()));
Modified: libcxx/trunk/test/std/containers/associative/map/map.access/iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.access/iterator.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.access/iterator.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/associative/map/map.access/iterator.pass.cpp Wed Nov 23 16:01:58 2016
@@ -28,6 +28,7 @@
#include <map>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "min_allocator.h"
@@ -70,7 +71,7 @@ int main()
i = m.begin();
std::map<int, double>::const_iterator k = i;
assert(i == k);
- for (int j = 1; j <= m.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
{
assert(i->first == j);
assert(i->second == 1);
@@ -114,7 +115,7 @@ int main()
assert(std::distance(m.crbegin(), m.crend()) == m.size());
std::map<int, double>::const_iterator i;
i = m.begin();
- for (int j = 1; j <= m.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
{
assert(i->first == j);
assert(i->second == 1);
@@ -157,7 +158,7 @@ int main()
i = m.begin();
std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i;
assert(i == k);
- for (int j = 1; j <= m.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
{
assert(i->first == j);
assert(i->second == 1);
@@ -201,7 +202,7 @@ int main()
assert(std::distance(m.crbegin(), m.crend()) == m.size());
std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator i;
i = m.begin();
- for (int j = 1; j <= m.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
{
assert(i->first == j);
assert(i->second == 1);
Modified: libcxx/trunk/test/std/containers/associative/set/iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/iterator.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/iterator.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/associative/set/iterator.pass.cpp Wed Nov 23 16:01:58 2016
@@ -28,6 +28,7 @@
#include <set>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "min_allocator.h"
@@ -70,7 +71,7 @@ int main()
i = m.begin();
std::set<int>::const_iterator k = i;
assert(i == k);
- for (int j = 1; j <= m.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
assert(*i == j);
}
{
@@ -109,7 +110,7 @@ int main()
assert(std::distance(m.crbegin(), m.crend()) == m.size());
std::set<int>::const_iterator i;
i = m.begin();
- for (int j = 1; j <= m.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
assert(*i == j);
}
#if TEST_STD_VER >= 11
@@ -149,7 +150,7 @@ int main()
i = m.begin();
std::set<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
assert(i == k);
- for (int j = 1; j <= m.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
assert(*i == j);
}
{
@@ -188,7 +189,7 @@ int main()
assert(std::distance(m.crbegin(), m.crend()) == m.size());
std::set<int, std::less<int>, min_allocator<int>>::const_iterator i;
i = m.begin();
- for (int j = 1; j <= m.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
assert(*i == j);
}
#endif
Modified: libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp Wed Nov 23 16:01:58 2016
@@ -52,7 +52,7 @@ test(C& c1, int size)
assert(c1.size() == size);
assert(distance(c1.begin(), c1.end()) == c1.size());
CI i = c1.begin();
- for (int j = 0; j < std::min(c1_osize, c1.size()); ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < std::min(c1_osize, c1.size()); ++j, ++i)
assert(*i == j);
for (std::size_t j = c1_osize; j < c1.size(); ++j, ++i)
assert(*i == 0);
Modified: libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp Wed Nov 23 16:01:58 2016
@@ -52,7 +52,7 @@ test(C& c1, int size, int x)
assert(c1.size() == size);
assert(distance(c1.begin(), c1.end()) == c1.size());
CI i = c1.begin();
- for (int j = 0; j < std::min(c1_osize, c1.size()); ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < std::min(c1_osize, c1.size()); ++j, ++i)
assert(*i == j);
for (std::size_t j = c1_osize; j < c1.size(); ++j, ++i)
assert(*i == x);
Modified: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp Wed Nov 23 16:01:58 2016
@@ -15,6 +15,7 @@
#include <algorithm>
#include <iterator>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -45,7 +46,7 @@ void
test(int P, C& c1)
{
typedef typename C::iterator I;
- assert(P < c1.size());
+ assert(static_cast<std::size_t>(P) < c1.size());
std::size_t c1_osize = c1.size();
I i = c1.erase(c1.cbegin() + P);
assert(i == c1.begin() + P);
@@ -55,7 +56,7 @@ test(int P, C& c1)
int j = 0;
for (; j < P; ++j, ++i)
assert(*i == j);
- for (++j; j < c1_osize; ++j, ++i)
+ for (++j; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
Modified: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp Wed Nov 23 16:01:58 2016
@@ -17,6 +17,7 @@
#include <algorithm>
#include <iterator>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -47,7 +48,7 @@ void
test(int P, C& c1, int size)
{
typedef typename C::iterator I;
- assert(P + size <= c1.size());
+ assert(static_cast<std::size_t>(P + size) <= c1.size());
std::size_t c1_osize = c1.size();
I i = c1.erase(c1.cbegin() + P, c1.cbegin() + (P + size));
assert(i == c1.begin() + P);
@@ -57,7 +58,7 @@ test(int P, C& c1, int size)
int j = 0;
for (; j < P; ++j, ++i)
assert(*i == j);
- for (j += size; j < c1_osize; ++j, ++i)
+ for (j += size; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
Modified: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp Wed Nov 23 16:01:58 2016
@@ -16,6 +16,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "test_iterators.h"
@@ -61,9 +62,9 @@ test(int P, const C& c0, const C& c2)
i = c1.begin();
for (int j = 0; j < P; ++j, ++i)
assert(*i == j);
- for (int j = 0; j < c2.size(); ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < c2.size(); ++j, ++i)
assert(*i == j);
- for (int j = P; j < c1_osize; ++j, ++i)
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
{
@@ -78,9 +79,9 @@ test(int P, const C& c0, const C& c2)
i = c1.begin();
for (int j = 0; j < P; ++j, ++i)
assert(*i == j);
- for (int j = 0; j < c2.size(); ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < c2.size(); ++j, ++i)
assert(*i == j);
- for (int j = P; j < c1_osize; ++j, ++i)
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
{
@@ -95,9 +96,9 @@ test(int P, const C& c0, const C& c2)
i = c1.begin();
for (int j = 0; j < P; ++j, ++i)
assert(*i == j);
- for (int j = 0; j < c2.size(); ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < c2.size(); ++j, ++i)
assert(*i == j);
- for (int j = P; j < c1_osize; ++j, ++i)
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
}
@@ -176,9 +177,9 @@ testI(int P, C& c1, const C& c2)
i = c1.begin();
for (int j = 0; j < P; ++j, ++i)
assert(*i == j);
- for (int j = 0; j < c2.size(); ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < c2.size(); ++j, ++i)
assert(*i == j);
- for (int j = P; j < c1_osize; ++j, ++i)
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
Modified: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp Wed Nov 23 16:01:58 2016
@@ -15,6 +15,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "MoveOnly.h"
#include "min_allocator.h"
@@ -57,7 +58,7 @@ test(int P, C& c1, int x)
assert(*i == MoveOnly(j));
assert(*i == MoveOnly(x));
++i;
- for (int j = P; j < c1_osize; ++j, ++i)
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == MoveOnly(j));
}
Modified: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp Wed Nov 23 16:01:58 2016
@@ -15,6 +15,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "min_allocator.h"
@@ -56,7 +57,7 @@ test(int P, C& c1, int size, int x)
assert(*i == j);
for (int j = 0; j < size; ++j, ++i)
assert(*i == x);
- for (int j = P; j < c1_osize; ++j, ++i)
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
Modified: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp Wed Nov 23 16:01:58 2016
@@ -13,6 +13,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "min_allocator.h"
@@ -54,7 +55,7 @@ test(int P, C& c1, int x)
assert(*i == j);
assert(*i == x);
++i;
- for (int j = P; j < c1_osize; ++j, ++i)
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
Modified: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp Wed Nov 23 16:01:58 2016
@@ -13,6 +13,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -48,7 +49,7 @@ test(C& c1)
assert(c1.size() == c1_osize - 1);
assert(distance(c1.begin(), c1.end()) == c1.size());
I i = c1.begin();
- for (int j = 0; j < c1.size(); ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < c1.size(); ++j, ++i)
assert(*i == j);
}
Modified: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp Wed Nov 23 16:01:58 2016
@@ -13,6 +13,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -48,7 +49,7 @@ test(C& c1)
assert(c1.size() == c1_osize - 1);
assert(distance(c1.begin(), c1.end()) == c1.size());
I i = c1.begin();
- for (int j = 1; j < c1.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) < c1.size(); ++j, ++i)
assert(*i == j);
}
Modified: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp Wed Nov 23 16:01:58 2016
@@ -13,6 +13,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -50,7 +51,7 @@ test(C& c1, int x)
I i = c1.begin();
assert(*i == x);
++i;
- for (int j = 0; j < c1_osize; ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
Modified: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp Wed Nov 23 16:01:58 2016
@@ -13,6 +13,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "MoveOnly.h"
#include "min_allocator.h"
@@ -53,7 +54,7 @@ test(C& c1, int x)
I i = c1.begin();
assert(*i == MoveOnly(x));
++i;
- for (int j = 0; j < c1_osize; ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == MoveOnly(j));
}
Modified: libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp Wed Nov 23 16:01:58 2016
@@ -13,6 +13,7 @@
#include <vector>
#include <cassert>
+#include <cstddef>
#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -24,27 +25,27 @@ int main()
c.push_back(0);
assert(c.size() == 1);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(1);
assert(c.size() == 2);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(2);
assert(c.size() == 3);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(3);
assert(c.size() == 4);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(4);
assert(c.size() == 5);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
}
{
@@ -55,27 +56,27 @@ int main()
c.push_back(0);
assert(c.size() == 1);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(1);
assert(c.size() == 2);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(2);
assert(c.size() == 3);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(3);
assert(c.size() == 4);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(4);
assert(c.size() == 5);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
}
#if TEST_STD_VER >= 11
@@ -84,27 +85,27 @@ int main()
c.push_back(0);
assert(c.size() == 1);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(1);
assert(c.size() == 2);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(2);
assert(c.size() == 3);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(3);
assert(c.size() == 4);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(4);
assert(c.size() == 5);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
}
#endif
Modified: libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp?rev=287822&r1=287821&r2=287822&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp Wed Nov 23 16:01:58 2016
@@ -13,6 +13,7 @@
#include <vector>
#include <cassert>
+#include <cstddef>
#include "MoveOnly.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -26,27 +27,27 @@ int main()
c.push_back(MoveOnly(0));
assert(c.size() == 1);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(1));
assert(c.size() == 2);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(2));
assert(c.size() == 3);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(3));
assert(c.size() == 4);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(4));
assert(c.size() == 5);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
}
{
@@ -57,27 +58,27 @@ int main()
c.push_back(MoveOnly(0));
assert(c.size() == 1);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(1));
assert(c.size() == 2);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(2));
assert(c.size() == 3);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(3));
assert(c.size() == 4);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(4));
assert(c.size() == 5);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
}
#if TEST_STD_VER >= 11
@@ -86,27 +87,27 @@ int main()
c.push_back(MoveOnly(0));
assert(c.size() == 1);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(1));
assert(c.size() == 2);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(2));
assert(c.size() == 3);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(3));
assert(c.size() == 4);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(4));
assert(c.size() == 5);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
}
#endif
More information about the cfe-commits
mailing list