From 5e4978b8707e977db9f797c238f8eee26e73829c Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Wed, 21 Jan 2015 01:13:19 +0900 Subject: [PATCH] Fix some warnings within tests. --- test/algorithm/pop_back.cpp | 2 +- test/functional/invoke.cpp | 34 +++++++++++++++++++++------- test/functional/invoke_procedure.cpp | 17 ++++++++++---- test/sequence/adapt_struct.cpp | 2 +- test/sequence/move.hpp | 4 ++-- 5 files changed, 43 insertions(+), 16 deletions(-) diff --git a/test/algorithm/pop_back.cpp b/test/algorithm/pop_back.cpp index e374152f..b594f6c8 100644 --- a/test/algorithm/pop_back.cpp +++ b/test/algorithm/pop_back.cpp @@ -95,7 +95,7 @@ main() #endif { - boost::array a = { 10, 50 }; + boost::array a = {{ 10, 50 }}; BOOST_TEST(back(pop_back(a)) == 10); } diff --git a/test/functional/invoke.cpp b/test/functional/invoke.cpp index 67e65feb..fa93332c 100644 --- a/test/functional/invoke.cpp +++ b/test/functional/invoke.cpp @@ -7,6 +7,7 @@ http://www.boost.org/LICENSE_1_0.txt). ==============================================================================*/ +#include #include #include @@ -146,11 +147,28 @@ class members int binary_c(int i, object) const { return data + 6 + i; } }; +#ifdef BOOST_NO_CXX11_SMART_PTR +typedef std::auto_ptr members_ptr; +typedef std::auto_ptr const_members_ptr; +#else +typedef std::unique_ptr members_ptr; +typedef std::unique_ptr const_members_ptr; +#endif + struct derived : members { }; +#ifdef BOOST_NO_CXX11_SMART_PTR +typedef std::auto_ptr derived_ptr; +typedef std::auto_ptr const_derived_ptr; +#else +typedef std::unique_ptr derived_ptr; +typedef std::unique_ptr const_derived_ptr; +#endif + + typedef int element1_type; typedef object element2_type; typedef object_nc & element3_type; @@ -161,8 +179,8 @@ object_nc element3; members that; -std::auto_ptr spt_that(new members); -std::auto_ptr spt_that_c(new members); +members_ptr spt_that(new members); +const_members_ptr spt_that_c(new members); fusion::single_view sv_obj_ctx( that); fusion::single_view sv_ref_ctx( that); @@ -170,13 +188,13 @@ fusion::single_view sv_ptr_ctx(& that); fusion::single_view sv_obj_c_ctx( that); fusion::single_view sv_ref_c_ctx( that); fusion::single_view sv_ptr_c_ctx(& that); -fusion::single_view const &> sv_spt_ctx(spt_that); -fusion::single_view< std::auto_ptr const &> sv_spt_c_ctx(spt_that_c); +fusion::single_view sv_spt_ctx(spt_that); +fusion::single_view sv_spt_c_ctx(spt_that_c); derived derived_that; -std::auto_ptr spt_derived_that(new derived); -std::auto_ptr spt_derived_that_c(new derived); +derived_ptr spt_derived_that(new derived); +const_derived_ptr spt_derived_that_c(new derived); fusion::single_view sv_obj_d_ctx( derived_that); fusion::single_view sv_ref_d_ctx( derived_that); @@ -184,8 +202,8 @@ fusion::single_view sv_ptr_d_ctx(& derived_that); fusion::single_view sv_obj_c_d_ctx( derived_that); fusion::single_view sv_ref_c_d_ctx( derived_that); fusion::single_view sv_ptr_c_d_ctx(& derived_that); -fusion::single_view const &> sv_spt_d_ctx(spt_derived_that); -fusion::single_view< std::auto_ptr const &> sv_spt_c_d_ctx(spt_derived_that_c); +fusion::single_view sv_spt_d_ctx(spt_derived_that); +fusion::single_view sv_spt_c_d_ctx(spt_derived_that_c); template void test_sequence_n(Sequence & seq, mpl::int_<0>) diff --git a/test/functional/invoke_procedure.cpp b/test/functional/invoke_procedure.cpp index 49c35d37..2ee8354d 100644 --- a/test/functional/invoke_procedure.cpp +++ b/test/functional/invoke_procedure.cpp @@ -7,6 +7,7 @@ http://www.boost.org/LICENSE_1_0.txt). ==============================================================================*/ +#include #include #include @@ -65,9 +66,17 @@ class members int binary_c(int & i, object) const { return i = data + 6; } }; +#ifdef BOOST_NO_CXX11_SMART_PTR +typedef std::auto_ptr members_ptr; +typedef std::auto_ptr const_members_ptr; +#else +typedef std::unique_ptr members_ptr; +typedef std::unique_ptr const_members_ptr; +#endif + members that; -std::auto_ptr spt_that(new members); -std::auto_ptr spt_that_c(new members); +members_ptr spt_that(new members); +const_members_ptr spt_that_c(new members); fusion::single_view sv_obj_ctx( that); fusion::single_view sv_ref_ctx( that); @@ -75,8 +84,8 @@ fusion::single_view sv_ptr_ctx(& that); fusion::single_view sv_obj_c_ctx( that); fusion::single_view sv_ref_c_ctx( that); fusion::single_view sv_ptr_c_ctx(& that); -fusion::single_view const &> sv_spt_ctx(spt_that); -fusion::single_view< std::auto_ptr const &> sv_spt_c_ctx(spt_that_c); +fusion::single_view sv_spt_ctx(spt_that); +fusion::single_view sv_spt_c_ctx(spt_that_c); struct fobj { diff --git a/test/sequence/adapt_struct.cpp b/test/sequence/adapt_struct.cpp index e64507cf..012e8e14 100644 --- a/test/sequence/adapt_struct.cpp +++ b/test/sequence/adapt_struct.cpp @@ -178,7 +178,7 @@ main() { fusion::vector v1(4, 2); - ns::bar v2 = {5, 3}; + ns::bar v2 = {{5}, 3}; BOOST_TEST(v1 < v2); BOOST_TEST(v1 <= v2); BOOST_TEST(v2 > v1); diff --git a/test/sequence/move.hpp b/test/sequence/move.hpp index febbc2bb..8636604f 100644 --- a/test/sequence/move.hpp +++ b/test/sequence/move.hpp @@ -38,12 +38,12 @@ namespace test_detail return *this; } - x(x const& rhs) + x(x const& /*rhs*/) { incr_copy(); } - x& operator=(x const& rhs) + x& operator=(x const& /*rhs*/) { incr_copy(); return *this;