Changed __config to react to all of clang's currently documented has_feature flags, and renamed _LIBCPP_MOVE to _LIBCPP_HAS_NO_RVALUE_REFERENCES to be more consistent with the rest of the libc++'s flags, and with clang's nomenclature.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113086 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2010-09-04 23:28:19 +00:00
parent 04acacadca
commit 73d21a4f07
404 changed files with 1688 additions and 1557 deletions

View File

@@ -18,7 +18,7 @@
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef int T;
std::promise<T> p;
@@ -70,5 +70,5 @@ int main()
assert(!f0.valid());
assert(!f.valid());
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -20,7 +20,7 @@
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
assert(test_alloc_base::count == 0);
{
std::promise<int> p0(std::allocator_arg, test_allocator<int>());
@@ -85,5 +85,5 @@ int main()
assert(test_alloc_base::count == 1);
}
assert(test_alloc_base::count == 0);
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -20,7 +20,7 @@
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
assert(test_alloc_base::count == 0);
{
std::promise<int> p0(std::allocator_arg, test_allocator<int>());
@@ -79,5 +79,5 @@ int main()
assert(test_alloc_base::count == 1);
}
assert(test_alloc_base::count == 0);
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -17,7 +17,7 @@
#include <memory>
#include <cassert>
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
struct A
{
@@ -26,11 +26,11 @@ struct A
A(A&&) {throw 9;}
};
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::unique_ptr<int> T;
T i(new int(3));
@@ -63,5 +63,5 @@ int main()
assert(j == 9);
}
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -17,23 +17,23 @@
#include <memory>
#include <cassert>
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
void func(std::promise<std::unique_ptr<int>>& p)
{
p.set_value_at_thread_exit(std::unique_ptr<int>(new int(5)));
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::promise<std::unique_ptr<int>> p;
std::future<std::unique_ptr<int>> f = p.get_future();
std::thread(func, std::move(p)).detach();
assert(*f.get() == 5);
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef int T;
std::promise<T> p;
@@ -70,5 +70,5 @@ int main()
assert(!f0.valid());
assert(!f.valid());
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef int T;
std::promise<T> p;
@@ -70,5 +70,5 @@ int main()
assert(!f0.valid());
assert(!f.valid());
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef int T;
std::promise<T> p;
@@ -70,5 +70,5 @@ int main()
assert(!f0.valid());
assert(!f.valid());
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef int T;
std::promise<T> p;
@@ -70,5 +70,5 @@ int main()
assert(!f0.valid());
assert(!f.valid());
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef int T;
std::promise<T> p;
@@ -64,5 +64,5 @@ int main()
assert(!f0.valid());
assert(!f.valid());
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -59,10 +59,10 @@ public:
{return UINT_MAX / sizeof(T);}
void construct(pointer p, const T& val)
{::new(p) T(val);}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
void construct(pointer p, T&& val)
{::new(p) T(std::move(val));}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void destroy(pointer p) {p->~T();}
friend bool operator==(const test_allocator& x, const test_allocator& y)

View File

@@ -21,7 +21,7 @@ std::mutex m1;
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::unique_lock<std::mutex> lk0(m0);
std::unique_lock<std::mutex> lk1(m1);
lk1 = std::move(lk0);
@@ -29,5 +29,5 @@ int main()
assert(lk1.owns_lock() == true);
assert(lk0.mutex() == nullptr);
assert(lk0.owns_lock() == false);
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -20,12 +20,12 @@ std::mutex m;
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::unique_lock<std::mutex> lk0(m);
std::unique_lock<std::mutex> lk = std::move(lk0);
assert(lk.mutex() == &m);
assert(lk.owns_lock() == true);
assert(lk0.mutex() == nullptr);
assert(lk0.owns_lock() == false);
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -56,7 +56,7 @@ void f1()
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::set_terminate(f1);
{
assert(G::n_alive == 0);
@@ -78,5 +78,5 @@ int main()
t0 = std::move(t1);
assert(false);
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -51,7 +51,7 @@ bool G::op_run = false;
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
assert(G::n_alive == 0);
assert(!G::op_run);
@@ -64,5 +64,5 @@ int main()
assert(G::n_alive == 0);
assert(G::op_run);
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}