diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-12-11 05:31:00 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-12-11 05:31:00 +0000 |
commit | c71bd55b5dd20dd94c5b87a30adb1da7e81c5114 (patch) | |
tree | 51ebcc46d3d70c5c3d18b752ab7e2910ff481f78 /libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate | |
parent | 72967a56e17c3ba7f1f689aaf569dd0648a1d3df (diff) | |
download | bcm5719-llvm-c71bd55b5dd20dd94c5b87a30adb1da7e81c5114.tar.gz bcm5719-llvm-c71bd55b5dd20dd94c5b87a30adb1da7e81c5114.zip |
Enable the -Wsign-compare warning to better support MSVC
llvm-svn: 289363
Diffstat (limited to 'libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate')
-rw-r--r-- | libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate.pass.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate.pass.cpp index b7da7354ca2..515c79761ee 100644 --- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate.pass.cpp +++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate.pass.cpp @@ -15,10 +15,9 @@ #include <algorithm> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> -#endif +#include "test_macros.h" #include "test_iterators.h" template <class Iter> @@ -26,7 +25,7 @@ void test() { int ia[] = {0}; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); + const int sa = static_cast<int>(sizeof(ia)/sizeof(ia[0])); Iter r = std::rotate(Iter(ia), Iter(ia), Iter(ia)); assert(base(r) == ia); assert(ia[0] == 0); @@ -38,7 +37,7 @@ test() assert(ia[0] == 0); int ib[] = {0, 1}; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); + const int sb = static_cast<int>(sizeof(ib)/sizeof(ib[0])); r = std::rotate(Iter(ib), Iter(ib), Iter(ib+sb)); assert(base(r) == ib+sb); assert(ib[0] == 0); @@ -53,7 +52,7 @@ test() assert(ib[1] == 0); int ic[] = {0, 1, 2}; - const unsigned sc = sizeof(ic)/sizeof(ic[0]); + const int sc = static_cast<int>(sizeof(ic)/sizeof(ic[0])); r = std::rotate(Iter(ic), Iter(ic), Iter(ic+sc)); assert(base(r) == ic+sc); assert(ic[0] == 0); @@ -76,7 +75,7 @@ test() assert(ic[2] == 2); int id[] = {0, 1, 2, 3}; - const unsigned sd = sizeof(id)/sizeof(id[0]); + const int sd = static_cast<int>(sizeof(id)/sizeof(id[0])); r = std::rotate(Iter(id), Iter(id), Iter(id+sd)); assert(base(r) == id+sd); assert(id[0] == 0); @@ -109,7 +108,7 @@ test() assert(id[3] == 1); int ie[] = {0, 1, 2, 3, 4}; - const unsigned se = sizeof(ie)/sizeof(ie[0]); + const int se = static_cast<int>(sizeof(ie)/sizeof(ie[0])); r = std::rotate(Iter(ie), Iter(ie), Iter(ie+se)); assert(base(r) == ie+se); assert(ie[0] == 0); @@ -154,7 +153,7 @@ test() assert(ie[4] == 4); int ig[] = {0, 1, 2, 3, 4, 5}; - const unsigned sg = sizeof(ig)/sizeof(ig[0]); + const int sg = static_cast<int>(sizeof(ig)/sizeof(ig[0])); r = std::rotate(Iter(ig), Iter(ig), Iter(ig+sg)); assert(base(r) == ig+sg); assert(ig[0] == 0); @@ -213,14 +212,14 @@ test() assert(ig[5] == 2); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 template <class Iter> void test1() { std::unique_ptr<int> ia[1]; - const unsigned sa = sizeof(ia)/sizeof(ia[0]); + const int sa = static_cast<int>(sizeof(ia)/sizeof(ia[0])); for (int i = 0; i < sa; ++i) ia[i].reset(new int(i)); Iter r = std::rotate(Iter(ia), Iter(ia), Iter(ia)); @@ -234,7 +233,7 @@ test1() assert(*ia[0] == 0); std::unique_ptr<int> ib[2]; - const unsigned sb = sizeof(ib)/sizeof(ib[0]); + const int sb = static_cast<int>(sizeof(ib)/sizeof(ib[0])); for (int i = 0; i < sb; ++i) ib[i].reset(new int(i)); r = std::rotate(Iter(ib), Iter(ib), Iter(ib+sb)); @@ -251,7 +250,7 @@ test1() assert(*ib[1] == 0); std::unique_ptr<int> ic[3]; - const unsigned sc = sizeof(ic)/sizeof(ic[0]); + const int sc = static_cast<int>(sizeof(ic)/sizeof(ic[0])); for (int i = 0; i < sc; ++i) ic[i].reset(new int(i)); r = std::rotate(Iter(ic), Iter(ic), Iter(ic+sc)); @@ -276,7 +275,7 @@ test1() assert(*ic[2] == 2); std::unique_ptr<int> id[4]; - const unsigned sd = sizeof(id)/sizeof(id[0]); + const int sd = static_cast<int>(sizeof(id)/sizeof(id[0])); for (int i = 0; i < sd; ++i) id[i].reset(new int(i)); r = std::rotate(Iter(id), Iter(id), Iter(id+sd)); @@ -311,7 +310,7 @@ test1() assert(*id[3] == 1); std::unique_ptr<int> ie[5]; - const unsigned se = sizeof(ie)/sizeof(ie[0]); + const int se = static_cast<int>(sizeof(ie)/sizeof(ie[0])); for (int i = 0; i < se; ++i) ie[i].reset(new int(i)); r = std::rotate(Iter(ie), Iter(ie), Iter(ie+se)); @@ -358,7 +357,7 @@ test1() assert(*ie[4] == 4); std::unique_ptr<int> ig[6]; - const unsigned sg = sizeof(ig)/sizeof(ig[0]); + const int sg = static_cast<int>(sizeof(ig)/sizeof(ig[0])); for (int i = 0; i < sg; ++i) ig[i].reset(new int(i)); r = std::rotate(Iter(ig), Iter(ig), Iter(ig+sg)); @@ -419,7 +418,7 @@ test1() assert(*ig[5] == 2); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 int main() { @@ -428,12 +427,12 @@ int main() test<random_access_iterator<int*> >(); test<int*>(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test1<forward_iterator<std::unique_ptr<int>*> >(); test1<bidirectional_iterator<std::unique_ptr<int>*> >(); test1<random_access_iterator<std::unique_ptr<int>*> >(); test1<std::unique_ptr<int>*>(); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } |