[libcxx] r339209 - [libcxx] [test] Add missing in several tests.
Author: bion Date: Tue Aug 7 17:40:32 2018 New Revision: 339209 URL: http://llvm.org/viewvc/llvm-project?rev=339209&view=rev Log: [libcxx] [test] Add missing in several tests. Reviewed as https://reviews.llvm.org/D50420 Modified: libcxx/trunk/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp libcxx/trunk/test/std/strings/string.conversions/stod.pass.cpp libcxx/trunk/test/std/strings/string.conversions/stof.pass.cpp libcxx/trunk/test/std/strings/string.conversions/stoi.pass.cpp libcxx/trunk/test/std/strings/string.conversions/stol.pass.cpp libcxx/trunk/test/std/strings/string.conversions/stoll.pass.cpp libcxx/trunk/test/std/strings/string.conversions/stoul.pass.cpp libcxx/trunk/test/std/strings/string.conversions/stoull.pass.cpp libcxx/trunk/test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp libcxx/trunk/test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp libcxx/trunk/test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp libcxx/trunk/test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp libcxx/trunk/test/std/strings/string.view/string.view.ops/copy.pass.cpp libcxx/trunk/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp libcxx/trunk/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp libcxx/trunk/test/std/utilities/template.bitset/bitset.members/set_one.pass.cpp libcxx/trunk/test/std/utilities/template.bitset/bitset.members/test.pass.cpp Modified: libcxx/trunk/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp?rev=339209&r1=339208&r2=339209&view=diff == --- libcxx/trunk/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp (original) +++ libcxx/trunk/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp Tue Aug 7 17:40:32 2018 @@ -20,6 +20,7 @@ #include #include +#include #include "min_allocator.h" Modified: libcxx/trunk/test/std/strings/string.conversions/stod.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.conversions/stod.pass.cpp?rev=339209&r1=339208&r2=339209&view=diff == --- libcxx/trunk/test/std/strings/string.conversions/stod.pass.cpp (original) +++ libcxx/trunk/test/std/strings/string.conversions/stod.pass.cpp Tue Aug 7 17:40:32 2018 @@ -15,6 +15,7 @@ #include #include #include +#include #include "test_macros.h" Modified: libcxx/trunk/test/std/strings/string.conversions/stof.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.conversions/stof.pass.cpp?rev=339209&r1=339208&r2=339209&view=diff == --- libcxx/trunk/test/std/strings/string.conversions/stof.pass.cpp (original) +++ libcxx/trunk/test/std/strings/string.conversions/stof.pass.cpp Tue Aug 7 17:40:32 2018 @@ -19,6 +19,7 @@ #include #include #include +#include #include "test_macros.h" Modified: libcxx/trunk/test/std/strings/string.conversions/stoi.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.conversions/stoi.pass.cpp?rev=339209&r1=339208&r2=339209&view=diff == --- libcxx/trunk/test/std/strings/string.conversions/stoi.pass.cpp (original) +++ libcxx/trunk/test/std/strings/string.conversions/stoi.pass.cpp Tue Aug 7 17:40:32 2018 @@ -14,6 +14,7 @@ #include #include +#include #include "test_macros.h" Modified: libcxx/trunk/test/std/strings/string.conversions/stol.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.conversions/stol.pass.cpp?rev=339209&r1=339208&r2=339209&view=diff == --- libcxx/trunk/test/std/strings/string.conversions/stol.pass.cpp (original) +++ libcxx/trunk/test/std/strings/string.conversions/stol.pass.cpp Tue Aug 7 17:40:32 2018 @@ -18,6 +18,7 @@ #include #include +#include #include "test_macros.h" Modified: libcxx/trunk/test/std/strings/string.conversions/stoll.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.conversions/stoll.pass.cpp?rev=339209&r1=339208&r2=339209&view=diff == --- libcxx/trunk/test/std/strings/string.conversions/stoll.pass.cpp (original) +++ libcxx/trunk/test/std/strings/string.conversions/stoll.pass.cpp Tue Aug 7 17:40:32 2018 @@ -18,6 +18,7 @@ #include #include +#include
[libcxx] r339212 - [libcxx] [test] Remove asserts that and are included by
Author: bion Date: Tue Aug 7 17:43:38 2018 New Revision: 339212 URL: http://llvm.org/viewvc/llvm-project?rev=339212&view=rev Log: [libcxx] [test] Remove asserts that and are included by Reviewed as https://reviews.llvm.org/D50421 Modified: libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp Modified: libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp?rev=339212&r1=339211&r2=339212&view=diff == --- libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp Tue Aug 7 17:43:38 2018 @@ -7,7 +7,7 @@ // //===--===// -// test that includes , , and +// test that includes and #include @@ -15,18 +15,9 @@ template void test_typedef() {} int main() { - { // test for -std::ptrdiff_t p; ((void)p); -std::size_t s; ((void)s); -std::nullptr_t np; ((void)np); - } { // test for std::string s; ((void)s); } - { // test for -std::logic_error le("blah"); ((void)le); -std::runtime_error re("blah"); ((void)re); - } { // test for test_typedef(); test_typedef(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r339213 - [libcxx] [test] Remove nonportable locale assumption in basic.ios.members/narrow.pass.cpp
Author: bion Date: Tue Aug 7 17:47:29 2018 New Revision: 339213 URL: http://llvm.org/viewvc/llvm-project?rev=339213&view=rev Log: [libcxx] [test] Remove nonportable locale assumption in basic.ios.members/narrow.pass.cpp I'm not sure if libcxx is asserting UTF-8 here; but on Windows the full char value is always passed through in its entirety, since the default codepage is something like Windows-1252. The replacement character is only used for non-chars there; and that should be a more portable test everywhere. (Still pending review at https://reviews.llvm.org/D47395 which has been open since may; will ask for forgiveness rather than permission :) ) Modified: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/narrow.pass.cpp Modified: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/narrow.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/narrow.pass.cpp?rev=339213&r1=339212&r2=339213&view=diff == --- libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/narrow.pass.cpp (original) +++ libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/narrow.pass.cpp Tue Aug 7 17:47:29 2018 @@ -18,7 +18,7 @@ int main() { -const std::ios ios(0); -assert(ios.narrow('c', '*') == 'c'); -assert(ios.narrow('\xFE', '*') == '*'); +const std::wios ios(0); +assert(ios.narrow(L'c', '*') == 'c'); +assert(ios.narrow(L'\u203C', '*') == '*'); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r339214 - [libcxx] [test] Allow a standard library that implements LWG 1203 in istream.rvalue/rvalue.pass.cpp
Author: bion Date: Tue Aug 7 17:49:02 2018 New Revision: 339214 URL: http://llvm.org/viewvc/llvm-project?rev=339214&view=rev Log: [libcxx] [test] Allow a standard library that implements LWG 1203 in istream.rvalue/rvalue.pass.cpp (Still pending review at https://reviews.llvm.org/D47400 which has been open since may; will ask for forgiveness rather than permission :) ) Modified: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp Modified: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp?rev=339214&r1=339213&r2=339214&view=diff == --- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp (original) +++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp Tue Aug 7 17:49:02 2018 @@ -65,7 +65,7 @@ int main() { // test perfect forwarding assert(called == false); std::istringstream ss; -auto& out = (std::move(ss) >> A{}); +auto&& out = (std::move(ss) >> A{}); assert(&out == &ss); assert(called); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r339218 - [libcxx] [test] Avoid -Wunused-local-typedef in node_handle.pass.cpp.
Author: bion Date: Tue Aug 7 21:24:47 2018 New Revision: 339218 URL: http://llvm.org/viewvc/llvm-project?rev=339218&view=rev Log: [libcxx] [test] Avoid -Wunused-local-typedef in node_handle.pass.cpp. Modified: libcxx/trunk/test/std/containers/container.node/node_handle.pass.cpp Modified: libcxx/trunk/test/std/containers/container.node/node_handle.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.node/node_handle.pass.cpp?rev=339218&r1=339217&r2=339218&view=diff == --- libcxx/trunk/test/std/containers/container.node/node_handle.pass.cpp (original) +++ libcxx/trunk/test/std/containers/container.node/node_handle.pass.cpp Tue Aug 7 21:24:47 2018 @@ -121,10 +121,12 @@ void test_node_handle_operations_multi() assert(nt2.empty()); } +template void test_typedef() {} + template void test_insert_return_type() { -using irt_type = typename Container::insert_return_type; +test_typedef(); } int main() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r332567 - Add void casts to suppress nodiscard on linear_congruential_engine.
Author: bion Date: Wed May 16 19:58:26 2018 New Revision: 332567 URL: http://llvm.org/viewvc/llvm-project?rev=332567&view=rev Log: Add void casts to suppress nodiscard on linear_congruential_engine. Modified: libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp Modified: libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp?rev=332567&r1=332566&r2=332567&view=diff == --- libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp Wed May 16 19:58:26 2018 @@ -25,7 +25,7 @@ test1() E e1; E e2; assert(e1 == e2); -e1(); +(void)e1(); e2 = e1; assert(e1 == e2); } Modified: libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp?rev=332567&r1=332566&r2=332567&view=diff == --- libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp Wed May 16 19:58:26 2018 @@ -25,8 +25,8 @@ test1() E e1; E e2 = e1; assert(e1 == e2); -e1(); -e2(); +(void)e1(); +(void)e2(); assert(e1 == e2); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r332571 - [libcxx] [test] Remove unused local typedef in test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp
Author: bion Date: Wed May 16 21:59:34 2018 New Revision: 332571 URL: http://llvm.org/viewvc/llvm-project?rev=332571&view=rev Log: [libcxx] [test] Remove unused local typedef in test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp Modified: libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp Modified: libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp?rev=332571&r1=332570&r2=332571&view=diff == --- libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp Wed May 16 21:59:34 2018 @@ -22,7 +22,6 @@ void test1() { typedef std::linear_congruential_engine LCE; -typedef typename LCE::result_type result_type; LCE e1; LCE e2; e2.seed(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r303899 - Add asserts that the nullptr is maintained in string erase operations.
Author: bion Date: Thu May 25 14:01:14 2017 New Revision: 303899 URL: http://llvm.org/viewvc/llvm-project?rev=303899&view=rev Log: Add asserts that the nullptr is maintained in string erase operations. Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp?rev=303899&r1=303898&r2=303899&view=diff == --- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp (original) +++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp Thu May 25 14:01:14 2017 @@ -24,6 +24,7 @@ test(S s, typename S::difference_type po typename S::const_iterator p = s.begin() + pos; typename S::iterator i = s.erase(p); LIBCPP_ASSERT(s.__invariants()); +assert(s[s.size()] == typename S::value_type()); assert(s == expected); assert(i - s.begin() == pos); } Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp?rev=303899&r1=303898&r2=303899&view=diff == --- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp (original) +++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp Thu May 25 14:01:14 2017 @@ -25,6 +25,7 @@ test(S s, typename S::difference_type po typename S::const_iterator last = s.cbegin() + pos + n; typename S::iterator i = s.erase(first, last); LIBCPP_ASSERT(s.__invariants()); +assert(s[s.size()] == typename S::value_type()); assert(s == expected); assert(i - s.begin() == pos); } Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp?rev=303899&r1=303898&r2=303899&view=diff == --- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp (original) +++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp Thu May 25 14:01:14 2017 @@ -23,6 +23,7 @@ test(S s, S expected) { s.pop_back(); LIBCPP_ASSERT(s.__invariants()); +assert(s[s.size()] == typename S::value_type()); assert(s == expected); } Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp?rev=303899&r1=303898&r2=303899&view=diff == --- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp (original) +++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp Thu May 25 14:01:14 2017 @@ -29,6 +29,7 @@ test(S s, typename S::size_type pos, typ { s.erase(pos, n); LIBCPP_ASSERT(s.__invariants()); +assert(s[s.size()] == typename S::value_type()); assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS @@ -58,6 +59,7 @@ test(S s, typename S::size_type pos, S e { s.erase(pos); LIBCPP_ASSERT(s.__invariants()); +assert(s[s.size()] == typename S::value_type()); assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS @@ -83,6 +85,7 @@ test(S s, S expected) { s.erase(); LIBCPP_ASSERT(s.__invariants()); +assert(s[s.size()] == typename S::value_type()); assert(s == expected); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r321848 - Add move-only types test for transform_reduce bop/uop.
Author: bion Date: Thu Jan 4 17:31:50 2018 New Revision: 321848 URL: http://llvm.org/viewvc/llvm-project?rev=321848&view=rev Log: Add move-only types test for transform_reduce bop/uop. Modified: libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp Modified: libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp?rev=321848&r1=321847&r2=321848&view=diff == --- libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp Thu Jan 4 17:31:50 2018 @@ -19,7 +19,9 @@ #include #include #include +#include +#include "MoveOnly.h" #include "test_iterators.h" struct identity @@ -81,6 +83,15 @@ void test_return_type() decltype(std::transform_reduce(p, p, Init{}, std::plus<>(), identity()))> ); } +void test_move_only_types() +{ +MoveOnly ia[] = {{1}, {2}, {3}}; +assert(60 == +std::transform_reduce(std::begin(ia), std::end(ia), MoveOnly{0}, +[](const MoveOnly& lhs, const MoveOnly& rhs) { return MoveOnly{lhs.get() + rhs.get()}; }, +[](const MoveOnly& target) { return MoveOnly{target.get() * 10}; }).get()); +} + int main() { test_return_type(); @@ -105,4 +116,6 @@ int main() unsigned res = std::transform_reduce(v.begin(), v.end(), 1U, std::multiplies<>(), twice()); assert(res == 46080); // 6! * 64 will not fit into a char } + +test_move_only_types(); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r321847 - Fix nonstandard bits in transform_reduce_iter_iter_init_bop_uop.
Author: bion Date: Thu Jan 4 17:31:47 2018 New Revision: 321847 URL: http://llvm.org/viewvc/llvm-project?rev=321847&view=rev Log: Fix nonstandard bits in transform_reduce_iter_iter_init_bop_uop. * _VSTD should be std. * is needed for forward. * unary_function is no longer standard (and unnecessary for this, a C++17-only test) Modified: libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp Modified: libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp?rev=321847&r1=321846&r2=321847&view=diff == --- libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp Thu Jan 4 17:31:47 2018 @@ -18,40 +18,24 @@ #include #include +#include #include "test_iterators.h" -template -struct identity : std::unary_function -{ -constexpr const T& operator()(const T& x) const { return x;} -}; - -template <> -struct identity +struct identity { template -constexpr auto operator()(T&& x) const -_NOEXCEPT_(noexcept(_VSTD::forward(x))) --> decltype(_VSTD::forward(x)) -{ return_VSTD::forward(x); } +constexpr decltype(auto) operator()(T&& x) const { +return std::forward(x); +} }; - -template struct twice { -constexpr const T operator()(const T& x) const noexcept { return 2 * x; } -}; - -template <> -struct twice -{ template -constexpr auto operator()(const T& x) const -_NOEXCEPT_(noexcept(2 * x)) --> decltype(2 * x) -{ return2 * x; } +constexpr auto operator()(const T& x) const { +return 2 * x; +} }; template @@ -70,23 +54,23 @@ test() int ia[] = {1, 2, 3, 4, 5, 6}; unsigned sa = sizeof(ia) / sizeof(ia[0]); -test(Iter(ia), Iter(ia),0, std::plus<>(), identity<>(), 0); -test(Iter(ia), Iter(ia),1, std::multiplies<>(), identity<>(), 1); -test(Iter(ia), Iter(ia+1), 0, std::multiplies<>(), identity<>(), 0); -test(Iter(ia), Iter(ia+1), 2, std::plus<>(), identity<>(), 3); -test(Iter(ia), Iter(ia+2), 0, std::plus<>(), identity<>(), 3); -test(Iter(ia), Iter(ia+2), 3, std::multiplies<>(), identity<>(), 6); -test(Iter(ia), Iter(ia+sa), 4, std::multiplies<>(), identity<>(),2880); -test(Iter(ia), Iter(ia+sa), 4, std::plus<>(), identity<>(), 25); - -test(Iter(ia), Iter(ia),0, std::plus<>(), twice<>(), 0); -test(Iter(ia), Iter(ia),1, std::multiplies<>(), twice<>(), 1); -test(Iter(ia), Iter(ia+1), 0, std::multiplies<>(), twice<>(), 0); -test(Iter(ia), Iter(ia+1), 2, std::plus<>(), twice<>(), 4); -test(Iter(ia), Iter(ia+2), 0, std::plus<>(), twice<>(), 6); -test(Iter(ia), Iter(ia+2), 3, std::multiplies<>(), twice<>(), 24); -test(Iter(ia), Iter(ia+sa), 4, std::multiplies<>(), twice<>(), 184320); // 64 * 2880 -test(Iter(ia), Iter(ia+sa), 4, std::plus<>(), twice<>(), 46); +test(Iter(ia), Iter(ia),0, std::plus<>(), identity(), 0); +test(Iter(ia), Iter(ia),1, std::multiplies<>(), identity(), 1); +test(Iter(ia), Iter(ia+1), 0, std::multiplies<>(), identity(), 0); +test(Iter(ia), Iter(ia+1), 2, std::plus<>(), identity(), 3); +test(Iter(ia), Iter(ia+2), 0, std::plus<>(), identity(), 3); +test(Iter(ia), Iter(ia+2), 3, std::multiplies<>(), identity(), 6); +test(Iter(ia), Iter(ia+sa), 4, std::multiplies<>(), identity(),2880); +test(Iter(ia), Iter(ia+sa), 4, std::plus<>(), identity(), 25); + +test(Iter(ia), Iter(ia),0, std::plus<>(), twice(), 0); +test(Iter(ia), Iter(ia),1, std::multiplies<>(), twice(), 1); +test(Iter(ia), Iter(ia+1), 0, std::multiplies<>(), twice(), 0); +test(Iter(ia), Iter(ia+1), 2, std::plus<>(), twice(), 4); +test(Iter(ia), Iter(ia+2), 0, std::plus<>(), twice(), 6); +test(Iter(ia), Iter(ia+2), 3, std::multiplies<>(), twice(), 24); +test(Iter(ia), Iter(ia+sa), 4, std::multiplies<>(), twice(), 184320); // 64 * 2880 +test(Iter(ia), Iter(ia+sa), 4, std::plus<>(), twice(), 46); } template @@ -94,7 +78,7 @@ void test_return_type() { T *p = nullptr; static_assert( std::is_same_v(), identity<>()))> ); + decltype(std::transform_reduce(p, p, Init{}, std::plus<>(), identity()))> ); } int main() @@ -118,
[libcxx] r321852 - Move + and * operators of MoveOnly into MoveOnly.h.
Author: bion Date: Thu Jan 4 17:32:00 2018 New Revision: 321852 URL: http://llvm.org/viewvc/llvm-project?rev=321852&view=rev Log: Move + and * operators of MoveOnly into MoveOnly.h. Modified: libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp libcxx/trunk/test/support/MoveOnly.h Modified: libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp?rev=321852&r1=321851&r2=321852&view=diff == --- libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp Thu Jan 4 17:32:00 2018 @@ -58,16 +58,6 @@ void test_return_type() decltype(std::transform_reduce(p, p, p, Init{}))> ); } -inline MoveOnly operator+(const MoveOnly& lhs, const MoveOnly& rhs) -{ -return MoveOnly{lhs.get() + rhs.get()}; -} - -inline MoveOnly operator*(const MoveOnly& lhs, const MoveOnly& rhs) -{ -return MoveOnly{lhs.get() * rhs.get()}; -} - void test_move_only_types() { MoveOnly ia[] = {{1}, {2}, {3}}; Modified: libcxx/trunk/test/support/MoveOnly.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/MoveOnly.h?rev=321852&r1=321851&r2=321852&view=diff == --- libcxx/trunk/test/support/MoveOnly.h (original) +++ libcxx/trunk/test/support/MoveOnly.h Thu Jan 4 17:32:00 2018 @@ -19,7 +19,6 @@ class MoveOnly { -friend class MoveOnly2; MoveOnly(const MoveOnly&); MoveOnly& operator=(const MoveOnly&); @@ -35,6 +34,8 @@ public: bool operator==(const MoveOnly& x) const {return data_ == x.data_;} bool operator< (const MoveOnly& x) const {return data_ < x.data_;} +MoveOnly operator+(const MoveOnly& x) const { return MoveOnly{data_ + x.data_}; } +MoveOnly operator*(const MoveOnly& x) const { return MoveOnly{data_ * x.data_}; } }; namespace std { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r321849 - Add move-only types test to transform_reduce iter iter iter init op op.
Author: bion Date: Thu Jan 4 17:31:52 2018 New Revision: 321849 URL: http://llvm.org/viewvc/llvm-project?rev=321849&view=rev Log: Add move-only types test to transform_reduce iter iter iter init op op. Modified: libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init_op_op.pass.cpp Modified: libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init_op_op.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init_op_op.pass.cpp?rev=321849&r1=321848&r2=321849&view=diff == --- libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init_op_op.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init_op_op.pass.cpp Thu Jan 4 17:31:52 2018 @@ -19,7 +19,9 @@ #include #include +#include +#include "MoveOnly.h" #include "test_iterators.h" template @@ -58,6 +60,16 @@ void test_return_type() decltype(std::transform_reduce(p, p, p, Init{}, std::plus<>(), std::multiplies<>()))> ); } +void test_move_only_types() +{ +MoveOnly ia[] = {{1}, {2}, {3}}; +MoveOnly ib[] = {{1}, {2}, {3}}; +assert(14 == +std::transform_reduce(std::begin(ia), std::end(ia), std::begin(ib), MoveOnly{0}, +[](const MoveOnly& lhs, const MoveOnly& rhs) { return MoveOnly{lhs.get() + rhs.get()}; }, +[](const MoveOnly& lhs, const MoveOnly& rhs) { return MoveOnly{lhs.get() * rhs.get()}; }).get()); +} + int main() { test_return_type(); @@ -94,4 +106,6 @@ int main() test(); test< int*, const unsigned int *>(); test< int*, unsigned int *>(); + +test_move_only_types(); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r321850 - Automated trailing whitespace removal by VS Code.
Author: bion Date: Thu Jan 4 17:31:55 2018 New Revision: 321850 URL: http://llvm.org/viewvc/llvm-project?rev=321850&view=rev Log: Automated trailing whitespace removal by VS Code. Modified: libcxx/trunk/include/numeric Modified: libcxx/trunk/include/numeric URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/numeric?rev=321850&r1=321849&r2=321850&view=diff == --- libcxx/trunk/include/numeric (original) +++ libcxx/trunk/include/numeric Thu Jan 4 17:31:55 2018 @@ -51,7 +51,7 @@ template T transform_reduce(InputIterator1 first1, InputIterator1 last1, @@ -75,10 +75,10 @@ template OutputIterator -exclusive_scan(InputIterator first, InputIterator last, +exclusive_scan(InputIterator first, InputIterator last, OutputIterator result, T init, BinaryOperation binary_op); // C++17 template @@ -108,7 +108,7 @@ template OutputIterator @@ -196,7 +196,7 @@ inline _LIBCPP_INLINE_VISIBILITY typename iterator_traits<_InputIterator>::value_type reduce(_InputIterator __first, _InputIterator __last) { -return _VSTD::reduce(__first, __last, +return _VSTD::reduce(__first, __last, typename iterator_traits<_InputIterator>::value_type{}); } #endif @@ -226,7 +226,7 @@ inner_product(_InputIterator1 __first1, template inline _LIBCPP_INLINE_VISIBILITY _Tp -transform_reduce(_InputIterator __first, _InputIterator __last, +transform_reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b, _UnaryOp __u) { for (; __first != __last; ++__first) @@ -234,7 +234,7 @@ transform_reduce(_InputIterator __first, return __init; } -template inline _LIBCPP_INLINE_VISIBILITY _Tp @@ -249,7 +249,7 @@ transform_reduce(_InputIterator1 __first template inline _LIBCPP_INLINE_VISIBILITY _Tp -transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, +transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) { return _VSTD::transform_reduce(__first1, __last1, __first2, __init, @@ -298,7 +298,7 @@ partial_sum(_InputIterator __first, _Inp template inline _LIBCPP_INLINE_VISIBILITY _OutputIterator -exclusive_scan(_InputIterator __first, _InputIterator __last, +exclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init, _BinaryOp __b) { if (__first != __last) @@ -318,14 +318,14 @@ exclusive_scan(_InputIterator __first, _ template inline _LIBCPP_INLINE_VISIBILITY _OutputIterator -exclusive_scan(_InputIterator __first, _InputIterator __last, +exclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init) { return _VSTD::exclusive_scan(__first, __last, __result, __init, _VSTD::plus<>()); } template -_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last, +_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b, _Tp __init) { for (; __first != __last; ++__first, (void) ++__result) { @@ -336,7 +336,7 @@ _OutputIterator inclusive_scan(_InputIte } template -_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last, +_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b) { if (__first != __last) { @@ -350,17 +350,17 @@ _OutputIterator inclusive_scan(_InputIte } template -_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last, +_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { return _VSTD::inclusive_scan(__first, __last, __result, std::plus<>()); } -template inline _LIBCPP_INLINE_VISIBILITY _OutputIterator -transform_exclusive_scan(_InputIterator __first, _InputIterator __last, +transform_exclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init, _BinaryOp __b, _UnaryOp __u) { @@ -379,7 +379,7 @@ transform_exclusive_scan(_InputIterator } template -_OutputIterator transform_inclusive_scan(_InputIterator __first, _InputIterator __last, +_OutputIterator transform_inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b, _UnaryOp __u, _Tp __init) { for (; __first != __last; ++__first, (void) ++__result) { @@ -391,7 +391,7 @@ _OutputIterator transform_inclusive_scan } template -_OutputIterator transform_inclusive_scan(_InputIterator __first, _InputIterator __last, +_OutputIterator transform_inclusive_scan(_InputIterator __first, _InputIterator __last,
[libcxx] r321851 - Fix incorrect handling of move-only types in transform_reduce iter iter iter init, and add test.
Author: bion Date: Thu Jan 4 17:31:57 2018 New Revision: 321851 URL: http://llvm.org/viewvc/llvm-project?rev=321851&view=rev Log: Fix incorrect handling of move-only types in transform_reduce iter iter iter init, and add test. Modified: libcxx/trunk/include/numeric libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp Modified: libcxx/trunk/include/numeric URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/numeric?rev=321851&r1=321850&r2=321851&view=diff == --- libcxx/trunk/include/numeric (original) +++ libcxx/trunk/include/numeric Thu Jan 4 17:31:57 2018 @@ -252,7 +252,7 @@ _Tp transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) { -return _VSTD::transform_reduce(__first1, __last1, __first2, __init, +return _VSTD::transform_reduce(__first1, __last1, __first2, _VSTD::move(__init), _VSTD::plus<>(), _VSTD::multiplies<>()); } #endif Modified: libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp?rev=321851&r1=321850&r2=321851&view=diff == --- libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp Thu Jan 4 17:31:57 2018 @@ -17,7 +17,9 @@ #include #include +#include +#include "MoveOnly.h" #include "test_iterators.h" template @@ -56,6 +58,24 @@ void test_return_type() decltype(std::transform_reduce(p, p, p, Init{}))> ); } +inline MoveOnly operator+(const MoveOnly& lhs, const MoveOnly& rhs) +{ +return MoveOnly{lhs.get() + rhs.get()}; +} + +inline MoveOnly operator*(const MoveOnly& lhs, const MoveOnly& rhs) +{ +return MoveOnly{lhs.get() * rhs.get()}; +} + +void test_move_only_types() +{ +MoveOnly ia[] = {{1}, {2}, {3}}; +MoveOnly ib[] = {{1}, {2}, {3}}; +assert(14 == +std::transform_reduce(std::begin(ia), std::end(ia), std::begin(ib), MoveOnly{0}).get()); +} + int main() { test_return_type(); @@ -92,4 +112,6 @@ int main() test(); test< int*, const unsigned int *>(); test< int*, unsigned int *>(); + +test_move_only_types(); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r321922 - [libcxx] [test] Remove nonstandard things and resolve warnings in Xxx_scan tests
Author: bion Date: Fri Jan 5 18:18:20 2018 New Revision: 321922 URL: http://llvm.org/viewvc/llvm-project?rev=321922&view=rev Log: [libcxx] [test] Remove nonstandard things and resolve warnings in Xxx_scan tests Reviewed as https://reviews.llvm.org/D41748 * These tests use function objects from functional, back_inserter from iterator, and equal from algorithm, so add those headers. * The use of iota targeting vector with an int parameter triggers warnings on MSVC++ assigning an into a unsigned char&; so change the parameter to unsigned char with a static_cast. * Avoid naming unary_function in identity here as that is removed in '17. (This also fixes naming _VSTD, _NOEXCEPT_, and other libcxx-isms) * Change the predicate in the transform tests to add_ten so that problems with multiple application are caught. Modified: libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp libcxx/trunk/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp libcxx/trunk/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp libcxx/trunk/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp libcxx/trunk/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp libcxx/trunk/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp libcxx/trunk/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp Modified: libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp?rev=321922&r1=321921&r2=321922&view=diff == --- libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp Fri Jan 5 18:18:20 2018 @@ -16,8 +16,11 @@ // #include -#include +#include #include +#include +#include +#include #include "test_iterators.h" Modified: libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp?rev=321922&r1=321921&r2=321922&view=diff == --- libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp Fri Jan 5 18:18:20 2018 @@ -17,8 +17,11 @@ //T init, BinaryOperation binary_op); // C++17 #include -#include +#include #include +#include +#include +#include #include "test_iterators.h" @@ -70,7 +73,7 @@ int main() // Make sure that the calculations are done using the init typedef { std::vector v(10); -std::iota(v.begin(), v.end(), 1); +std::iota(v.begin(), v.end(), static_cast(1)); std::vector res; std::exclusive_scan(v.begin(), v.end(), std::back_inserter(res), 1, std::multiplies<>()); Modified: libcxx/trunk/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp?rev=321922&r1=321921&r2=321922&view=diff == --- libcxx/trunk/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp Fri Jan 5 18:18:20 2018 @@ -16,8 +16,11 @@ // #include -#include +#include #include +#include +#include +#include #include "test_iterators.h" Modified: libcxx/trunk/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp?rev=321922&r1=321921&r2=321922&view=diff == --- libcxx/trunk/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp Fri Jan 5 18:18:20 2018 @@ -17,9 +17,12 @@ //BinaryOperation binary_op); // C++17 #include -#include +#include #include +#include #include +#include +#include #include "test_iterators.h" Modified: libcxx/trunk/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass
[libcxx] r321923 - Add casts to prevent narrowing warnings.
Author: bion Date: Fri Jan 5 18:50:03 2018 New Revision: 321923 URL: http://llvm.org/viewvc/llvm-project?rev=321923&view=rev Log: Add casts to prevent narrowing warnings. Modified: libcxx/trunk/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp libcxx/trunk/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp libcxx/trunk/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp Modified: libcxx/trunk/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp?rev=321923&r1=321922&r2=321923&view=diff == --- libcxx/trunk/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp Fri Jan 5 18:50:03 2018 @@ -105,7 +105,7 @@ void basic_tests() std::iota(v.begin(), v.end(), 0); std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 30, std::plus<>(), add_ten{}); for (size_t i = 0; i < v.size(); ++i) -assert(v[i] == 30 + triangle(i - 1) + i * 10); +assert(v[i] == 30 + triangle(i - 1) + (int) i * 10); } { @@ -113,7 +113,7 @@ void basic_tests() std::iota(v.begin(), v.end(), 1); std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 40, std::plus<>(), add_ten{}); for (size_t i = 0; i < v.size(); ++i) -assert(v[i] == 40 + triangle(i) + i * 10); +assert(v[i] == 40 + triangle(i) + (int) i * 10); } { Modified: libcxx/trunk/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp?rev=321923&r1=321922&r2=321923&view=diff == --- libcxx/trunk/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp Fri Jan 5 18:50:03 2018 @@ -96,7 +96,7 @@ void basic_tests() std::iota(v.begin(), v.end(), 0); std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_ten{}); for (size_t i = 0; i < v.size(); ++i) -assert(v[i] == triangle(i) + (i + 1) * 10); +assert(v[i] == triangle(i) + (int)(i + 1) * 10); } { @@ -104,7 +104,7 @@ void basic_tests() std::iota(v.begin(), v.end(), 1); std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_ten{}); for (size_t i = 0; i < v.size(); ++i) -assert(v[i] == triangle(i + 1) + (i + 1) * 10); +assert(v[i] == triangle(i + 1) + (int)(i + 1) * 10); } { Modified: libcxx/trunk/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp?rev=321923&r1=321922&r2=321923&view=diff == --- libcxx/trunk/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp Fri Jan 5 18:50:03 2018 @@ -105,7 +105,7 @@ void basic_tests() std::iota(v.begin(), v.end(), 0); std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_ten{}, 30); for (size_t i = 0; i < v.size(); ++i) -assert(v[i] == 30 + triangle(i) + (i + 1) * 10); +assert(v[i] == 30 + triangle(i) + (int) (i + 1) * 10); } { @@ -113,7 +113,7 @@ void basic_tests() std::iota(v.begin(), v.end(), 1); std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_ten{}, 40); for (size_t i = 0; i < v.size(); ++i) -assert(v[i] == 40 + triangle(i + 1) + (i + 1) * 10); +assert(v[i] == 40 + triangle(i + 1) + (int) (i + 1) * 10); } { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r322021 - Change add_ten to add_one to avoid triggering ubsan integer overflow.
Author: bion Date: Mon Jan 8 11:45:16 2018 New Revision: 322021 URL: http://llvm.org/viewvc/llvm-project?rev=322021&view=rev Log: Change add_ten to add_one to avoid triggering ubsan integer overflow. Modified: libcxx/trunk/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp libcxx/trunk/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp libcxx/trunk/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp Modified: libcxx/trunk/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp?rev=322021&r1=322020&r2=322021&view=diff == --- libcxx/trunk/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp Mon Jan 8 11:45:16 2018 @@ -28,10 +28,10 @@ #include "test_iterators.h" -struct add_ten { +struct add_one { template constexpr auto operator()(T x) const noexcept { -return static_cast(x + 10); +return static_cast(x + 1); } }; @@ -56,15 +56,15 @@ template void test() { - int ia[] = { 1, 3, 5, 7, 9}; -const int pResI0[] = { 0, 11, 24, 39, 56};// with add_ten -const int mResI0[] = { 0, 0, 0, 0, 0}; -const int pResN0[] = { 0, -1, -4, -9, -16};// with negate -const int mResN0[] = { 0, 0, 0, 0, 0}; -const int pResI2[] = { 2, 13, 26, 41, 58};// with add_ten -const int mResI2[] = { 2, 22, 286, 4290, 72930}; -const int pResN2[] = { 2, 1, -2, -7, -14}; // with negate -const int mResN2[] = { 2, -2, 6, -30, 210}; + int ia[] = { 1, 3, 5,7, 9 }; +const int pResI0[] = { 0, 2, 6, 12, 20 };// with add_one +const int mResI0[] = { 0, 0, 0,0, 0 }; +const int pResN0[] = { 0, -1, -4, -9, -16 };// with negate +const int mResN0[] = { 0, 0, 0,0, 0 }; +const int pResI2[] = { 2, 4, 8, 14, 22 };// with add_one +const int mResI2[] = { 2, 4, 16, 96, 768 }; +const int pResN2[] = { 2, 1, -2, -7, -14 };// with negate +const int mResN2[] = { 2, -2, 6, -30, 210 }; const unsigned sa = sizeof(ia) / sizeof(ia[0]); static_assert(sa == sizeof(pResI0) / sizeof(pResI0[0])); // just to be sure static_assert(sa == sizeof(mResI0) / sizeof(mResI0[0])); // just to be sure @@ -76,12 +76,12 @@ test() static_assert(sa == sizeof(mResN2) / sizeof(mResN2[0])); // just to be sure for (unsigned int i = 0; i < sa; ++i ) { -test(Iter(ia), Iter(ia + i), std::plus<>(), add_ten{}, 0, pResI0, pResI0 + i); -test(Iter(ia), Iter(ia + i), std::multiplies<>(), add_ten{}, 0, mResI0, mResI0 + i); +test(Iter(ia), Iter(ia + i), std::plus<>(), add_one{}, 0, pResI0, pResI0 + i); +test(Iter(ia), Iter(ia + i), std::multiplies<>(), add_one{}, 0, mResI0, mResI0 + i); test(Iter(ia), Iter(ia + i), std::plus<>(), std::negate<>(), 0, pResN0, pResN0 + i); test(Iter(ia), Iter(ia + i), std::multiplies<>(), std::negate<>(), 0, mResN0, mResN0 + i); -test(Iter(ia), Iter(ia + i), std::plus<>(), add_ten{}, 2, pResI2, pResI2 + i); -test(Iter(ia), Iter(ia + i), std::multiplies<>(), add_ten{}, 2, mResI2, mResI2 + i); +test(Iter(ia), Iter(ia + i), std::plus<>(), add_one{}, 2, pResI2, pResI2 + i); +test(Iter(ia), Iter(ia + i), std::multiplies<>(), add_one{}, 2, mResI2, mResI2 + i); test(Iter(ia), Iter(ia + i), std::plus<>(), std::negate<>(), 2, pResN2, pResN2 + i); test(Iter(ia), Iter(ia + i), std::multiplies<>(), std::negate<>(), 2, mResN2, mResN2 + i); } @@ -95,30 +95,30 @@ void basic_tests() { std::vector v(10); std::fill(v.begin(), v.end(), 3); -std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 50, std::plus<>(), add_ten{}); +std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 50, std::plus<>(), add_one{}); for (size_t i = 0; i < v.size(); ++i) -assert(v[i] == 50 + (int) i * 13); +assert(v[i] == 50 + (int) i * 4); } { std::vector v(10); std::iota(v.begin(), v.end(), 0); -std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 30, std::plus<>(), add_ten{}); +std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 30, std::plus<>(), add_one{}); for (size_t i = 0; i < v.s
[libcxx] r330791 - [libcxx] [test] Remove nonportable that errc::is_a_directory produces "Is a directory" from ios_base::failure tests
Author: bion Date: Tue Apr 24 18:58:55 2018 New Revision: 330791 URL: http://llvm.org/viewvc/llvm-project?rev=330791&view=rev Log: [libcxx] [test] Remove nonportable that errc::is_a_directory produces "Is a directory" from ios_base::failure tests These io_error asserts that std::errc::is_a_directory has message "Is a directory". On MSVC++ it reports "is a directory" (with a lowercase I). That doesn't matter for the ios_failure component being tested, so just implement in terms of system_category().message(). Reviewed as https://reviews.llvm.org/D45715 Modified: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp Modified: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp?rev=330791&r1=330790&r2=330791&view=diff == --- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp (original) +++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp Tue Apr 24 18:58:55 2018 @@ -15,6 +15,7 @@ #include #include +#include #include int main() @@ -25,7 +26,8 @@ int main() assert(se.code() == std::make_error_code(std::errc::is_a_directory)); std::string what_message(se.what()); assert(what_message.find(what_arg) != std::string::npos); -assert(what_message.find("Is a directory") != std::string::npos); + assert(what_message.find(std::generic_category().message(static_cast +(std::errc::is_a_directory))) != std::string::npos); } { std::string what_arg("io test message"); Modified: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp?rev=330791&r1=330790&r2=330791&view=diff == --- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp (original) +++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp Tue Apr 24 18:58:55 2018 @@ -15,6 +15,7 @@ #include #include +#include #include int main() @@ -28,7 +29,8 @@ int main() assert(se.code() == std::make_error_code(std::errc::is_a_directory)); std::string what_message(se.what()); assert(what_message.find(what_arg) != std::string::npos); -assert(what_message.find("Is a directory") != std::string::npos); + assert(what_message.find(std::generic_category().message(static_cast +(std::errc::is_a_directory))) != std::string::npos); } { std::string what_arg("io test message"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r330999 - [libcxx] [test] Remove non-portable assertions from filebuf tests
Author: bion Date: Thu Apr 26 15:18:33 2018 New Revision: 330999 URL: http://llvm.org/viewvc/llvm-project?rev=330999&view=rev Log: [libcxx] [test] Remove non-portable assertions from filebuf tests seekoff.pass.cpp: libc++'s tests are asserting things about the buffer passed to pubsetbuf. [filebuf.virtuals]/12 says that what the filebuf does with the buffer you give it is completely implementation defined. The MSVC++ implementation takes that buffer and hands it off to the CRT (by calling ::setvbuf) and the CRT doesn't necessarily follow the pattern this test wants. This change simply makes asserts against the buffer's contents use LIBCPP_ASSERT instead of assert. pbackfail.pass.cpp: libc++'s tests are asserting about what characters will and will not be available in the putback area. [filebuf.virtuals]/9 says "The function can alter the number of putback positions available as a result of any call." This change LIBCPP_ASSERTS libc++'s behavior, but checks invariants of the putback area independently. Modified: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp Modified: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp?rev=330999&r1=330998&r2=330999&view=diff == --- libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp (original) +++ libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp Thu Apr 26 15:18:33 2018 @@ -11,11 +11,11 @@ // int_type pbackfail(int_type c = traits::eof()); -// This test is not entirely portable - #include #include +#include "test_macros.h" + template struct test_buf : public std::basic_filebuf @@ -41,7 +41,12 @@ int main() assert(f.is_open()); assert(f.sbumpc() == '1'); assert(f.sgetc() == '2'); -assert(f.pbackfail('a') == -1); +typename test_buf::int_type pbackResult = f.pbackfail('a'); +LIBCPP_ASSERT(pbackResult == -1); +if (pbackResult != -1) { +assert(f.sbumpc() == 'a'); +assert(f.sgetc() == '2'); +} } { test_buf f; @@ -49,8 +54,11 @@ int main() assert(f.is_open()); assert(f.sbumpc() == '1'); assert(f.sgetc() == '2'); -assert(f.pbackfail('a') == 'a'); -assert(f.sbumpc() == 'a'); -assert(f.sgetc() == '2'); +typename test_buf::int_type pbackResult = f.pbackfail('a'); +LIBCPP_ASSERT(pbackResult == 'a'); +if (pbackResult != -1) { +assert(f.sbumpc() == 'a'); +assert(f.sgetc() == '2'); +} } } Modified: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp?rev=330999&r1=330998&r2=330999&view=diff == --- libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp (original) +++ libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp Thu Apr 26 15:18:33 2018 @@ -14,11 +14,11 @@ // pos_type seekpos(pos_type sp, // ios_base::openmode which = ios_base::in | ios_base::out); -// This test is not entirely portable - #include #include +#include "test_macros.h" + int main() { { @@ -30,7 +30,7 @@ int main() | std::ios_base::trunc) != 0); assert(f.is_open()); f.sputn("abcdefghijklmnopqrstuvwxyz", 26); -assert(buf[0] == 'v'); +LIBCPP_ASSERT(buf[0] == 'v'); pos_type p = f.pubseekoff(-15, std::ios_base::cur); assert(p == 11); assert(f.sgetc() == 'l'); @@ -51,7 +51,7 @@ int main() | std::ios_base::trunc) != 0); assert(f.is_open()); f.sputn(L"abcdefghijklmnopqrstuvwxyz", 26); -assert(buf[0] == L'v'); +LIBCPP_ASSERT(buf[0] == L'v'); pos_type p = f.pubseekoff(-15, std::ios_base::cur); assert(p == 11); assert(f.sgetc() == L'l'); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25492: [libcxx] [test] Fix shadowing in string.assign and string.append
BillyONeal created this revision. BillyONeal added reviewers: EricWF, mclow.lists. BillyONeal added a subscriber: cfe-commits. https://reviews.llvm.org/D25492 Files: test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp Index: test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp === --- test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp +++ test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp @@ -119,11 +119,10 @@ test_npos(S(), SV("12345"), 5, S("")); test_npos(S(), SV("12345"), 6, S("not happening")); } + { -typedef std::string S; -typedef std::string_view SV; -S s = "ABCD"; -SV sv = "EFGH"; +std::string s = "ABCD"; +std::string_view sv = "EFGH"; char arr[] = "IJKL"; s.assign("CDEF", 0);// calls assign(const char *, len) @@ -137,7 +136,7 @@ s.assign(sv, 0); // calls assign(T, pos, npos) assert(s == sv); s.clear(); - + s.assign(sv, 0, std::string::npos); // calls assign(T, pos, npos) assert(s == sv); s.clear(); @@ -153,27 +152,27 @@ s.assign(arr, 0); // calls assign(const char *, len) assert(s == ""); s.clear(); +} { -S s = "ABCD"; -SV sv = s; +std::string s = "ABCD"; +std::string_view sv = s; s.assign(sv); assert(s == "ABCD"); sv = s; s.assign(sv, 0, std::string::npos); assert(s == "ABCD"); } - + { -S s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; -SV sv = s; +std::string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +std::string_view sv = s; s.assign(sv); assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); sv = s; s.assign(sv, 0, std::string::npos); assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); } -} } Index: test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp === --- test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp +++ test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp @@ -120,11 +120,10 @@ test_npos(S(), SV("12345"), 5, S("")); test_npos(S(), SV("12345"), 6, S("not happening")); } + { -typedef std::string S; -typedef std::string_view SV; -S s; -SV sv = "EFGH"; +std::string s; +std::string_view sv = "EFGH"; char arr[] = "IJKL"; s.append("CDEF", 0);// calls append(const char *, len) @@ -138,7 +137,7 @@ s.append(sv, 0); // calls append(T, pos, npos) assert(s == sv); s.clear(); - + s.append(sv, 0, std::string::npos); // calls append(T, pos, npos) assert(s == sv); s.clear(); @@ -154,10 +153,11 @@ s.append(arr, 0); // calls append(const char *, len) assert(s == ""); s.clear(); +} { -S s = "ABCD"; -SV sv = s; +std::string s = "ABCD"; +std::string_view sv = s; s.append(sv); assert(s == "ABCDABCD"); @@ -169,16 +169,15 @@ s.append(sv, sv.size()); assert(s == "ABCDABCDABCDABCD"); } - + { -S s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; -SV sv = s; +std::string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +std::string_view sv = s; s.append(sv); assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"); sv = s; s.append(sv, 0, std::string::npos); assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"); } -} } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25531: [libcxx] [test] Include in string_view::copy test
BillyONeal created this revision. BillyONeal added reviewers: EricWF, mclow.lists. BillyONeal added a subscriber: cfe-commits. The string_view::copy test calls std::min, which is not required to be made available by including . (The MSVC++ STL does not use std::min internally because we need to avoid the *macro* named min which is defined by windows.h) https://reviews.llvm.org/D25531 Files: test/std/strings/string.view/string.view.ops/copy.pass.cpp Index: test/std/strings/string.view/string.view.ops/copy.pass.cpp === --- test/std/strings/string.view/string.view.ops/copy.pass.cpp +++ test/std/strings/string.view/string.view.ops/copy.pass.cpp @@ -19,6 +19,7 @@ #include +#include #include #include "test_macros.h" Index: test/std/strings/string.view/string.view.ops/copy.pass.cpp === --- test/std/strings/string.view/string.view.ops/copy.pass.cpp +++ test/std/strings/string.view/string.view.ops/copy.pass.cpp @@ -19,6 +19,7 @@ #include +#include #include #include "test_macros.h" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25531: [libcxx] [test] Include in string_view::copy test
BillyONeal added a comment. No, I don't believe any of us in MSVC++ land have commit access. https://reviews.llvm.org/D25531 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r329665 - [libcxx] [test] Use the correct type from strlen. Include correct header.
Author: bion Date: Mon Apr 9 20:04:07 2018 New Revision: 329665 URL: http://llvm.org/viewvc/llvm-project?rev=329665&view=rev Log: [libcxx] [test] Use the correct type from strlen. Include correct header. Modified: libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/cp_size_cp.pass.cpp libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/scp_size_scp.pass.cpp libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/ucp_size_ucp.pass.cpp libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp Modified: libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/cp_size_cp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/cp_size_cp.pass.cpp?rev=329665&r1=329664&r2=329665&view=diff == --- libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/cp_size_cp.pass.cpp (original) +++ libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/cp_size_cp.pass.cpp Mon Apr 9 20:04:07 2018 @@ -15,6 +15,7 @@ #include #include +#include int main() { @@ -71,8 +72,8 @@ int main() } { char buf[10] = "abcd"; -int s = std::strlen(buf); -std::strstreambuf sb(buf, sizeof(buf)-s, buf + s); +std::size_t s = std::strlen(buf); +std::strstreambuf sb(buf, sizeof(buf) - s, buf + s); assert(sb.sgetc() == 'a'); assert(sb.snextc() == 'b'); assert(sb.snextc() == 'c'); Modified: libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/scp_size_scp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/scp_size_scp.pass.cpp?rev=329665&r1=329664&r2=329665&view=diff == --- libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/scp_size_scp.pass.cpp (original) +++ libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/scp_size_scp.pass.cpp Mon Apr 9 20:04:07 2018 @@ -15,6 +15,7 @@ #include #include +#include int main() { @@ -71,8 +72,8 @@ int main() } { signed char buf[10] = "abcd"; -int s = std::strlen((char*)buf); -std::strstreambuf sb(buf, sizeof(buf)-s, buf + s); +std::size_t s = std::strlen((char*)buf); +std::strstreambuf sb(buf, sizeof(buf) - s, buf + s); assert(sb.sgetc() == 'a'); assert(sb.snextc() == 'b'); assert(sb.snextc() == 'c'); Modified: libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/ucp_size_ucp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/ucp_size_ucp.pass.cpp?rev=329665&r1=329664&r2=329665&view=diff == --- libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/ucp_size_ucp.pass.cpp (original) +++ libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/ucp_size_ucp.pass.cpp Mon Apr 9 20:04:07 2018 @@ -15,6 +15,7 @@ #include #include +#include int main() { @@ -71,8 +72,8 @@ int main() } { unsigned char buf[10] = "abcd"; -int s = std::strlen((char*)buf); -std::strstreambuf sb(buf, sizeof(buf)-s, buf + s); +std::size_t s = std::strlen((char*)buf); +std::strstreambuf sb(buf, sizeof(buf) - s, buf + s); assert(sb.sgetc() == 'a'); assert(sb.snextc() == 'b'); assert(sb.snextc() == 'c'); Modified: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp?rev=329665&r1=329664&r2=329665&view=diff == --- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp (original) +++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp Mon Apr 9 20:04:07 2018 @@ -45,7 +45,7 @@ protected: { if (ch != base::traits_type::eof()) { -int n = str_.size(); +std::size_t n = str_.size(); str_.push_back(
[libcxx] r318276 - Tolerate [[nodiscard]] annotations in the STL. Reviewed as https://reviews.llvm.org/D39033
Author: bion Date: Tue Nov 14 23:40:37 2017 New Revision: 318276 URL: http://llvm.org/viewvc/llvm-project?rev=318276&view=rev Log: Tolerate [[nodiscard]] annotations in the STL. Reviewed as https://reviews.llvm.org/D39033 Modified: libcxx/trunk/test/std/containers/associative/map/map.ops/count0.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/count1.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/count2.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/count3.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/find0.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/find1.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/find2.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/find3.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp libcxx/trunk/test/std/iterators/iterators.general/gcc_workaround.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.access/at.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp libcxx/trunk/test/std/strings/string.view/string.view.access/at.pass.cpp libcxx/trunk/test/std/utilities/any/any.nonmembers/make_any.pass.cpp libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp libcxx/trunk/test/std/utilitie
[libcxx] r318277 - Tolerate even more [[nodiscard]] in the STL. Reviewed as https://reviews.llvm.org/D39080
Author: bion Date: Tue Nov 14 23:45:07 2017 New Revision: 318277 URL: http://llvm.org/viewvc/llvm-project?rev=318277&view=rev Log: Tolerate even more [[nodiscard]] in the STL. Reviewed as https://reviews.llvm.org/D39080 Modified: libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.search/search_n.pass.cpp libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.access/at.pass.cpp libcxx/trunk/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.disc/assign.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.disc/copy.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.disc/discard.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/assign.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/copy.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/discard.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/assign.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/copy.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_copy.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_move.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/discard.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.device/eval.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/discard.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.mers/assign.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.mers/copy.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.mers/discard.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.sub/assign.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.sub/copy.pass.cpp libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.sub/discard.pass.cpp libcxx/trunk/test/std/re/re.alg/re.alg.search/grep.pass.cpp libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp Modified: libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.search/search_n.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.search/search_n.pass.cpp?rev=318277&r1=318276&r2=318277&view=diff == --- libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.search/search_n.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.search/search_n.pass.cpp Tue Nov 14 23:45:07 2017 @@ -66,7 +66,7 @@ test() assert(std::search_n(Iter(ic), Iter(ic+sc), 4, 0) == Iter(ic+sc)); // Check that we properly convert the size argument to an integral. -std::search_n(Iter(ic), Iter(ic+sc), UserDefinedIntegral(0), 0); +(void)std::search_n(Iter(ic), Iter(ic+sc), UserDefinedIntegral(0), 0); } int main() Modified: libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp?rev=318277&r1=318276&r2=318277&view=diff == --- libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp Tue Nov 14 23:45:07 2017 @@ -142,7 +142,7 @@ test() count_equal::count = 0; // Check that we properly convert the size argum
[libcxx] r318804 - Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as https://reviews.llvm.org/D40065
Author: bion Date: Tue Nov 21 13:37:26 2017 New Revision: 318804 URL: http://llvm.org/viewvc/llvm-project?rev=318804&view=rev Log: Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as https://reviews.llvm.org/D40065 Modified: libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.access/at.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/count1.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/count2.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/count3.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/find1.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/find2.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/find3.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp libcxx/trunk/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp libcxx/trunk/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.overview/types.pass.cpp libcxx/trunk/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.overview/types.pass.cpp libcxx/trunk/test/std/iterators/iterator.range/begin-end.fail.cpp libcxx/trunk/test/std/iterators/iterators.general/gcc_workaround.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp libcxx/trunk/test/std/re/re.alg/re.alg.search/grep.pass.cpp libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.access/at.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.share
[libcxx] r318808 - Add missing test_macros.h inclusion.
Author: bion Date: Tue Nov 21 14:16:57 2017 New Revision: 318808 URL: http://llvm.org/viewvc/llvm-project?rev=318808&view=rev Log: Add missing test_macros.h inclusion. Modified: libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp Modified: libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp?rev=318808&r1=318807&r2=318808&view=diff == --- libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp (original) +++ libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp Tue Nov 21 14:16:57 2017 @@ -15,6 +15,7 @@ #include #include +#include "test_macros.h" int main() { for (std::regex_constants::syntax_option_type op : ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r318812 - Replace assert(true) in tests with actual asserts. Reviewed as https://reviews.llvm.org/D40324
Author: bion Date: Tue Nov 21 15:03:02 2017 New Revision: 318812 URL: http://llvm.org/viewvc/llvm-project?rev=318812&view=rev Log: Replace assert(true) in tests with actual asserts. Reviewed as https://reviews.llvm.org/D40324 In a17cd7c641c34b6c4bd4845a4d4fb590cb6c238c Marshall added assert(true) to the vector::size tests, which break on C1XX: D:\Contest\gl0qojfu.5pe\src\qa\vc\libs\libcxx\upstream\test\std\containers\sequences\vector.bool\size.pass.cpp(62): error C2220: warning treated as error - no 'object' file generated d:\contest\gl0qojfu.5pe\src\qa\vc\libs\libcxx\upstream\test\std\containers\sequences\vector.bool\size.pass.cpp(33) : warning C6326: Potential comparison of a constant with another constant. d:\contest\gl0qojfu.5pe\src\qa\vc\libs\libcxx\upstream\test\std\containers\sequences\vector.bool\size.pass.cpp(52) : warning C6326: Potential comparison of a constant with another constant. The corresponding test for vector::size asserts assert(c.size() == 3);, so I changed it to do that here. Modified: libcxx/trunk/test/std/containers/sequences/vector.bool/size.pass.cpp Modified: libcxx/trunk/test/std/containers/sequences/vector.bool/size.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector.bool/size.pass.cpp?rev=318812&r1=318811&r2=318812&view=diff == --- libcxx/trunk/test/std/containers/sequences/vector.bool/size.pass.cpp (original) +++ libcxx/trunk/test/std/containers/sequences/vector.bool/size.pass.cpp Tue Nov 21 15:03:02 2017 @@ -31,7 +31,7 @@ int main() c.push_back(true); assert(c.size() == 2); c.push_back(C::value_type(3)); -assert(true); +assert(c.size() == 3); c.erase(c.begin()); assert(c.size() == 2); c.erase(c.begin()); @@ -50,7 +50,7 @@ int main() c.push_back(true); assert(c.size() == 2); c.push_back(C::value_type(3)); -assert(true); +assert(c.size() == 3); c.erase(c.begin()); assert(c.size() == 2); c.erase(c.begin()); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r318830 - Add another test_macros.h include I missed to tuple.by.type.pass.cpp
Author: bion Date: Wed Nov 22 04:29:17 2017 New Revision: 318830 URL: http://llvm.org/viewvc/llvm-project?rev=318830&view=rev Log: Add another test_macros.h include I missed to tuple.by.type.pass.cpp Modified: libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp Modified: libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp?rev=318830&r1=318829&r2=318830&view=diff == --- libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp (original) +++ libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp Wed Nov 22 04:29:17 2017 @@ -11,6 +11,7 @@ #include #include +#include "test_macros.h" struct UserType {}; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r297772 - Fixed unintentional assignment-in-assert in new "extending memory management tools" algorithms.
Author: bion Date: Tue Mar 14 14:36:30 2017 New Revision: 297772 URL: http://llvm.org/viewvc/llvm-project?rev=297772&view=rev Log: Fixed unintentional assignment-in-assert in new "extending memory management tools" algorithms. Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp?rev=297772&r1=297771&r2=297772&view=diff == --- libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp Tue Mar 14 14:36:30 2017 @@ -80,7 +80,7 @@ void test_counted() Counted* p = (Counted*)pool; std::uninitialized_default_construct(It(p), It(p+1)); assert(Counted::count == 1); -assert(Counted::constructed = 1); +assert(Counted::constructed == 1); std::uninitialized_default_construct(It(p+1), It(p+N)); assert(Counted::count == 5); assert(Counted::constructed == 5); Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp?rev=297772&r1=297771&r2=297772&view=diff == --- libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp Tue Mar 14 14:36:30 2017 @@ -80,7 +80,7 @@ void test_counted() It e = std::uninitialized_default_construct_n(It(p), 1); assert(e == It(p+1)); assert(Counted::count == 1); -assert(Counted::constructed = 1); +assert(Counted::constructed == 1); e = std::uninitialized_default_construct_n(It(p+1), 4); assert(e == It(p+N)); assert(Counted::count == 5); Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp?rev=297772&r1=297771&r2=297772&view=diff == --- libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp Tue Mar 14 14:36:30 2017 @@ -79,7 +79,7 @@ void test_counted() Counted* p = (Counted*)pool; std::uninitialized_value_construct(It(p), It(p+1)); assert(Counted::count == 1); -assert(Counted::constructed = 1); +assert(Counted::constructed == 1); std::uninitialized_value_construct(It(p+1), It(p+N)); assert(Counted::count == 5); assert(Counted::constructed == 5); Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp?rev=297772&r1=297771&r2=297772&view=diff == --- libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp
[libcxx] r299734 - Allow a standard library to implement conditional noexcept for optional and unique_ptr hash functions.
Author: bion Date: Thu Apr 6 18:50:21 2017 New Revision: 299734 URL: http://llvm.org/viewvc/llvm-project?rev=299734&view=rev Log: Allow a standard library to implement conditional noexcept for optional and unique_ptr hash functions. These tests were unconditionally asserting that optional and unique_ptr declare throwing hashes, but MSVC++ implements conditional noexcept forwarding that of the underlying hash function. As a result we were failing these tests but there's nothing forbidding strengthening noexcept in that way. Changed the ASSERT_NOT_NOEXCEPT asserts to use types which themselves have non-noexcept hash functions. Modified: libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp Modified: libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp?rev=299734&r1=299733&r2=299734&view=diff == --- libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp Thu Apr 6 18:50:21 2017 @@ -67,10 +67,14 @@ int main() int* ptr = new int; std::unique_ptr p(ptr); std::hash > f; -ASSERT_NOT_NOEXCEPT(f(p)); std::size_t h = f(p); assert(h == std::hash()(ptr)); } + { +std::unique_ptr> pThrowingHash; +std::hash>> fThrowingHash; +ASSERT_NOT_NOEXCEPT(fThrowingHash(pThrowingHash)); + } #if TEST_STD_VER >= 11 { test_enabled_with_deleter>(); Modified: libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp?rev=299734&r1=299733&r2=299734&view=diff == --- libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp Thu Apr 6 18:50:21 2017 @@ -38,9 +38,14 @@ int main() std::hash>{}(optional{}); { +optional opt; +ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); +ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); +} + +{ typedef int T; optional opt; -ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); assert(std::hash>{}(opt) == nullopt_hash); opt = 2; assert(std::hash>{}(opt) == std::hash{}(*opt)); @@ -48,7 +53,6 @@ int main() { typedef std::string T; optional opt; -ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); assert(std::hash>{}(opt) == nullopt_hash); opt = std::string("123"); assert(std::hash>{}(opt) == std::hash{}(*opt)); @@ -56,7 +60,6 @@ int main() { typedef std::unique_ptr T; optional opt; -ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); assert(std::hash>{}(opt) == nullopt_hash); opt = std::unique_ptr(new int(3)); assert(std::hash>{}(opt) == std::hash{}(*opt)); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r299735 - Add noexcept(false) to more strongly indicate that not being noexcept is important for hash tests.
Author: bion Date: Thu Apr 6 18:50:33 2017 New Revision: 299735 URL: http://llvm.org/viewvc/llvm-project?rev=299735&view=rev Log: Add noexcept(false) to more strongly indicate that not being noexcept is important for hash tests. Modified: libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp Modified: libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp?rev=299735&r1=299734&r2=299735&view=diff == --- libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp Thu Apr 6 18:50:33 2017 @@ -50,7 +50,7 @@ namespace std { template struct hash<::min_pointer>> { - size_t operator()(::min_pointer> p) const { + size_t operator()(::min_pointer> p) const noexcept(false) { if (!p) return 0; return std::hash{}(std::addressof(*p)); } Modified: libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp?rev=299735&r1=299734&r2=299735&view=diff == --- libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp Thu Apr 6 18:50:33 2017 @@ -26,7 +26,7 @@ namespace std { template <> struct hash { - size_t operator()(B const&) { return 0; } + size_t operator()(B const&) noexcept(false) { return 0; } }; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r300516 - Allow a standard library to implement conditional noexcept for optional and unique_ptr hash functions.
Author: bion Date: Mon Apr 17 19:19:50 2017 New Revision: 300516 URL: http://llvm.org/viewvc/llvm-project?rev=300516&view=rev Log: Allow a standard library to implement conditional noexcept for optional and unique_ptr hash functions. These tests were unconditionally asserting that optional and unique_ptr declare throwing hashes, but MSVC++ implements conditional noexcept forwarding that of the underlying hash function. As a result we were failing these tests but there's nothing forbidding strengthening noexcept in that way. Changed the ASSERT_NOT_NOEXCEPT asserts to use types which themselves have non-noexcept hash functions. Modified: libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp Modified: libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp?rev=300516&r1=300515&r2=300516&view=diff == --- libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp Mon Apr 17 19:19:50 2017 @@ -50,7 +50,7 @@ namespace std { template struct hash<::min_pointer>> { - size_t operator()(::min_pointer> p) const noexcept(false) { + size_t operator()(::min_pointer> p) const TEST_NOEXCEPT_FALSE { if (!p) return 0; return std::hash{}(std::addressof(*p)); } @@ -67,12 +67,16 @@ int main() int* ptr = new int; std::unique_ptr p(ptr); std::hash > f; -ASSERT_NOT_NOEXCEPT(f(p)); std::size_t h = f(p); assert(h == std::hash()(ptr)); } #if TEST_STD_VER >= 11 { +std::unique_ptr> pThrowingHash; +std::hash>> fThrowingHash; +ASSERT_NOT_NOEXCEPT(fThrowingHash(pThrowingHash)); + } + { test_enabled_with_deleter>(); test_enabled_with_deleter>(); test_enabled_with_deleter>(); Modified: libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp?rev=300516&r1=300515&r2=300516&view=diff == --- libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp Mon Apr 17 19:19:50 2017 @@ -26,7 +26,7 @@ namespace std { template <> struct hash { - size_t operator()(B const&) noexcept(false) { return 0; } + size_t operator()(B const&) TEST_NOEXCEPT_FALSE { return 0; } }; } @@ -37,10 +37,16 @@ int main() const std::size_t nullopt_hash = std::hash>{}(optional{}); + +{ +optional opt; +ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); +ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); +} + { typedef int T; optional opt; -ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); assert(std::hash>{}(opt) == nullopt_hash); opt = 2; assert(std::hash>{}(opt) == std::hash{}(*opt)); @@ -48,7 +54,6 @@ int main() { typedef std::string T; optional opt; -ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); assert(std::hash>{}(opt) == nullopt_hash); opt = std::string("123"); assert(std::hash>{}(opt) == std::hash{}(*opt)); @@ -56,7 +61,6 @@ int main() { typedef std::unique_ptr T; optional opt; -ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); assert(std::hash>{}(opt) == nullopt_hash); opt = std::unique_ptr(new int(3)); assert(std::hash>{}(opt) == std::hash{}(*opt)); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r300937 - Resolve unused local typedef warning in test.
Author: bion Date: Thu Apr 20 20:10:04 2017 New Revision: 300937 URL: http://llvm.org/viewvc/llvm-project?rev=300937&view=rev Log: Resolve unused local typedef warning in test. Modified: libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp Modified: libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp?rev=300937&r1=300936&r2=300937&view=diff == --- libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp (original) +++ libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp Thu Apr 20 20:10:04 2017 @@ -63,7 +63,6 @@ void test(SV sv, unsigned pos, unsigned n, const typename S::allocator_type& a) { typedef typename S::traits_type T; -typedef typename S::allocator_type A; if (pos <= sv.size()) { S s2(sv, pos, n, a); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r302472 - Resolve integer overflow warnings in GCD and LCM tests
Author: bion Date: Mon May 8 16:52:05 2017 New Revision: 302472 URL: http://llvm.org/viewvc/llvm-project?rev=302472&view=rev Log: Resolve integer overflow warnings in GCD and LCM tests lcm.pass.cpp: 19: Update headers to that actually used in the test. 41: test0 was triggering narrowing warnings for all callers, because the inputs were always ints, but some of the explicit template arguments were smaller than that. Instead, have this function accept ints and static_cast explicitly to the types we want before calling std::lcm. 47: Replace unnecessary ternary. 55: Use foo_t instead of typename foo<>::type 111/116: intX_t were not std::qualified but only headers were included. 141: C1XX has a bug where it interprets 2147483648 as unsigned int. Then the negation trips "negation of unsigned value, result still unsigned" warnings. Perma-workaround this issue by saying INT_MIN, which better documents the intended behavior and avoids triggering warnings on C1XX. gcd.pass.cpp: Same changes as lcm.pass.cpp but for GCD. Modified: libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp Modified: libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp?rev=302472&r1=302471&r2=302472&view=diff == --- libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp Mon May 8 16:52:05 2017 @@ -16,8 +16,10 @@ #include #include +#include +#include #include // for rand() -#include +#include constexpr struct { int x; @@ -36,21 +38,24 @@ constexpr struct { template -constexpr bool test0(Input1 in1, Input2 in2, Output out) +constexpr bool test0(int in1, int in2, int out) { -static_assert((std::is_same::value), "" ); -static_assert((std::is_same::value), "" ); -return out == std::gcd(in1, in2) ? true : (std::abort(), false); +auto value1 = static_cast(in1); +auto value2 = static_cast(in2); +static_assert(std::is_same_v, ""); +static_assert(std::is_same_v, ""); +assert(static_cast(out) == std::gcd(value1, value2)); +return true; } template constexpr bool do_test(int = 0) { -using S1 = typename std::make_signed::type; -using S2 = typename std::make_signed::type; -using U1 = typename std::make_unsigned::type; -using U2 = typename std::make_unsigned::type; +using S1 = std::make_signed_t; +using S2 = std::make_signed_t; +using U1 = std::make_unsigned_t; +using U2 = std::make_unsigned_t; bool accumulate = true; for (auto TC : Cases) { { // Test with two signed types @@ -103,15 +108,15 @@ int main() assert(do_test(non_cce)); assert(do_test(non_cce)); -static_assert(do_test< int8_t>(), ""); -static_assert(do_test(), ""); -static_assert(do_test(), ""); -static_assert(do_test(), ""); - -assert(do_test< int8_t>(non_cce)); -assert(do_test(non_cce)); -assert(do_test(non_cce)); -assert(do_test(non_cce)); +static_assert(do_test(), ""); +static_assert(do_test(), ""); +static_assert(do_test(), ""); +static_assert(do_test(), ""); + +assert(do_test(non_cce)); +assert(do_test(non_cce)); +assert(do_test(non_cce)); +assert(do_test(non_cce)); static_assert(do_test(), ""); static_assert(do_test(), ""); @@ -133,8 +138,8 @@ int main() // LWG#2837 { -auto res = std::gcd((int64_t)1234, (int32_t)-2147483648); -static_assert( std::is_same::type>::value, ""); -assert(res == 2); +auto res = std::gcd(static_cast(1234), INT32_MIN); +static_assert(std::is_same_v, ""); +assert(res == 2); } } Modified: libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp?rev=302472&r1=302471&r2=302472&view=diff == --- libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp (original) +++ libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp Mon May 8 16:52:05 2017 @@ -11,12 +11,14 @@ // // template -// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) +// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) #include #include +#include +#include #include -#include +#include constexpr struct { int x; @@ -34,21 +36,24 @@ constexpr struct { }; template -constexpr bool test0(Input1 in1, Input2 in2, Output out) +constexpr bool test0(int in1, int in2, int out) { -static_assert((std::is_same::value), "" ); -static_assert((std::is_same::value), "" ); -
[libcxx] r302473 - Fix possible loss of data warnings on amd64
Author: bion Date: Mon May 8 16:54:53 2017 New Revision: 302473 URL: http://llvm.org/viewvc/llvm-project?rev=302473&view=rev Log: Fix possible loss of data warnings on amd64 In T_size_size.pass, there is an explicit template argument to std::min to ask for unsigned, to avoid type deduction errors. However, C1XX' warnings still hate this use, because a 64 bit value (a size_t) is being passed to a function accepting an unsigned (a 32 bit value). Instead, change the tests to pass around std::size_t instances, and explicitly narrow when constructing the string type under test. This also allows removal of explicit template arguments to std::min. Modified: libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp Modified: libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp?rev=302473&r1=302472&r2=302473&view=diff == --- libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp (original) +++ libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp Mon May 8 16:54:53 2017 @@ -27,16 +27,17 @@ template void -test(SV sv, unsigned pos, unsigned n) +test(SV sv, std::size_t pos, std::size_t n) { typedef typename S::traits_type T; typedef typename S::allocator_type A; +typedef typename S::size_type Size; if (pos <= sv.size()) { -S s2(sv, pos, n); +S s2(sv, static_cast(pos), static_cast(n)); LIBCPP_ASSERT(s2.__invariants()); assert(pos <= sv.size()); -unsigned rlen = std::min(sv.size() - pos, n); +std::size_t rlen = std::min(sv.size() - pos, n); assert(s2.size() == rlen); assert(T::compare(s2.data(), sv.data() + pos, rlen) == 0); assert(s2.get_allocator() == A()); @@ -47,7 +48,7 @@ test(SV sv, unsigned pos, unsigned n) { try { -S s2(sv, pos, n); +S s2(sv, static_cast(pos), static_cast(n)); assert(false); } catch (std::out_of_range&) @@ -60,15 +61,16 @@ test(SV sv, unsigned pos, unsigned n) template void -test(SV sv, unsigned pos, unsigned n, const typename S::allocator_type& a) +test(SV sv, std::size_t pos, std::size_t n, const typename S::allocator_type& a) { typedef typename S::traits_type T; +typedef typename S::size_type Size; if (pos <= sv.size()) { -S s2(sv, pos, n, a); +S s2(sv, static_cast(pos), static_cast(n), a); LIBCPP_ASSERT(s2.__invariants()); assert(pos <= sv.size()); -unsigned rlen = std::min(sv.size() - pos, n); +std::size_t rlen = std::min(sv.size() - pos, n); assert(s2.size() == rlen); assert(T::compare(s2.data(), sv.data() + pos, rlen) == 0); assert(s2.get_allocator() == a); @@ -79,7 +81,7 @@ test(SV sv, unsigned pos, unsigned n, co { try { -S s2(sv, pos, n, a); +S s2(sv, static_cast(pos), static_cast(n), a); assert(false); } catch (std::out_of_range&) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r302710 - Update is_trivially_copyable tests with CWG 2094
Author: bion Date: Wed May 10 14:43:31 2017 New Revision: 302710 URL: http://llvm.org/viewvc/llvm-project?rev=302710&view=rev Log: Update is_trivially_copyable tests with CWG 2094 Clang 5.0 implements these changes here: https://github.com/llvm-mirror/clang/commit/87cd035326a39523eeb1b295ad36cff337141ef9 MSVC++ will implement these changes in the first toolset update to 2017. Differential Revision: https://reviews.llvm.org/D33021 Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp?rev=302710&r1=302709&r2=302710&view=diff == --- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp Wed May 10 14:43:31 2017 @@ -22,13 +22,13 @@ void test_is_trivially_copyable() { static_assert( std::is_trivially_copyable::value, ""); static_assert( std::is_trivially_copyable::value, ""); -static_assert(!std::is_trivially_copyable::value, ""); -static_assert(!std::is_trivially_copyable::value, ""); +static_assert( std::is_trivially_copyable::value, ""); +static_assert( std::is_trivially_copyable::value, ""); #if TEST_STD_VER > 14 static_assert( std::is_trivially_copyable_v, ""); static_assert( std::is_trivially_copyable_v, ""); -static_assert(!std::is_trivially_copyable_v, ""); -static_assert(!std::is_trivially_copyable_v, ""); +static_assert( std::is_trivially_copyable_v, ""); +static_assert( std::is_trivially_copyable_v, ""); #endif } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r302728 - Fix bad #endif in msvc_stdlib_force_include.hpp.
Author: bion Date: Wed May 10 15:58:30 2017 New Revision: 302728 URL: http://llvm.org/viewvc/llvm-project?rev=302728&view=rev Log: Fix bad #endif in msvc_stdlib_force_include.hpp. Modified: libcxx/trunk/test/support/msvc_stdlib_force_include.hpp Modified: libcxx/trunk/test/support/msvc_stdlib_force_include.hpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/msvc_stdlib_force_include.hpp?rev=302728&r1=302727&r2=302728&view=diff == --- libcxx/trunk/test/support/msvc_stdlib_force_include.hpp (original) +++ libcxx/trunk/test/support/msvc_stdlib_force_include.hpp Wed May 10 15:58:30 2017 @@ -70,13 +70,14 @@ const AssertionDialogAvoider assertion_d // MSVC has quick_exit() and at_quick_exit(). #define _LIBCPP_HAS_QUICK_EXIT -// atomic_is_lock_free.pass.cpp needs this VS 2015 Update 2 fix. -#define _ENABLE_ATOMIC_ALIGNMENT_FIX +#ifndef _LIBCXX_IN_DEVCRT +// atomic_is_lock_free.pass.cpp needs this VS 2015 Update 2 fix. +#define _ENABLE_ATOMIC_ALIGNMENT_FIX -// Enable features that /std:c++latest removes by default. -#define _HAS_AUTO_PTR_ETC 1 -#define _HAS_FUNCTION_ASSIGN 1 -#define _HAS_OLD_IOSTREAMS_MEMBERS 1 +// Enable features that /std:c++latest removes by default. +#define _HAS_AUTO_PTR_ETC 1 +#define _HAS_FUNCTION_ASSIGN 1 +#define _HAS_OLD_IOSTREAMS_MEMBERS 1 // Silence warnings about raw pointers and other unchecked iterators. #define _SCL_SECURE_NO_WARNINGS ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits