Clean up more usages of _LIBCPP_HAS_NO_RVALUE_REFERENCES

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@296854 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2017-03-03 03:43:25 +00:00
parent 04732df052
commit f4dfb45247
15 changed files with 25 additions and 58 deletions

View File

@@ -7,6 +7,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <iterator> // <iterator>
// back_insert_iterator // back_insert_iterator
@@ -17,8 +19,6 @@
#include <iterator> #include <iterator>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <vector> #include <vector>
#include <memory> #include <memory>
#include <cassert> #include <cassert>
@@ -32,11 +32,7 @@ test(C c)
assert(c.back() == typename C::value_type()); assert(c.back() == typename C::value_type());
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test(std::vector<std::unique_ptr<int> >()); test(std::vector<std::unique_ptr<int> >());
#endif
} }

View File

@@ -7,6 +7,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <iterator> // <iterator>
// front_insert_iterator // front_insert_iterator
@@ -15,9 +17,6 @@
// operator=(Cont::value_type&& value); // operator=(Cont::value_type&& value);
#include <iterator> #include <iterator>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <list> #include <list>
#include <memory> #include <memory>
#include <cassert> #include <cassert>
@@ -31,11 +30,7 @@ test(C c)
assert(c.front() == typename C::value_type()); assert(c.front() == typename C::value_type());
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test(std::list<std::unique_ptr<int> >()); test(std::list<std::unique_ptr<int> >());
#endif
} }

View File

@@ -7,6 +7,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <iterator> // <iterator>
// insert_iterator // insert_iterator
@@ -17,7 +19,6 @@
#include <iterator> #include <iterator>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <memory> #include <memory>
@@ -52,11 +53,8 @@ struct do_nothing
void operator()(void*) const {} void operator()(void*) const {}
}; };
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
typedef std::unique_ptr<int, do_nothing> Ptr; typedef std::unique_ptr<int, do_nothing> Ptr;
typedef std::vector<Ptr> C; typedef std::vector<Ptr> C;
@@ -94,5 +92,4 @@ int main()
insert3at(c2, c2.begin()+3, Ptr(x+3), Ptr(x+4), Ptr(x+5)); insert3at(c2, c2.begin()+3, Ptr(x+3), Ptr(x+4), Ptr(x+5));
test(std::move(c1), 3, Ptr(x+3), Ptr(x+4), Ptr(x+5), c2); test(std::move(c1), 3, Ptr(x+3), Ptr(x+4), Ptr(x+5), c2);
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} }

View File

@@ -7,6 +7,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <valarray> // <valarray>
// template<class T> class valarray; // template<class T> class valarray;
@@ -19,7 +21,6 @@
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
typedef int T; typedef int T;
T a[] = {1, 2, 3, 4, 5}; T a[] = {1, 2, 3, 4, 5};
@@ -60,5 +61,4 @@ int main()
assert(v2[i][j] == a[i][j]); assert(v2[i][j] == a[i][j]);
} }
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} }

View File

@@ -7,6 +7,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <valarray> // <valarray>
// template<class T> class valarray; // template<class T> class valarray;
@@ -20,7 +22,6 @@
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
typedef int T; typedef int T;
T a[] = {1, 2, 3, 4, 5}; T a[] = {1, 2, 3, 4, 5};
@@ -58,5 +59,4 @@ int main()
assert(v2[i][j] == a[i][j]); assert(v2[i][j] == a[i][j]);
} }
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} }

View File

@@ -22,6 +22,7 @@
#include <numeric> #include <numeric>
#include <cassert> #include <cassert>
#include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
template <class InIter, class OutIter> template <class InIter, class OutIter>
@@ -38,7 +39,7 @@ test()
assert(ib[i] == ir[i]); assert(ib[i] == ir[i]);
} }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #if TEST_STD_VER >= 11
class Y; class Y;
@@ -107,7 +108,7 @@ int main()
test<const int*, random_access_iterator<int*> >(); test<const int*, random_access_iterator<int*> >();
test<const int*, int*>(); test<const int*, int*>();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #if TEST_STD_VER >= 11
X x[3] = {X(1), X(2), X(3)}; X x[3] = {X(1), X(2), X(3)};
Y y[3] = {Y(1), Y(2), Y(3)}; Y y[3] = {Y(1), Y(2), Y(3)};
std::adjacent_difference(x, x+3, y); std::adjacent_difference(x, x+3, y);

View File

