Fix warnings in deque tests

llvm-svn: 242632
This commit is contained in:
Eric Fiselier 2015-07-19 00:31:54 +00:00
parent 6aa873b392
commit c45b673d5d
11 changed files with 24 additions and 62 deletions

View File

@ -2029,7 +2029,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
if (__n > __front_spare())
__add_front_capacity(__n - __front_spare());
// __n <= __front_spare()
size_type __old_n = __n;
iterator __old_begin = __base::begin();
iterator __i = __old_begin;
if (__n > __pos)
@ -2054,7 +2053,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
if (__n > __back_capacity)
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
size_type __old_n = __n;
iterator __old_end = __base::end();
iterator __i = __old_end;
size_type __de = __base::size() - __pos;
@ -2119,7 +2117,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
if (__n > __front_spare())
__add_front_capacity(__n - __front_spare());
// __n <= __front_spare()
size_type __old_n = __n;
iterator __old_begin = __base::begin();
iterator __i = __old_begin;
_BiIter __m = __f;
@ -2150,7 +2147,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
if (__n > __back_capacity)
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
size_type __old_n = __n;
iterator __old_end = __base::end();
iterator __i = __old_end;
_BiIter __m = __l;
@ -2685,7 +2681,6 @@ template <class _Tp, class _Allocator>
typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::erase(const_iterator __f)
{
difference_type __n = 1;
iterator __b = __base::begin();
difference_type __pos = __f - __b;
iterator __p = __b + __pos;

View File

@ -14,6 +14,7 @@
#include <deque>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@ -58,7 +59,6 @@ template <class C>
void
testN(int start, int N, int M)
{
typedef typename C::const_iterator CI;
C c1 = make<C>(N, start);
test(c1, M);
}
@ -73,7 +73,7 @@ int main()
for (int k = 0; k < N; ++k)
testN<std::deque<int> >(rng[i], rng[j], rng[k]);
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);

View File

@ -14,6 +14,7 @@
#include <deque>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@ -58,7 +59,6 @@ template <class C>
void
testN(int start, int N, int M)
{
typedef typename C::const_iterator CI;
C c1 = make<C>(N, start);
test(c1, M, -10);
}
@ -73,7 +73,7 @@ int main()
for (int k = 0; k < N; ++k)
testN<std::deque<int> >(rng[i], rng[j], rng[k]);
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);

View File

@ -14,6 +14,7 @@
#include <deque>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@ -51,7 +52,6 @@ template <class C>
void
testN(int start, int N)
{
typedef typename C::const_iterator CI;
C c1 = make<C>(N, start);
test(c1);
}
@ -65,7 +65,7 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<int> >(rng[i], rng[j]);
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);

View File

@ -15,6 +15,7 @@
#include <deque>
#include <cassert>
#include "test_macros.h"
#include "test_iterators.h"
#include "min_allocator.h"
@ -44,7 +45,6 @@ template <class C>
void
test(C& c1, const C& c2)
{
std::size_t c1_osize = c1.size();
c1.assign(c2.begin(), c2.end());
assert(distance(c1.begin(), c1.end()) == c1.size());
assert(c1 == c2);
@ -54,8 +54,6 @@ template <class C>
void
testN(int start, int N, int M)
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
C c1 = make<C>(N, start);
C c2 = make<C>(M);
test(c1, c2);
@ -67,7 +65,6 @@ testI(C& c1, const C& c2)
{
typedef typename C::const_iterator CI;
typedef input_iterator<CI> ICI;
std::size_t c1_osize = c1.size();
c1.assign(ICI(c2.begin()), ICI(c2.end()));
assert(distance(c1.begin(), c1.end()) == c1.size());
assert(c1 == c2);
@ -77,8 +74,6 @@ template <class C>
void
testNI(int start, int N, int M)
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
C c1 = make<C>(N, start);
C c2 = make<C>(M);
testI(c1, c2);
@ -95,7 +90,7 @@ int main()
testN<std::deque<int> >(rng[i], rng[j], rng[k]);
testNI<std::deque<int> >(1500, 2000, 1000);
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);

View File

@ -14,6 +14,7 @@
#include <deque>
#include <cassert>
#include "test_macros.h"
#include "test_iterators.h"
#include "min_allocator.h"
@ -44,7 +45,6 @@ void
test(C& c1, int size, int v)
{
typedef typename C::const_iterator CI;
std::size_t c1_osize = c1.size();
c1.assign(size, v);
assert(c1.size() == size);
assert(distance(c1.begin(), c1.end()) == c1.size());
@ -56,8 +56,6 @@ template <class C>
void
testN(int start, int N, int M)
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
C c1 = make<C>(N, start);
test(c1, M, -10);
}
@ -72,7 +70,7 @@ int main()
for (int k = 0; k < N; ++k)
testN<std::deque<int> >(rng[i], rng[j], rng[k]);
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);

