invoke.cc: Avoid -Wall warnings.
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 22 Jun 2011 21:46:17 +0000 (21:46 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 22 Jun 2011 21:46:17 +0000 (21:46 +0000)
2011-06-22  Paolo Carlini  <paolo.carlini@oracle.com>

* 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
libstdc++-v3/testsuite/20_util/allocator_traits/members/allocate_hint.cc
libstdc++-v3/testsuite/20_util/bind/socket.cc
libstdc++-v3/testsuite/20_util/pointer_traits/pointer_to.cc
libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc
libstdc++-v3/testsuite/20_util/reference_wrapper/invoke-2.cc
libstdc++-v3/testsuite/20_util/reference_wrapper/invoke.cc
libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc
libstdc++-v3/testsuite/util/testsuite_random.h

index 0fc0f737ad1f90ea0f62b1af15abf721a46b0fcb..97e0b3764a353148d6f9fa3129a7e69f728f8c15 100644 (file)
@@ -1,3 +1,15 @@
+2011-06-22  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * 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  <jwakely.gcc@gmail.com>
 
        * include/Makefile.am: Add alloc_traits.h headers.
index 6a26adc9f9e2929712f3bfc2a848328b36f8a853..e5a57a2c0afcf82986fcf9c004a4c7bdd2bff499 100644 (file)
@@ -51,7 +51,7 @@ void test01()
   typedef std::allocator_traits<hintable_allocator<X>> 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<unhintable_allocator<X>> 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 );
 }
 
index d3ccea2b3ebe63cbc1eeecd5914661615e5b9d6d..041100f85c21eb474a8ad69487ac2739367157c6 100644 (file)
@@ -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));
 }
 
index f33582e540cc07f3ec8c50d9fe0ce4ec0b6852bc..33c96e17b2adc042b09a1459d9dac3973e0e59ec 100644 (file)
@@ -32,7 +32,7 @@ struct Ptr
 void test01()
 {
   bool test = true;
-  Ptr p{&test};
+  Ptr p __attribute__((unused)) {&test};
 
   VERIFY( std::pointer_traits<Ptr>::pointer_to(test).value == &test );
 }
index 0e36c741846c1462cd3d4c99d781ea4f32871a9d..7483016b6160cf2632f349bc099238604fa9330c 100644 (file)
 void
 test01()
 {
-  std::ratio_add<std::ratio<INTMAX_MAX, 1>, std::ratio<1>>::type r1;
+  std::ratio_add<std::ratio<INTMAX_MAX, 1>, std::ratio<1>>::type r1
+    __attribute__((unused));
 }
 
 void
 test02()
 {  
-  std::ratio_multiply<std::ratio<-INTMAX_MAX, 2>, std::ratio<3, 2>>::type r1;
-  std::ratio_multiply<std::ratio<INTMAX_MAX>, std::ratio<INTMAX_MAX>>::type r2;
+  std::ratio_multiply<std::ratio<-INTMAX_MAX, 2>, std::ratio<3, 2>>::type r1
+    __attribute__((unused));
+  std::ratio_multiply<std::ratio<INTMAX_MAX>, std::ratio<INTMAX_MAX>>::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 }
index bd9aeb2c40b3d7685b683a2d93384fffd7c2fa7b..01217a4053808f6eede2fca40d277288002b2ea2 100644 (file)
@@ -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()
index 7b694c76432e9c0e11a59987ee6633c448f5f9fa..028fe0220145483e894451a48da9d648aa815b91 100644 (file)
@@ -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;
index 2fea52eed06a31e0e1512d49c7bb10ac88db8648..0920ae4d97863e910c6374ce0eb2b2bd761b7cb9 100644 (file)
@@ -124,14 +124,14 @@ struct test_1st_2nd_arg_types<T, true>
 template<typename T>
   void test()
   {
-    test_arg_type<T> t;
-    test_arg_type<const T> tc;
-    test_arg_type<volatile T> tv;
-    test_arg_type<const volatile T> tcv;
-    test_1st_2nd_arg_types<T> t12;
-    test_1st_2nd_arg_types<const T> t12c;
-    test_1st_2nd_arg_types<volatile T> t12v;
-    test_1st_2nd_arg_types<const volatile T> t12cv;
+    test_arg_type<T> t __attribute__((unused));
+    test_arg_type<const T> tc __attribute__((unused));
+    test_arg_type<volatile T> tv __attribute__((unused));
+    test_arg_type<const volatile T> tcv __attribute__((unused));
+    test_1st_2nd_arg_types<T> t12 __attribute__((unused));
+    test_1st_2nd_arg_types<const T> t12c __attribute__((unused));
+    test_1st_2nd_arg_types<volatile T> t12v __attribute__((unused));
+    test_1st_2nd_arg_types<const volatile T> t12cv __attribute__((unused));
   }
 
 int main()
index 5b5575571d796f89e32dd03c59f6b56056fd061e..950a9aeaa1ca59874861aa0382a648491c5f855d 100644 (file)
@@ -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
       {