[libcxx] r344416 - Update all the max_size tests to eliminate signed/unsigned comparison warnings. NFC
Marshall Clow
mclow.lists at gmail.com
Fri Oct 12 14:22:15 PDT 2018
Author: marshall
Date: Fri Oct 12 14:22:15 2018
New Revision: 344416
URL: http://llvm.org/viewvc/llvm-project?rev=344416&view=rev
Log:
Update all the max_size tests to eliminate signed/unsigned comparison warnings. NFC
Modified:
libcxx/trunk/test/std/containers/associative/map/map.access/max_size.pass.cpp
libcxx/trunk/test/std/containers/associative/multimap/max_size.pass.cpp
libcxx/trunk/test/std/containers/associative/multiset/max_size.pass.cpp
libcxx/trunk/test/std/containers/associative/set/max_size.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp
libcxx/trunk/test/std/containers/sequences/forwardlist/max_size.pass.cpp
libcxx/trunk/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp
libcxx/trunk/test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.map/max_size.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multimap/max_size.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multiset/max_size.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.set/max_size.pass.cpp
Modified: libcxx/trunk/test/std/containers/associative/map/map.access/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.access/max_size.pass.cpp?rev=344416&r1=344415&r2=344416&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.access/max_size.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/associative/map/map.access/max_size.pass.cpp Fri Oct 12 14:22:15 2018
@@ -34,18 +34,18 @@ int main()
{
typedef limited_allocator<KV, (size_t)-1> A;
typedef std::map<int, int, std::less<int>, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
- }
- {
- typedef std::map<char, int> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
- C c;
- assert(c.max_size() <= max_dist);
- assert(c.max_size() <= alloc_max_size(c.get_allocator()));
- }
+ }
+ {
+ typedef std::map<char, int> C;
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
+ }
}
Modified: libcxx/trunk/test/std/containers/associative/multimap/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/max_size.pass.cpp?rev=344416&r1=344415&r2=344416&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/max_size.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/associative/multimap/max_size.pass.cpp Fri Oct 12 14:22:15 2018
@@ -34,18 +34,18 @@ int main()
{
typedef limited_allocator<KV, (size_t)-1> A;
typedef std::multimap<int, int, std::less<int>, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
- }
- {
- typedef std::multimap<char, int> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
- C c;
- assert(c.max_size() <= max_dist);
- assert(c.max_size() <= alloc_max_size(c.get_allocator()));
- }
+ }
+ {
+ typedef std::multimap<char, int> C;
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
+ }
}
Modified: libcxx/trunk/test/std/containers/associative/multiset/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/max_size.pass.cpp?rev=344416&r1=344415&r2=344416&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/max_size.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/associative/multiset/max_size.pass.cpp Fri Oct 12 14:22:15 2018
@@ -33,16 +33,16 @@ int main()
{
typedef limited_allocator<int, (size_t)-1> A;
typedef std::multiset<int, std::less<int>, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::multiset<char> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
Modified: libcxx/trunk/test/std/containers/associative/set/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/max_size.pass.cpp?rev=344416&r1=344415&r2=344416&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/max_size.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/associative/set/max_size.pass.cpp Fri Oct 12 14:22:15 2018
@@ -33,16 +33,16 @@ int main()
{
typedef limited_allocator<int, (size_t)-1> A;
typedef std::set<int, std::less<int>, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::set<char> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
Modified: libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp?rev=344416&r1=344415&r2=344416&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp Fri Oct 12 14:22:15 2018
@@ -30,16 +30,16 @@ int main() {
{
typedef limited_allocator<int, (size_t)-1> A;
typedef std::deque<int, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::deque<char> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
Modified: libcxx/trunk/test/std/containers/sequences/forwardlist/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/max_size.pass.cpp?rev=344416&r1=344415&r2=344416&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/max_size.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/max_size.pass.cpp Fri Oct 12 14:22:15 2018
@@ -31,16 +31,16 @@ int main()
{
typedef limited_allocator<int, (size_t)-1> A;
typedef std::forward_list<int, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::forward_list<char> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
Modified: libcxx/trunk/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp?rev=344416&r1=344415&r2=344416&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp Fri Oct 12 14:22:15 2018
@@ -30,16 +30,16 @@ int main() {
{
typedef limited_allocator<int, (size_t)-1> A;
typedef std::list<int, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::list<char> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
Modified: libcxx/trunk/test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp?rev=344416&r1=344415&r2=344416&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp Fri Oct 12 14:22:15 2018
@@ -31,16 +31,16 @@ int main() {
{
typedef limited_allocator<int, (size_t)-1> A;
typedef std::vector<int, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::vector<char> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
Modified: libcxx/trunk/test/std/containers/unord/unord.map/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.map/max_size.pass.cpp?rev=344416&r1=344415&r2=344416&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.map/max_size.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.map/max_size.pass.cpp Fri Oct 12 14:22:15 2018
@@ -36,16 +36,16 @@ int main()
typedef limited_allocator<KV, (size_t)-1> A;
typedef std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, A>
C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::unordered_map<char, int> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
Modified: libcxx/trunk/test/std/containers/unord/unord.multimap/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multimap/max_size.pass.cpp?rev=344416&r1=344415&r2=344416&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.multimap/max_size.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.multimap/max_size.pass.cpp Fri Oct 12 14:22:15 2018
@@ -38,16 +38,16 @@ int main()
typedef std::unordered_multimap<int, int, std::hash<int>,
std::equal_to<int>, A>
C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::unordered_multimap<char, int> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
Modified: libcxx/trunk/test/std/containers/unord/unord.multiset/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multiset/max_size.pass.cpp?rev=344416&r1=344415&r2=344416&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.multiset/max_size.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.multiset/max_size.pass.cpp Fri Oct 12 14:22:15 2018
@@ -37,16 +37,16 @@ int main()
typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>,
A>
C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::unordered_multiset<char> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
Modified: libcxx/trunk/test/std/containers/unord/unord.set/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.set/max_size.pass.cpp?rev=344416&r1=344415&r2=344416&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.set/max_size.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.set/max_size.pass.cpp Fri Oct 12 14:22:15 2018
@@ -33,16 +33,16 @@ int main()
{
typedef limited_allocator<int, (size_t)-1> A;
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::unordered_set<char> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
More information about the libcxx-commits
mailing list