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
{
std::string s = {'a', 'b', 'c'};
assert(s == "abc");
@@ -28,5 +28,5 @@ int main()
s = {L'a', L'b', L'c'};
assert(s == L"abc");
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,11 +16,11 @@
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::string s;
s = {'a', 'b', 'c'};
assert(s == "abc");
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -14,7 +14,7 @@
#include <string>
#include <cassert>
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include "../test_allocator.h"
@@ -31,15 +31,15 @@ test(S s0)
assert(s2.get_allocator() == s1.get_allocator());
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef test_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
test(S(A(3)));
test(S("1", A(5)));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)));
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -14,7 +14,7 @@
#include <string>
#include <cassert>
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include "../test_allocator.h"
@@ -31,15 +31,15 @@ test(S s0, const typename S::allocator_type& a)
assert(s2.get_allocator() == a);
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef test_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
test(S(), A(3));
test(S("1"), A(5));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), A(7));
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -15,7 +15,7 @@
#include <string>
#include <cassert>
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include "../test_allocator.h"
@@ -31,11 +31,11 @@ test(S s1, S s2)
assert(s1.capacity() >= s1.size());
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::string S;
test(S(), S());
test(S("1"), S());
@@ -52,5 +52,5 @@ int main()
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"
"1234567890123456789012345678901234567890123456789012345678901234567890"),
S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,11 +16,11 @@
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::string s("123");
s.append({'a', 'b', 'c'});
assert(s == "123abc");
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,11 +16,11 @@
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::string s("123");
s.assign({'a', 'b', 'c'});
assert(s == "abc");
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,12 +16,12 @@
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::string s("123456");
std::string::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'});
assert(i - s.begin() == 3);
assert(s == "123abc456");
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,11 +16,11 @@
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::string s("123");
s += {'a', 'b', 'c'};
assert(s == "123abc");
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,11 +16,11 @@
int main()
{
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::string s("123def456");
s.replace(s.begin() + 3, s.begin() + 6, {'a', 'b', 'c'});
assert(s == "123abc456");
}
#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
{
std::string s("initial text");
getline(std::istringstream(" abc* def* ghij"), s, '*');
@@ -31,5 +31,5 @@ int main()
getline(std::wistringstream(L" abc* def* ghij"), s, L'*');
assert(s == L" abc");
}
#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
{
std::string s("initial text");
getline(std::istringstream(" abc\n def\n ghij"), s);
@@ -31,5 +31,5 @@ int main()
getline(std::wistringstream(L" abc\n def\n ghij"), s);
assert(s == L" abc");
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -27,7 +27,7 @@ test0(typename S::value_type lhs, const S& rhs, const S& x)
assert(lhs + rhs == x);
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class S>
void
@@ -36,7 +36,7 @@ test1(typename S::value_type lhs, S&& rhs, const S& x)
assert(lhs + move(rhs) == x);
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::string S;
@@ -47,12 +47,12 @@ int main()
test0('a', S("1234567890"), S("a1234567890"));
test0('a', S("12345678901234567890"), S("a12345678901234567890"));
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test1('a', S(""), S("a"));
test1('a', S("12345"), S("a12345"));
test1('a', S("1234567890"), S("a1234567890"));
test1('a', S("12345678901234567890"), S("a12345678901234567890"));
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -27,7 +27,7 @@ test0(const typename S::value_type* lhs, const S& rhs, const S& x)
assert(lhs + rhs == x);
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class S>
void
@@ -36,7 +36,7 @@ test1(const typename S::value_type* lhs, S&& rhs, const S& x)
assert(lhs + move(rhs) == x);
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::string S;
@@ -59,7 +59,7 @@ int main()
test0("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
test0("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test1("", S(""), S(""));
test1("", S("12345"), S("12345"));
@@ -78,5 +78,5 @@ int main()
test1("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
test1("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -27,7 +27,7 @@ test0(const S& lhs, typename S::value_type rhs, const S& x)
assert(lhs + rhs == x);
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class S>
void
@@ -36,7 +36,7 @@ test1(S&& lhs, typename S::value_type rhs, const S& x)
assert(move(lhs) + rhs == x);
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::string S;
@@ -47,12 +47,12 @@ int main()
test0(S("abcdefghij"), '1', S("abcdefghij1"));
test0(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1"));
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test1(S(""), '1', S("1"));
test1(S("abcde"), '1', S("abcde1"));
test1(S("abcdefghij"), '1', S("abcdefghij1"));
test1(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1"));
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -27,7 +27,7 @@ test0(const S& lhs, const typename S::value_type* rhs, const S& x)
assert(lhs + rhs == x);
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class S>
void
@@ -36,7 +36,7 @@ test1(S&& lhs, const typename S::value_type* rhs, const S& x)
assert(move(lhs) + rhs == x);
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::string S;
@@ -59,7 +59,7 @@ int main()
test0(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890"));
test0(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890"));
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test1(S(""), "", S(""));
test1(S(""), "12345", S("12345"));
@@ -78,5 +78,5 @@ int main()
test1(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890"));
test1(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890"));
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -39,7 +39,7 @@ test0(const S& lhs, const S& rhs, const S& x)
assert(lhs + rhs == x);
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class S>
void
@@ -62,7 +62,7 @@ test3(S&& lhs, S&& rhs, const S& x)
assert(move(lhs) + move(rhs) == x);
}
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::string S;
@@ -85,7 +85,7 @@ int main()
test0(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test1(S(""), S(""), S(""));
test1(S(""), S("12345"), S("12345"));
@@ -138,5 +138,5 @@ int main()
test3(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
#endif // _LIBCPP_MOVE
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}