View File

@ -11,13 +11,14 @@
// template <class... Args> iterator emplace(const_iterator p, Args&&... args);
// UNSUPPORTED: c++98, c++03
#include <deque>
#include <cassert>
#include "../../../Emplaceable.h"
#include "min_allocator.h"
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class C>
C
@ -45,7 +46,6 @@ template <class C>
void
test(int P, C& c1)
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
std::size_t c1_osize = c1.size();
CI i = c1.emplace(c1.begin() + P, Emplaceable(1, 2.5));
@ -59,8 +59,6 @@ template <class C>
void
testN(int start, int N)
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
@ -87,11 +85,9 @@ testN(int start, int N)
}
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
@ -99,7 +95,6 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<Emplaceable> >(rng[i], rng[j]);
}
#if __cplusplus >= 201103L
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
@ -107,6 +102,4 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -17,6 +17,7 @@
#include <deque>
#include <cassert>
#include "test_macros.h"
#include "test_iterators.h"
#include "MoveOnly.h"
#include "../../../stack_allocator.h"
@ -49,7 +50,6 @@ void
test(int P, const C& c0, const C& c2)
{
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
typedef input_iterator<CI> BCI;
C c1 = c0;
@ -67,7 +67,6 @@ test(int P, const C& c0, const C& c2)
assert(*i == j);
}
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
typedef forward_iterator<CI> BCI;
C c1 = c0;
@ -85,7 +84,6 @@ test(int P, const C& c0, const C& c2)
assert(*i == j);
}
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
typedef bidirectional_iterator<CI> BCI;
C c1 = c0;
@ -108,8 +106,6 @@ template <class C>
void
testN(int start, int N, int M)
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
@ -170,7 +166,6 @@ template <class C>
void
testI(int P, C& c1, const C& c2)
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
typedef input_iterator<CI> ICI;
std::size_t c1_osize = c1.size();
@ -191,8 +186,6 @@ template <class C>
void
testNI(int start, int N, int M)
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
@ -244,7 +237,7 @@ template <class C>
void
test_move()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
C c;
typedef typename C::const_iterator CI;
{
@ -263,7 +256,7 @@ test_move()
j = 0;
for (CI i = c.begin(); i != c.end(); ++i, ++j)
assert(*i == MoveOnly(j));
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
}
int main()
@ -276,11 +269,11 @@ int main()
for (int k = 0; k < N; ++k)
testN<std::deque<int> >(rng[i], rng[j], rng[k]);
testNI<std::deque<int> >(1500, 2000, 1000);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
test_move<std::deque<MoveOnly, stack_allocator<MoveOnly, 2000> > >();
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);

View File

@ -11,13 +11,14 @@
// iterator insert (const_iterator p, value_type&& v);
// UNSUPPORTED: c++98, c++03
#include <deque>
#include <cassert>
#include "MoveOnly.h"
#include "min_allocator.h"
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class C>
C
@ -45,7 +46,6 @@ template <class C>
void
test(int P, C& c1, int x)
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
std::size_t c1_osize = c1.size();
CI i = c1.insert(c1.begin() + P, MoveOnly(x));
@ -65,8 +65,6 @@ template <class C>
void
testN(int start, int N)
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
@ -93,11 +91,8 @@ testN(int start, int N)
}
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
@ -105,7 +100,6 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<MoveOnly> >(rng[i], rng[j]);
}
#if __cplusplus >= 201103L
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
@ -113,6 +107,4 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<MoveOnly, min_allocator<MoveOnly>> >(rng[i], rng[j]);
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -16,6 +16,7 @@
#include <deque>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@ -44,7 +45,6 @@ template <class C>
void
test(int P, C& c1, int size, int x)
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
std::size_t c1_osize = c1.size();
CI i = c1.insert(c1.begin() + P, size, x);
@ -64,8 +64,6 @@ template <class C>
void
testN(int start, int N, int M)
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
@ -145,7 +143,7 @@ int main()
testN<std::deque<int> >(rng[i], rng[j], rng[k]);
self_reference_test<std::deque<int> >();
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);

View File

@ -14,6 +14,7 @@
#include <deque>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@ -42,7 +43,6 @@ template <class C>
void
test(int P, C& c1, int x)
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
std::size_t c1_osize = c1.size();
CI i = c1.insert(c1.begin() + P, x);
@ -62,8 +62,6 @@ template <class C>
void
testN(int start, int N)
{
typedef typename C::iterator I;
typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
@ -126,7 +124,7 @@ int main()
testN<std::deque<int> >(rng[i], rng[j]);
self_reference_test<std::deque<int> >();
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);