Fix some test warnings.

And turn on warnings as errors in Travis.
This commit is contained in:
Daniel James
2016-08-17 12:08:16 +01:00
parent cae72eec2f
commit 9debeadee7
11 changed files with 21 additions and 21 deletions

View File

@ -27,10 +27,10 @@ matrix:
before_script: before_script:
- | - |
echo "using gcc : : g++-4.8 --std=c++03 -fsanitize=address ;" > ~/user-config.jam echo "using gcc : : g++-4.8 -Werror --std=c++03 -fsanitize=address ;" > ~/user-config.jam
echo "using gcc : std11 : g++-4.8 --std=c++11 -fsanitize=address ;" >> ~/user-config.jam echo "using gcc : std11 : g++-4.8 -Werror --std=c++11 -fsanitize=address ;" >> ~/user-config.jam
echo "using clang : : clang++ --std=c++03 -fsanitize=address ;" >> ~/user-config.jam echo "using clang : : clang++ -Werror --std=c++03 -fsanitize=address ;" >> ~/user-config.jam
echo "using clang : std11 : clang++ --std=c++11 -fsanitize=address ;" >> ~/user-config.jam echo "using clang : std11 : clang++ -Werror --std=c++11 -fsanitize=address ;" >> ~/user-config.jam
- cat ~/user-config.jam - cat ~/user-config.jam
- touch Jamroot.jam - touch Jamroot.jam

View File

@ -13,6 +13,7 @@ project unordered-test/unordered
# Boost.Preprocessor on trunk. # Boost.Preprocessor on trunk.
<toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow -Wno-long-long" <toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow -Wno-long-long"
<toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow" <toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow"
<toolset>clang:<cxxflags>"-pedantic -Wextra -Wno-long-long"
; ;
#alias framework : /boost/test//boost_unit_test_framework ; #alias framework : /boost/test//boost_unit_test_framework ;

View File