@@ -23,6 +23,7 @@
#include <functional> #include <functional>
#include <cassert> #include <cassert>
#include "test_macros.h"
#include "test_iterators.h" #include "test_iterators.h"
template <class InIter, class OutIter> template <class InIter, class OutIter>
@@ -40,7 +41,7 @@ test()
assert(ib[i] == ir[i]); assert(ib[i] == ir[i]);
} }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #if TEST_STD_VER >= 11
class Y; class Y;
@@ -110,7 +111,7 @@ int main()
test<const int*, random_access_iterator<int*> >(); test<const int*, random_access_iterator<int*> >();
test<const int*, int*>(); test<const int*, int*>();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #if TEST_STD_VER >= 11
X x[3] = {X(1), X(2), X(3)}; X x[3] = {X(1), X(2), X(3)};
Y y[3] = {Y(1), Y(2), Y(3)}; Y y[3] = {Y(1), Y(2), Y(3)};
std::adjacent_difference(x, x+3, y, std::minus<X>()); std::adjacent_difference(x, x+3, y, std::minus<X>());

View File

@@ -6,7 +6,8 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
//
// UNSUPPORTED: c++98, c++03
// UNSUPPORTED: libcpp-has-no-threads, libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads, libcpp-no-exceptions
// <future> // <future>
@@ -19,8 +20,6 @@
#include <memory> #include <memory>
#include <cassert> #include <cassert>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
struct A struct A
{ {
A() {} A() {}
@@ -28,11 +27,8 @@ struct A
A(A&&) {throw 9;} A(A&&) {throw 9;}
}; };
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
typedef std::unique_ptr<int> T; typedef std::unique_ptr<int> T;
T i(new int(3)); T i(new int(3));
@@ -65,5 +61,4 @@ int main()
assert(j == 9); assert(j == 9);
} }
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} }

View File

@@ -7,7 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: libcpp-has-no-threads, c++98, c++03
// <future> // <future>
@@ -19,23 +19,17 @@
#include <memory> #include <memory>
#include <cassert> #include <cassert>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
void func(std::promise<std::unique_ptr<int>> p) void func(std::promise<std::unique_ptr<int>> p)
{ {
p.set_value_at_thread_exit(std::unique_ptr<int>(new int(5))); p.set_value_at_thread_exit(std::unique_ptr<int>(new int(5)));
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
std::promise<std::unique_ptr<int>> p; std::promise<std::unique_ptr<int>> p;
std::future<std::unique_ptr<int>> f = p.get_future(); std::future<std::unique_ptr<int>> f = p.get_future();
std::thread(func, std::move(p)).detach(); std::thread(func, std::move(p)).detach();
assert(*f.get() == 5); assert(*f.get() == 5);
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} }

View File

@@ -7,7 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: libcpp-has-no-threads, c++98, c++03
// <future> // <future>
@@ -20,7 +20,6 @@
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
typedef int T; typedef int T;
std::promise<T> p; std::promise<T> p;
@@ -72,5 +71,4 @@ int main()
assert(!f0.valid()); assert(!f0.valid());
assert(!f.valid()); assert(!f.valid());
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} }

View File

@@ -7,7 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: libcpp-has-no-threads, c++98, c++03
// <future> // <future>
@@ -20,7 +20,6 @@
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
typedef int T; typedef int T;
std::promise<T> p; std::promise<T> p;
@@ -66,5 +65,4 @@ int main()
assert(!f0.valid()); assert(!f0.valid());
assert(!f.valid()); assert(!f.valid());
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} }

View File

@@ -7,7 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: libcpp-has-no-threads, c++98, c++03
// <mutex> // <mutex>
@@ -21,7 +21,6 @@
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
typedef std::mutex M; typedef std::mutex M;
M m0; M m0;
@@ -46,5 +45,4 @@ int main()
assert(lk0.mutex() == nullptr); assert(lk0.mutex() == nullptr);
assert(lk0.owns_lock() == false); assert(lk0.owns_lock() == false);
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} }

View File

@@ -7,7 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: libcpp-has-no-threads, c++98, c++03
// <mutex> // <mutex>
@@ -21,7 +21,6 @@
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
typedef std::mutex M; typedef std::mutex M;
M m; M m;
@@ -42,5 +41,4 @@ int main()
assert(lk0.mutex() == nullptr); assert(lk0.mutex() == nullptr);
assert(lk0.owns_lock() == false); assert(lk0.owns_lock() == false);
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} }

View File

@@ -7,7 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: libcpp-has-no-threads, c++98, c++03
// <thread> // <thread>
@@ -44,7 +44,6 @@ bool G::op_run = false;
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
assert(G::n_alive == 0); assert(G::n_alive == 0);
assert(!G::op_run); assert(!G::op_run);
@@ -61,5 +60,4 @@ int main()
assert(G::n_alive == 0); assert(G::n_alive == 0);
assert(G::op_run); assert(G::op_run);
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} }

View File

@@ -7,7 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: libcpp-has-no-threads, c++98, c++03
// <thread> // <thread>
@@ -53,7 +53,6 @@ bool G::op_run = false;
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
G g; G g;
assert(G::n_alive == 1); assert(G::n_alive == 1);
@@ -68,5 +67,4 @@ int main()
assert(G::op_run); assert(G::op_run);
} }
assert(G::n_alive == 0); assert(G::n_alive == 0);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} }