From f0c99f7b7f1bae6e18508b31b4ca54b9fb66c2c0 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 10 Jun 2014 18:22:10 +0100 Subject: [PATCH] Suppress more GCC warnings. Fix GCC compile failure in lambda test case. --- test/boost_has_part_alloc.ipp | 15 +++++++++------ test/boost_no_cxx11_hdr_atomic.ipp | 1 + test/boost_no_fenv_h.ipp | 4 ++-- test/boost_no_inline_memb_init.ipp | 11 +++++++++-- test/boost_no_lambdas.ipp | 7 ++++++- test/boost_no_std_allocator.ipp | 12 +++++++++--- 6 files changed, 36 insertions(+), 14 deletions(-) diff --git a/test/boost_has_part_alloc.ipp b/test/boost_has_part_alloc.ipp index dcef14cb..fb4bf516 100644 --- a/test/boost_has_part_alloc.ipp +++ b/test/boost_has_part_alloc.ipp @@ -12,6 +12,12 @@ #include +#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))) +# define BOOST_UNUSED_ATTRIBUTE __attribute__((unused)) +#else +# define BOOST_UNUSED_ATTRIBUTE +#endif + namespace boost_has_partial_std_allocator{ // @@ -23,12 +29,12 @@ int test_allocator(const T& i) { typedef std::allocator alloc1_t; typedef typename alloc1_t::size_type size_type; - typedef typename alloc1_t::difference_type difference_type; + typedef typename alloc1_t::difference_type difference_type BOOST_UNUSED_ATTRIBUTE; typedef typename alloc1_t::pointer pointer; typedef typename alloc1_t::const_pointer const_pointer; typedef typename alloc1_t::reference reference; typedef typename alloc1_t::const_reference const_reference; - typedef typename alloc1_t::value_type value_type; + typedef typename alloc1_t::value_type value_type BOOST_UNUSED_ATTRIBUTE; alloc1_t a1; @@ -55,8 +61,5 @@ int test() } - - - - +#undef BOOST_UNUSED_ATTRIBUTE diff --git a/test/boost_no_cxx11_hdr_atomic.ipp b/test/boost_no_cxx11_hdr_atomic.ipp index 7378e8cb..b8e18766 100644 --- a/test/boost_no_cxx11_hdr_atomic.ipp +++ b/test/boost_no_cxx11_hdr_atomic.ipp @@ -25,6 +25,7 @@ int test() { std::memory_order m = static_cast(std::memory_order_relaxed | std::memory_order_consume | std::memory_order_acquire | std::memory_order_release | std::memory_order_acq_rel | std::memory_order_seq_cst); + (void)m; std::atomic a1; std::atomic a2; diff --git a/test/boost_no_fenv_h.ipp b/test/boost_no_fenv_h.ipp index 1bb71160..b1e014cc 100644 --- a/test/boost_no_fenv_h.ipp +++ b/test/boost_no_fenv_h.ipp @@ -36,8 +36,8 @@ int test() #endif int i; - fexcept_t fe; - fenv_t env; + has_fexcept_t fe; + has_fenv_t env; i = feclearexcept(FE_ALL_EXCEPT); i += fetestexcept(FE_ALL_EXCEPT); // All flags should be zero diff --git a/test/boost_no_inline_memb_init.ipp b/test/boost_no_inline_memb_init.ipp index 4f8c45d7..4ccacbe3 100644 --- a/test/boost_no_inline_memb_init.ipp +++ b/test/boost_no_inline_memb_init.ipp @@ -44,12 +44,19 @@ struct is_int static const bool value = true; }; +#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))) +# define BOOST_UNUSED_ATTRIBUTE __attribute__((unused)) +#else +# define BOOST_UNUSED_ATTRIBUTE +#endif + + int test() { - typedef int a1[ice_or< is_int::value, is_int::value>::value ? 1 : -1]; + typedef int a1[ice_or< is_int::value, is_int::value>::value ? 1 : -1] BOOST_UNUSED_ATTRIBUTE; return 0; } } - +#undef BOOST_UNUSED_ATTRIBUTE diff --git a/test/boost_no_lambdas.ipp b/test/boost_no_lambdas.ipp index be412261..4354c75d 100644 --- a/test/boost_no_lambdas.ipp +++ b/test/boost_no_lambdas.ipp @@ -16,9 +16,14 @@ namespace boost_no_cxx11_lambdas { +template +void f(Func) +{ +} + int test() { - (void)[](){}; + f([](){}); return 0; } diff --git a/test/boost_no_std_allocator.ipp b/test/boost_no_std_allocator.ipp index 1c730f39..d3badbd5 100644 --- a/test/boost_no_std_allocator.ipp +++ b/test/boost_no_std_allocator.ipp @@ -18,17 +18,23 @@ namespace boost_no_std_allocator{ +#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))) +# define BOOST_UNUSED_ATTRIBUTE __attribute__((unused)) +#else +# define BOOST_UNUSED_ATTRIBUTE +#endif + template int test_allocator(const T& i) { typedef std::allocator alloc1_t; typedef typename alloc1_t::size_type size_type; - typedef typename alloc1_t::difference_type difference_type; + typedef typename alloc1_t::difference_type difference_type BOOST_UNUSED_ATTRIBUTE; typedef typename alloc1_t::pointer pointer; typedef typename alloc1_t::const_pointer const_pointer; typedef typename alloc1_t::reference reference; typedef typename alloc1_t::const_reference const_reference; - typedef typename alloc1_t::value_type value_type; + typedef typename alloc1_t::value_type value_type BOOST_UNUSED_ATTRIBUTE; typedef typename alloc1_t::BOOST_NESTED_TEMPLATE rebind binder_t; typedef typename binder_t::other alloc2_t; @@ -66,7 +72,7 @@ int test() } - +#undef BOOST_UNUSED_ATTRIBUTE