@ -18,8 +18,8 @@ struct rehash_test_base : public test::exception_base
{ {
test::random_values<T> values; test::random_values<T> values;
unsigned int n; unsigned int n;
rehash_test_base(unsigned int count = 100, unsigned int n = 0) rehash_test_base(unsigned int count = 100, unsigned int n_ = 0)
: values(count), n(n) : values(count), n(n_)
{} {}
typedef T data_type; typedef T data_type;

View File

@ -66,8 +66,8 @@ struct swap_base : public test::exception_base
{} {}
struct data_type { struct data_type {
data_type(T const& x, T const& y) data_type(T const& x_, T const& y_)
: x(x), y(y) {} : x(x_), y(y_) {}
T x, y; T x, y;
}; };

View File

@ -148,7 +148,7 @@ namespace test
return ptr; return ptr;
} }
pointer allocate(size_type n, void const* u) pointer allocate(size_type n, void const*)
{ {
pointer ptr(static_cast<T*>(::operator new(n * sizeof(T)))); pointer ptr(static_cast<T*>(::operator new(n * sizeof(T))));
detail::tracker.track_allocate((void*) ptr, n, sizeof(T), tag_); detail::tracker.track_allocate((void*) ptr, n, sizeof(T), tag_);

View File

@ -314,7 +314,7 @@ namespace exception
//return pointer(static_cast<T*>(::operator new(n * sizeof(T)))); //return pointer(static_cast<T*>(::operator new(n * sizeof(T))));
} }
pointer allocate(size_type n, void const* u) pointer allocate(size_type n, void const*)
{ {
T* ptr = 0; T* ptr = 0;
UNORDERED_SCOPE(allocator::allocate(size_type, const_pointer)) { UNORDERED_SCOPE(allocator::allocate(size_type, const_pointer)) {
@ -494,7 +494,7 @@ namespace exception
//return pointer(static_cast<T*>(::operator new(n * sizeof(T)))); //return pointer(static_cast<T*>(::operator new(n * sizeof(T))));
} }
pointer allocate(size_type n, void const* u) pointer allocate(size_type n, void const*)
{ {
T* ptr = 0; T* ptr = 0;
UNORDERED_SCOPE(allocator2::allocate(size_type, const_pointer)) { UNORDERED_SCOPE(allocator2::allocate(size_type, const_pointer)) {

View File

@ -386,7 +386,7 @@ namespace minimal
} }
template <class Y> template <class Y>
pointer allocate(size_type n, const_ptr<Y> u) pointer allocate(size_type n, const_ptr<Y>)
{ {
return pointer(static_cast<T*>(::operator new(n * sizeof(T)))); return pointer(static_cast<T*>(::operator new(n * sizeof(T))));
} }
@ -462,7 +462,7 @@ namespace minimal
} }
template <class Y> template <class Y>
T* allocate(std::size_t n, const_ptr<Y> u) { T* allocate(std::size_t n, const_ptr<Y>) {
return static_cast<T*>(::operator new(n * sizeof(T))); return static_cast<T*>(::operator new(n * sizeof(T)));
} }

View File

@ -347,7 +347,7 @@ namespace test
return ptr; return ptr;
} }
T* allocate(std::size_t n, void const* u) T* allocate(std::size_t n, void const*)
{ {
T* ptr(static_cast<T*>(::operator new(n * sizeof(T)))); T* ptr(static_cast<T*>(::operator new(n * sizeof(T))));
detail::tracker.track_allocate((void*) ptr, n, sizeof(T), tag_); detail::tracker.track_allocate((void*) ptr, n, sizeof(T), tag_);
@ -573,7 +573,7 @@ namespace test
return p; return p;
} }
pointer allocate(size_type n, void const* u) pointer allocate(size_type n, void const*)
{ {
pointer ptr(static_cast<T*>(::operator new(n * sizeof(T)))); pointer ptr(static_cast<T*>(::operator new(n * sizeof(T))));
detail::tracker.track_allocate((void*) ptr, n, sizeof(T), tag_); detail::tracker.track_allocate((void*) ptr, n, sizeof(T), tag_);

View File

@ -22,9 +22,9 @@
T const* address(T const& r) { return &r; } \ T const* address(T const& r) { return &r; } \
T* allocate(std::size_t n) \ T* allocate(std::size_t n) \
{ return static_cast<T*>(::operator new(n * sizeof(T))); } \ { return static_cast<T*>(::operator new(n * sizeof(T))); } \
T* allocate(std::size_t n, void const* u) \ T* allocate(std::size_t n, void const*) \
{ return static_cast<T*>(::operator new(n * sizeof(T))); } \ { return static_cast<T*>(::operator new(n * sizeof(T))); } \
void deallocate(T* p, std::size_t n) { ::operator delete((void*) p); } \ void deallocate(T* p, std::size_t) { ::operator delete((void*) p); } \
void construct(T* p, T const& t) { new(p) T(t); } \ void construct(T* p, T const& t) { new(p) T(t); } \
void destroy(T* p) { p->~T(); } \ void destroy(T* p) { p->~T(); } \
std::size_t max_size() const \ std::size_t max_size() const \
@ -44,9 +44,9 @@
const_pointer address(T const& r) { return &r; } \ const_pointer address(T const& r) { return &r; } \
pointer allocate(std::size_t n) \ pointer allocate(std::size_t n) \
{ return pointer(::operator new(n * sizeof(T))); } \ { return pointer(::operator new(n * sizeof(T))); } \
pointer allocate(std::size_t n, void const* u) \ pointer allocate(std::size_t n, void const*) \
{ return pointer(::operator new(n * sizeof(T))); } \ { return pointer(::operator new(n * sizeof(T))); } \
void deallocate(pointer p, std::size_t n) \ void deallocate(pointer p, std::size_t) \
{ ::operator delete((void*) p); } \ { ::operator delete((void*) p); } \
void construct(T* p, T const& t) { new(p) T(t); } \ void construct(T* p, T const& t) { new(p) T(t); } \
void destroy(T* p) { p->~T(); } \ void destroy(T* p) { p->~T(); } \

View File

@ -16,7 +16,6 @@ UNORDERED_AUTO_TEST(at_tests) {
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Create Map" << std::endl; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Create Map" << std::endl;
boost::unordered_map<std::string, int> x; boost::unordered_map<std::string, int> x;
typedef boost::unordered_map<std::string, int>::iterator iterator;
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Add elements" << std::endl; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Add elements" << std::endl;

View File

@ -18,7 +18,7 @@ struct SimpleAllocator
{ {
} }
template <class T> SimpleAllocator(const SimpleAllocator<T>& other) template <class T> SimpleAllocator(const SimpleAllocator<T>&)
{ {
} }