Silence warnings in tests about unused variables and local typedefs.

This commit is contained in:
Andrey Semashev
2017-08-26 20:39:26 +03:00
parent eaf1a48583
commit 2b6b6bf8ad
2 changed files with 8 additions and 1 deletions

View File

@ -25,6 +25,7 @@
# include <boost/static_assert.hpp> # include <boost/static_assert.hpp>
# include <boost/concept_archetype.hpp> // for detail::dummy_constructor # include <boost/concept_archetype.hpp> // for detail::dummy_constructor
# include <boost/implicit_cast.hpp> # include <boost/implicit_cast.hpp>
# include <boost/core/ignore_unused.hpp>
namespace boost { namespace boost {
@ -59,6 +60,7 @@ void trivial_iterator_test(const Iterator i, const Iterator j, T val)
typename std::iterator_traits<Iterator>::value_type v = *i; typename std::iterator_traits<Iterator>::value_type v = *i;
#endif #endif
assert(v == val); assert(v == val);
boost::ignore_unused(v);
#if 0 #if 0
// hmm, this will give a warning for transform_iterator... perhaps // hmm, this will give a warning for transform_iterator... perhaps
// this should be separated out into a stand-alone test since there // this should be separated out into a stand-alone test since there
@ -71,6 +73,7 @@ void trivial_iterator_test(const Iterator i, const Iterator j, T val)
assert(k == i); assert(k == i);
assert(k != j); assert(k != j);
assert(*k == val); assert(*k == val);
boost::ignore_unused(k);
} }
@ -108,6 +111,7 @@ void input_iterator_test(Iterator i, T v1, T v2)
// we cannot test for equivalence of (void)++i & (void)i++ // we cannot test for equivalence of (void)++i & (void)i++
// as i is only guaranteed to be single pass. // as i is only guaranteed to be single pass.
assert(*i++ == v1); assert(*i++ == v1);
boost::ignore_unused(i1);
i1 = i; i1 = i;
@ -116,6 +120,7 @@ void input_iterator_test(Iterator i, T v1, T v2)
assert(*i1 == v2); assert(*i1 == v2);
assert(*i == v2); assert(*i == v2);
boost::ignore_unused(i1);
// i is dereferencable, so it must be incrementable. // i is dereferencable, so it must be incrementable.
++i; ++i;
@ -216,6 +221,7 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals)
int c; int c;
typedef typename std::iterator_traits<Iterator>::value_type value_type; typedef typename std::iterator_traits<Iterator>::value_type value_type;
boost::ignore_unused<value_type>();
for (c = 0; c < N-1; ++c) { for (c = 0; c < N-1; ++c) {
assert(i == j + c); assert(i == j + c);
@ -236,6 +242,7 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals)
assert(*i == vals[N - 1 - c]); assert(*i == vals[N - 1 - c]);
assert(*i == boost::implicit_cast<value_type>(j[N - 1 - c])); assert(*i == boost::implicit_cast<value_type>(j[N - 1 - c]));
Iterator q = k - c; Iterator q = k - c;
boost::ignore_unused(q);
assert(*i == *q); assert(*i == *q);
assert(i > j); assert(i > j);
assert(i >= j); assert(i >= j);
@ -259,6 +266,7 @@ void const_nonconst_iterator_test(Iterator i, ConstIterator j)
k = i; k = i;
assert(k == i); assert(k == i);
assert(i == k); assert(i == k);
boost::ignore_unused(k);
} }
} // namespace iterators } // namespace iterators

View File

@ -153,7 +153,6 @@ template <class CountingIterator, class Value>
void test_aux(CountingIterator start, CountingIterator finish, Value v1) void test_aux(CountingIterator start, CountingIterator finish, Value v1)
{ {
typedef typename CountingIterator::iterator_category category; typedef typename CountingIterator::iterator_category category;
typedef typename CountingIterator::value_type value_type;
// If it's a RandomAccessIterator we can do a few delicate tests // If it's a RandomAccessIterator we can do a few delicate tests
category_test(start, finish, v1, category()); category_test(start, finish, v1, category());