From 9debeadee7c430c02a0f39946114af59eab350e8 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 17 Aug 2016 12:08:16 +0100 Subject: [PATCH] Fix some test warnings. And turn on warnings as errors in Travis. --- .travis.yml | 8 ++++---- test/Jamfile.v2 | 1 + test/exception/rehash_exception_tests.cpp | 4 ++-- test/exception/swap_exception_tests.cpp | 4 ++-- test/objects/cxx11_allocator.hpp | 2 +- test/objects/exception.hpp | 4 ++-- test/objects/minimal.hpp | 4 ++-- test/objects/test.hpp | 4 ++-- test/unordered/allocator_traits.cpp | 8 ++++---- test/unordered/at_tests.cpp | 1 - test/unordered/minimal_allocator.cpp | 2 +- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6f98b329..e6c0c766 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,10 +27,10 @@ matrix: before_script: - | - echo "using gcc : : g++-4.8 --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 clang : : clang++ --std=c++03 -fsanitize=address ;" >> ~/user-config.jam - echo "using clang : std11 : clang++ --std=c++11 -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 -Werror --std=c++11 -fsanitize=address ;" >> ~/user-config.jam + echo "using clang : : clang++ -Werror --std=c++03 -fsanitize=address ;" >> ~/user-config.jam + echo "using clang : std11 : clang++ -Werror --std=c++11 -fsanitize=address ;" >> ~/user-config.jam - cat ~/user-config.jam - touch Jamroot.jam diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index cef0f17e..b6a362dc 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -13,6 +13,7 @@ project unordered-test/unordered # Boost.Preprocessor on trunk. gcc:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow -Wno-long-long" darwin:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow" + clang:"-pedantic -Wextra -Wno-long-long" ; #alias framework : /boost/test//boost_unit_test_framework ; diff --git a/test/exception/rehash_exception_tests.cpp b/test/exception/rehash_exception_tests.cpp index ad5c6193..0163bfec 100644 --- a/test/exception/rehash_exception_tests.cpp +++ b/test/exception/rehash_exception_tests.cpp @@ -18,8 +18,8 @@ struct rehash_test_base : public test::exception_base { test::random_values values; unsigned int n; - rehash_test_base(unsigned int count = 100, unsigned int n = 0) - : values(count), n(n) + rehash_test_base(unsigned int count = 100, unsigned int n_ = 0) + : values(count), n(n_) {} typedef T data_type; diff --git a/test/exception/swap_exception_tests.cpp b/test/exception/swap_exception_tests.cpp index 623a0fce..5e1cd084 100644 --- a/test/exception/swap_exception_tests.cpp +++ b/test/exception/swap_exception_tests.cpp @@ -66,8 +66,8 @@ struct swap_base : public test::exception_base {} struct data_type { - data_type(T const& x, T const& y) - : x(x), y(y) {} + data_type(T const& x_, T const& y_) + : x(x_), y(y_) {} T x, y; }; diff --git a/test/objects/cxx11_allocator.hpp b/test/objects/cxx11_allocator.hpp index 8b4e8db9..11f67808 100644 --- a/test/objects/cxx11_allocator.hpp +++ b/test/objects/cxx11_allocator.hpp @@ -148,7 +148,7 @@ namespace test return ptr; } - pointer allocate(size_type n, void const* u) + pointer allocate(size_type n, void const*) { pointer ptr(static_cast(::operator new(n * sizeof(T)))); detail::tracker.track_allocate((void*) ptr, n, sizeof(T), tag_); diff --git a/test/objects/exception.hpp b/test/objects/exception.hpp index 28d4d5b4..034f31b2 100644 --- a/test/objects/exception.hpp +++ b/test/objects/exception.hpp @@ -314,7 +314,7 @@ namespace exception //return pointer(static_cast(::operator new(n * sizeof(T)))); } - pointer allocate(size_type n, void const* u) + pointer allocate(size_type n, void const*) { T* ptr = 0; UNORDERED_SCOPE(allocator::allocate(size_type, const_pointer)) { @@ -494,7 +494,7 @@ namespace exception //return pointer(static_cast(::operator new(n * sizeof(T)))); } - pointer allocate(size_type n, void const* u) + pointer allocate(size_type n, void const*) { T* ptr = 0; UNORDERED_SCOPE(allocator2::allocate(size_type, const_pointer)) { diff --git a/test/objects/minimal.hpp b/test/objects/minimal.hpp index 85132aa3..b876aa20 100644 --- a/test/objects/minimal.hpp +++ b/test/objects/minimal.hpp @@ -386,7 +386,7 @@ namespace minimal } template - pointer allocate(size_type n, const_ptr u) + pointer allocate(size_type n, const_ptr) { return pointer(static_cast(::operator new(n * sizeof(T)))); } @@ -462,7 +462,7 @@ namespace minimal } template - T* allocate(std::size_t n, const_ptr u) { + T* allocate(std::size_t n, const_ptr) { return static_cast(::operator new(n * sizeof(T))); } diff --git a/test/objects/test.hpp b/test/objects/test.hpp index 1c2a24ab..f6b03db7 100644 --- a/test/objects/test.hpp +++ b/test/objects/test.hpp @@ -347,7 +347,7 @@ namespace test return ptr; } - T* allocate(std::size_t n, void const* u) + T* allocate(std::size_t n, void const*) { T* ptr(static_cast(::operator new(n * sizeof(T)))); detail::tracker.track_allocate((void*) ptr, n, sizeof(T), tag_); @@ -573,7 +573,7 @@ namespace test return p; } - pointer allocate(size_type n, void const* u) + pointer allocate(size_type n, void const*) { pointer ptr(static_cast(::operator new(n * sizeof(T)))); detail::tracker.track_allocate((void*) ptr, n, sizeof(T), tag_); diff --git a/test/unordered/allocator_traits.cpp b/test/unordered/allocator_traits.cpp index 264c70d0..4f4fe797 100644 --- a/test/unordered/allocator_traits.cpp +++ b/test/unordered/allocator_traits.cpp @@ -22,9 +22,9 @@ T const* address(T const& r) { return &r; } \ T* allocate(std::size_t n) \ { return static_cast(::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(::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 destroy(T* p) { p->~T(); } \ std::size_t max_size() const \ @@ -44,9 +44,9 @@ const_pointer address(T const& r) { return &r; } \ pointer allocate(std::size_t n) \ { 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))); } \ - void deallocate(pointer p, std::size_t n) \ + void deallocate(pointer p, std::size_t) \ { ::operator delete((void*) p); } \ void construct(T* p, T const& t) { new(p) T(t); } \ void destroy(T* p) { p->~T(); } \ diff --git a/test/unordered/at_tests.cpp b/test/unordered/at_tests.cpp index cd272679..8899efcb 100644 --- a/test/unordered/at_tests.cpp +++ b/test/unordered/at_tests.cpp @@ -16,7 +16,6 @@ UNORDERED_AUTO_TEST(at_tests) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Create Map" << std::endl; boost::unordered_map x; - typedef boost::unordered_map::iterator iterator; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Add elements" << std::endl; diff --git a/test/unordered/minimal_allocator.cpp b/test/unordered/minimal_allocator.cpp index 26d1323a..85e99e61 100644 --- a/test/unordered/minimal_allocator.cpp +++ b/test/unordered/minimal_allocator.cpp @@ -18,7 +18,7 @@ struct SimpleAllocator { } - template SimpleAllocator(const SimpleAllocator& other) + template SimpleAllocator(const SimpleAllocator&) { }