From 879e1011e07e7d325cd9e8a32d8b993b3b03839c Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 22 Jun 2011 21:46:17 +0000 Subject: [PATCH] invoke.cc: Avoid -Wall warnings. 2011-06-22 Paolo Carlini * testsuite/20_util/reference_wrapper/invoke.cc: Avoid -Wall warnings. * testsuite/20_util/reference_wrapper/typedefs-3.cc: Likewise. * testsuite/20_util/reference_wrapper/invoke-2.cc: Likewise. * testsuite/20_util/allocator_traits/members/allocate_hint.cc: Likewise. * testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise. * testsuite/20_util/bind/socket.cc: Likewise. * testsuite/20_util/pointer_traits/pointer_to.cc: Likewise. * testsuite/util/testsuite_random.h: Likewise. From-SVN: r175318 --- libstdc++-v3/ChangeLog | 12 ++++++++++++ .../allocator_traits/members/allocate_hint.cc | 4 ++-- libstdc++-v3/testsuite/20_util/bind/socket.cc | 2 +- .../20_util/pointer_traits/pointer_to.cc | 2 +- .../20_util/ratio/operations/ops_overflow_neg.cc | 11 +++++++---- .../20_util/reference_wrapper/invoke-2.cc | 4 ++-- .../20_util/reference_wrapper/invoke.cc | 3 ++- .../20_util/reference_wrapper/typedefs-3.cc | 16 ++++++++-------- libstdc++-v3/testsuite/util/testsuite_random.h | 4 ++-- 9 files changed, 37 insertions(+), 21 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 0fc0f737ad1..97e0b3764a3 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,15 @@ +2011-06-22 Paolo Carlini + + * testsuite/20_util/reference_wrapper/invoke.cc: Avoid -Wall warnings. + * testsuite/20_util/reference_wrapper/typedefs-3.cc: Likewise. + * testsuite/20_util/reference_wrapper/invoke-2.cc: Likewise. + * testsuite/20_util/allocator_traits/members/allocate_hint.cc: + Likewise. + * testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise. + * testsuite/20_util/bind/socket.cc: Likewise. + * testsuite/20_util/pointer_traits/pointer_to.cc: Likewise. + * testsuite/util/testsuite_random.h: Likewise. + 2011-06-22 Jonathan Wakely * include/Makefile.am: Add alloc_traits.h headers. diff --git a/libstdc++-v3/testsuite/20_util/allocator_traits/members/allocate_hint.cc b/libstdc++-v3/testsuite/20_util/allocator_traits/members/allocate_hint.cc index 6a26adc9f9e..e5a57a2c0af 100644 --- a/libstdc++-v3/testsuite/20_util/allocator_traits/members/allocate_hint.cc +++ b/libstdc++-v3/testsuite/20_util/allocator_traits/members/allocate_hint.cc @@ -51,7 +51,7 @@ void test01() typedef std::allocator_traits> traits_type; traits_type::allocator_type a; traits_type::const_void_pointer v; - X* p = traits_type::allocate(a, 1, v); + X* p __attribute__((unused)) = traits_type::allocate(a, 1, v); VERIFY( a.called ); } @@ -79,7 +79,7 @@ void test02() typedef std::allocator_traits> traits_type; traits_type::allocator_type a; traits_type::const_void_pointer v; - X* p = traits_type::allocate(a, 1, v); + X* p __attribute__((unused)) = traits_type::allocate(a, 1, v); VERIFY( a.called ); } diff --git a/libstdc++-v3/testsuite/20_util/bind/socket.cc b/libstdc++-v3/testsuite/20_util/bind/socket.cc index d3ccea2b3eb..041100f85c2 100644 --- a/libstdc++-v3/testsuite/20_util/bind/socket.cc +++ b/libstdc++-v3/testsuite/20_util/bind/socket.cc @@ -35,7 +35,7 @@ int test01() { int fd = 1; my_sockaddr sa; // N.B. non-const - size_t len = sizeof(sa); // N.B. size_t not socklen_t + size_t len __attribute__((unused)) = sizeof(sa); // N.B. size_t not socklen_t return bind(fd, &sa, sizeof(sa)); } diff --git a/libstdc++-v3/testsuite/20_util/pointer_traits/pointer_to.cc b/libstdc++-v3/testsuite/20_util/pointer_traits/pointer_to.cc index f33582e540c..33c96e17b2a 100644 --- a/libstdc++-v3/testsuite/20_util/pointer_traits/pointer_to.cc +++ b/libstdc++-v3/testsuite/20_util/pointer_traits/pointer_to.cc @@ -32,7 +32,7 @@ struct Ptr void test01() { bool test = true; - Ptr p{&test}; + Ptr p __attribute__((unused)) {&test}; VERIFY( std::pointer_traits::pointer_to(test).value == &test ); } diff --git a/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc b/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc index 0e36c741846..7483016b616 100644 --- a/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc +++ b/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc @@ -26,19 +26,22 @@ void test01() { - std::ratio_add, std::ratio<1>>::type r1; + std::ratio_add, std::ratio<1>>::type r1 + __attribute__((unused)); } void test02() { - std::ratio_multiply, std::ratio<3, 2>>::type r1; - std::ratio_multiply, std::ratio>::type r2; + std::ratio_multiply, std::ratio<3, 2>>::type r1 + __attribute__((unused)); + std::ratio_multiply, std::ratio>::type r2 + __attribute__((unused)); } // { dg-error "required from here" "" { target *-*-* } 29 } -// { dg-error "required from here" "" { target *-*-* } 35 } // { dg-error "required from here" "" { target *-*-* } 36 } +// { dg-error "required from here" "" { target *-*-* } 38 } // { dg-error "overflow in addition" "" { target *-*-* } 432 } // { dg-error "overflow in multiplication" "" { target *-*-* } 104 } // { dg-error "overflow in multiplication" "" { target *-*-* } 100 } diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke-2.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke-2.cc index bd9aeb2c40b..01217a40538 100644 --- a/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke-2.cc +++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke-2.cc @@ -36,8 +36,8 @@ void test01() X x = { }; std::ref(m)(x, 1); std::ref(m)(&x, 1); - int& i1 = std::ref(m2)(x); - int& i2 = std::ref(m2)(&x); + int& i1 __attribute__((unused)) = std::ref(m2)(x); + int& i2 __attribute__((unused)) = std::ref(m2)(&x); } int main() diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke.cc index 7b694c76432..028fe022014 100644 --- a/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke.cc +++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke.cc @@ -75,7 +75,8 @@ void test01() int (::X::* p_foo_c)(float) const = &::X::foo_c; int (::X::* p_foo_v)(float) volatile = &::X::foo_v; int (::X::* p_foo_cv)(float) const volatile = &::X::foo_cv; - int (::X::* p_foo_varargs)(float, ...) = &::X::foo_varargs; + int (::X::* p_foo_varargs)(float, ...) __attribute__((unused)) + = &::X::foo_varargs; int ::X::* p_bar = &::X::bar; const float pi = 3.14; diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc index 2fea52eed06..0920ae4d978 100644 --- a/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc +++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc @@ -124,14 +124,14 @@ struct test_1st_2nd_arg_types template void test() { - test_arg_type t; - test_arg_type tc; - test_arg_type tv; - test_arg_type tcv; - test_1st_2nd_arg_types t12; - test_1st_2nd_arg_types t12c; - test_1st_2nd_arg_types t12v; - test_1st_2nd_arg_types t12cv; + test_arg_type t __attribute__((unused)); + test_arg_type tc __attribute__((unused)); + test_arg_type tv __attribute__((unused)); + test_arg_type tcv __attribute__((unused)); + test_1st_2nd_arg_types t12 __attribute__((unused)); + test_1st_2nd_arg_types t12c __attribute__((unused)); + test_1st_2nd_arg_types t12v __attribute__((unused)); + test_1st_2nd_arg_types t12cv __attribute__((unused)); } int main() diff --git a/libstdc++-v3/testsuite/util/testsuite_random.h b/libstdc++-v3/testsuite/util/testsuite_random.h index 5b5575571d7..950a9aeaa1c 100644 --- a/libstdc++-v3/testsuite/util/testsuite_random.h +++ b/libstdc++-v3/testsuite/util/testsuite_random.h @@ -48,7 +48,7 @@ namespace __gnu_test for (unsigned long i = 0; i < N; i++) { auto r = f(); - if (r >= 0 && r < BINS) + if (r >= 0 && (unsigned long)r < BINS) count[r]++; } @@ -116,7 +116,7 @@ namespace __gnu_test if (!wl.size()) wl = { 1.0 }; - if (k < 0 || k >= wl.size()) + if (k < 0 || (std::size_t)k >= wl.size()) return 0.0; else { -- 2.30.2