From 5f96c99844e6f2823a05b34a2ad1aa0adb67dbe7 Mon Sep 17 00:00:00 2001
From: paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 28 Dec 2005 09:57:57 +0000
Subject: [PATCH] 2005-12-28  Paolo Carlini  <pcarlini@suse.de>

	* include/std/std_bitset.h (bitset<>::_M_copy_from_string,
	bitset<>::_M_copy_to_string, bitset<>::operator>>): Reverse loop.

	* testsuite/25_algorithms/heap/heap.cc (test01): Always enable
	complexity checks.
	* testsuite/18_support/numeric_limits/specialization.cc: Avoid
	unused parameter warning.
	* testsuite/18_support/numeric_limits/traps.cc: Acoid unused variable
	warning.
	* testsuite/ext/malloc_allocator/deallocate_global.cc: Fix format
	string.
	* testsuite/ext/malloc_allocator/deallocate_local.cc: Likewise.
	* testsuite/ext/array_allocator/2.cc: Remove unused variable.
	* testsuite/tr1/3_function_objects/mem_fn.cc: Avoid unused variable
	warnings.
	* testsuite/tr1/6_containers/unordered/instantiate/set.cc: Just
	instantiate.
	* testsuite/tr1/6_containers/unordered/instantiate/map.cc: Likewise.
	* testsuite/tr1/6_containers/unordered/instantiate/hash.cc: Likewise.
	* testsuite/tr1/6_containers/unordered/instantiate/multiset.cc:
	Likewise.
	* testsuite/tr1/6_containers/unordered/instantiate/multimap.cc:
	Likewise.
	* testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc:
	Avoid unused variable warnings.
	* testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc:
	Likewise.
	* testsuite/thread/18185.cc: Likewise.
	* testsuite/27_io/ios_base/storage/11584.cc: Likewise; avoid comparison
	between signed and unsigned warning.
	* testsuite/27_io/types/1.cc: Avoid unused variable warnings.
	* testsuite/testsuite_allocator.h (check_new): Likewise.
	(check_deallocate_null): Adjust return type.
	* testsuite/testsuite_hooks.h (bitmask_operators): Avoid unused
	variable warnings.
	* testsuite/21_strings/c_strings/wchar_t/24559.cc: Avoid unused
	variable warning.

2005-12-28  Chris Jefferson  <chris@bubblescope.net>

	* include/std/std_bitset.h (bitset<0>::set, bitset<0>::reset,
	bitset<0>::flip, bitset<0>::test): Add inline specializations for
	bitset<0>.

	* testsuite/tr1/6_containers/unordered/insert/multiset_range.cc
	(test01): Add static cast.
	* testsuite/tr1/6_containers/unordered/insert/set_range.cc
	(test01): Likewise.
	* testsuite/testsuite_hooks.h (operator==(NonDefaultConstructible,
	NonDefaultConstructible), operator<(NonDefaultConstructible,
	NonDefaultConstrictible)): Avoid unused parameter warning.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109103 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libstdc++-v3/ChangeLog                        |  54 +++++++
 libstdc++-v3/include/std/std_bitset.h         |  61 ++++++--
 .../numeric_limits/specialization.cc          |   4 +-
 .../18_support/numeric_limits/traps.cc        |   4 +-
 .../21_strings/c_strings/wchar_t/24559.cc     |   6 +-
 .../testsuite/25_algorithms/heap/heap.cc      | 138 +++++++++---------
 .../testsuite/27_io/ios_base/storage/11584.cc |  15 +-
 libstdc++-v3/testsuite/27_io/types/1.cc       |   6 +-
 .../testsuite/ext/array_allocator/2.cc        |   3 +-
 .../ext/malloc_allocator/deallocate_global.cc |   5 +-
 .../ext/malloc_allocator/deallocate_local.cc  |   5 +-
 libstdc++-v3/testsuite/testsuite_allocator.h  |   4 +-
 libstdc++-v3/testsuite/testsuite_hooks.h      |  13 +-
 libstdc++-v3/testsuite/thread/18185.cc        |  10 +-
 .../tr1/3_function_objects/mem_fn.cc          |   5 +-
 .../array/cons/aggregate_initialization.cc    |   4 +-
 .../array/requirements/zero_sized_arrays.cc   |   3 +-
 .../unordered/insert/multiset_range.cc        |   6 +-
 .../unordered/insert/set_range.cc             |   4 +-
 .../unordered/instantiate/hash.cc             |  45 +++---
 .../6_containers/unordered/instantiate/map.cc |  19 +--
 .../unordered/instantiate/multimap.cc         |  17 +--
 .../unordered/instantiate/multiset.cc         |  14 +-
 .../6_containers/unordered/instantiate/set.cc |  14 +-
 24 files changed, 269 insertions(+), 190 deletions(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index f5c25b9640bc..b5a754bd7039 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,57 @@
+2005-12-28  Paolo Carlini  <pcarlini@suse.de>
+
+	* include/std/std_bitset.h (bitset<>::_M_copy_from_string,
+	bitset<>::_M_copy_to_string, bitset<>::operator>>): Reverse loop.
+
+	* testsuite/25_algorithms/heap/heap.cc (test01): Always enable
+	complexity checks.
+	* testsuite/18_support/numeric_limits/specialization.cc: Avoid
+	unused parameter warning.
+	* testsuite/18_support/numeric_limits/traps.cc: Acoid unused variable
+	warning.
+	* testsuite/ext/malloc_allocator/deallocate_global.cc: Fix format
+	string.
+	* testsuite/ext/malloc_allocator/deallocate_local.cc: Likewise.
+	* testsuite/ext/array_allocator/2.cc: Remove unused variable.
+	* testsuite/tr1/3_function_objects/mem_fn.cc: Avoid unused variable
+	warnings.
+	* testsuite/tr1/6_containers/unordered/instantiate/set.cc: Just
+	instantiate.
+	* testsuite/tr1/6_containers/unordered/instantiate/map.cc: Likewise.
+	* testsuite/tr1/6_containers/unordered/instantiate/hash.cc: Likewise.
+	* testsuite/tr1/6_containers/unordered/instantiate/multiset.cc:
+	Likewise.
+	* testsuite/tr1/6_containers/unordered/instantiate/multimap.cc:
+	Likewise.
+	* testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc:
+	Avoid unused variable warnings.
+	* testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc:
+	Likewise.
+	* testsuite/thread/18185.cc: Likewise.
+	* testsuite/27_io/ios_base/storage/11584.cc: Likewise; avoid comparison
+	between signed and unsigned warning.
+	* testsuite/27_io/types/1.cc: Avoid unused variable warnings.
+	* testsuite/testsuite_allocator.h (check_new): Likewise.
+	(check_deallocate_null): Adjust return type.
+	* testsuite/testsuite_hooks.h (bitmask_operators): Avoid unused
+	variable warnings.
+	* testsuite/21_strings/c_strings/wchar_t/24559.cc: Avoid unused
+	variable warning.
+
+2005-12-28  Chris Jefferson  <chris@bubblescope.net>
+
+	* include/std/std_bitset.h (bitset<0>::set, bitset<0>::reset,
+	bitset<0>::flip, bitset<0>::test): Add inline specializations for
+	bitset<0>.
+
+	* testsuite/tr1/6_containers/unordered/insert/multiset_range.cc
+	(test01): Add static cast.
+	* testsuite/tr1/6_containers/unordered/insert/set_range.cc
+	(test01): Likewise.
+	* testsuite/testsuite_hooks.h (operator==(NonDefaultConstructible,
+	NonDefaultConstructible), operator<(NonDefaultConstructible,
+	NonDefaultConstrictible)): Avoid unused parameter warning.
+
 2005-12-26  Chris Jefferson  <chris@bubblescope.net>
 
 	* include/ext/mt_allocator.h (__mt_alloc::__mt_alloc): Remove
diff --git a/libstdc++-v3/include/std/std_bitset.h b/libstdc++-v3/include/std/std_bitset.h
index c1cfadad7bd8..ad47238ed628 100644
--- a/libstdc++-v3/include/std/std_bitset.h
+++ b/libstdc++-v3/include/std/std_bitset.h
@@ -1144,19 +1144,20 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
   template<size_t _Nb>
     template<class _CharT, class _Traits, class _Alloc>
       void
-      bitset<_Nb>::_M_copy_from_string(const std::basic_string<_CharT, _Traits,
-				       _Alloc>& __s, size_t __pos, size_t __n)
+      bitset<_Nb>::
+      _M_copy_from_string(const std::basic_string<_CharT, _Traits,
+			  _Alloc>& __s, size_t __pos, size_t __n)
       {
 	reset();
 	const size_t __nbits = std::min(_Nb, std::min(__n, __s.size() - __pos));
-	for (size_t __i = 0; __i < __nbits; ++__i)
+	for (size_t __i = __nbits; __i > 0; --__i)
 	  {
-	    switch(__s[__pos + __nbits - __i - 1])
+	    switch(__s[__pos + __nbits - __i])
 	      {
 	      case '0':
 		break;
 	      case '1':
-		set(__i);
+		set(__i - 1);
 		break;
 	      default:
 		__throw_invalid_argument(__N("bitset::_M_copy_from_string"));
@@ -1167,13 +1168,13 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
   template<size_t _Nb>
     template<class _CharT, class _Traits, class _Alloc>
       void
-      bitset<_Nb>::_M_copy_to_string(std::basic_string<_CharT, _Traits,
-				     _Alloc>& __s) const
+      bitset<_Nb>::
+      _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>& __s) const
       {
 	__s.assign(_Nb, '0');
-	for (size_t __i = 0; __i < _Nb; ++__i)
-	  if (_Unchecked_test(__i))
-	    __s[_Nb - 1 - __i] = '1';
+	for (size_t __i = _Nb; __i > 0; --__i)
+	  if (_Unchecked_test(__i - 1))
+	    __s[_Nb - __i] = '1';
       }
 
   // 23.3.5.3 bitset operations:
@@ -1242,7 +1243,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
 	      // 303. Bitset input operator underspecified
 	      const char_type __zero = __is.widen('0');
 	      const char_type __one = __is.widen('1');
-	      for (size_t __i = 0; __i < _Nb; ++__i)
+	      for (size_t __i = _Nb; __i > 0; --__i)
 		{
 		  static typename _Traits::int_type __eof = _Traits::eof();
 		  
@@ -1290,6 +1291,44 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
       __x._M_copy_to_string(__tmp);
       return __os << __tmp;
     }
+
+  // Specializations for zero-sized bitsets, to avoid "unsigned comparison
+  // with zero" warnings.
+  template<>
+    inline bitset<0>&
+    bitset<0>::
+    set(size_t, bool)
+    {
+      __throw_out_of_range(__N("bitset::set"));
+      return *this;
+    }
+      
+  template<>
+    inline bitset<0>&
+    bitset<0>::
+    reset(size_t)
+    {
+      __throw_out_of_range(__N("bitset::reset"));
+      return *this;
+    }
+      
+  template<>
+    inline bitset<0>&
+    bitset<0>::
+    flip(size_t)
+    {
+      __throw_out_of_range(__N("bitset::flip"));
+      return *this;
+    }
+      
+  template<>
+    inline bool
+    bitset<0>::
+    test(size_t) const
+    {
+      __throw_out_of_range(__N("bitset::test"));
+      return false;
+    }
   //@}
 
 _GLIBCXX_END_NESTED_NAMESPACE
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/specialization.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/specialization.cc
index 815b7f5505c5..0a1c8fec353d 100644
--- a/libstdc++-v3/testsuite/18_support/numeric_limits/specialization.cc
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits/specialization.cc
@@ -3,7 +3,7 @@
 
 // 1999-08-23 bkoz
 
-// Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation
+// Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -41,7 +41,7 @@ template<typename T>
 
 struct B 
 {
-  B(int i = 0) { }
+  B(int = 0) { }
 };
 
 
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/traps.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/traps.cc
index e9bdd84e4b33..197a2518943a 100644
--- a/libstdc++-v3/testsuite/18_support/numeric_limits/traps.cc
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits/traps.cc
@@ -26,14 +26,14 @@
 
 template<typename T>
   void 
-  test_traps()
+  test_traps(T r = T(0))
   {
     typedef T value_type;
     volatile value_type i(5);
     volatile value_type j(0);
     
     if (!std::numeric_limits<value_type>::traps)
-      value_type r = i/j;
+      r = i / j;
   }
 
 // libstdc++/22203
diff --git a/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/24559.cc b/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/24559.cc
index 26f03267855c..9e2a17dea303 100644
--- a/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/24559.cc
+++ b/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/24559.cc
@@ -23,10 +23,10 @@
 // { dg-do compile }
 
 // libstdc++/24559
+void test01(wchar_t* (*) (wchar_t *, const wchar_t*)) { }
+
 int main()
 {
-  typedef wchar_t* (*pf)(wchar_t *, const wchar_t*);
-  pf p1 = std::wcspbrk;
-
+  test01(std::wcspbrk);
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/25_algorithms/heap/heap.cc b/libstdc++-v3/testsuite/25_algorithms/heap/heap.cc
index 6fbd3ed4c06d..ba916a8f01e7 100644
--- a/libstdc++-v3/testsuite/25_algorithms/heap/heap.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/heap/heap.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -19,7 +19,6 @@
 // 25.3.6 Heap operations [lib.alg.heap.operations]
 
 #include <algorithm>
-//#include <cmath>
 #include <testsuite_hooks.h>
 
 bool test __attribute__((unused)) = true;
@@ -29,24 +28,24 @@ const int B[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
 const int C[] = {17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
 const int N = sizeof(A) / sizeof(int);
 
-// This functor has the equivalent functionality of std::geater<>,
+// This functor has the equivalent functionality of std::greater<>,
 // but there is no dependency on <functional> and it also tracks the
 // number of invocations since creation.
 class Gt
 {
 public:
-    static int count() { return itsCount; }
-    static void reset() { itsCount = 0; }
-
-    bool
-    operator()(const int& x, const int& y)
-    {
-        ++itsCount;
-        return x > y; 
-    }
+  static int count() { return itsCount; }
+  static void reset() { itsCount = 0; }
+  
+  bool
+  operator()(const int& x, const int& y)
+  {
+    ++itsCount;
+    return x > y; 
+  }
 
 private:
-    static int itsCount;
+  static int itsCount;
 };
 
 int Gt::itsCount = 0;
@@ -57,27 +56,27 @@ int Gt::itsCount = 0;
 void
 test01()
 {
-    // sort array s1 using push_heap/pop_heap
-    int s1[N];
-    std::copy(A, A + N, s1);
-    VERIFY(std::equal(s1, s1 + N, A));
-
-    for (int i = 2; i <= N; ++i) {
-        std::push_heap(s1, s1 + i);
-    }
-    for (int i = N; i >= 2; --i) {
-        std::pop_heap(s1, s1 + i);
-    }
-    VERIFY(std::equal(s1, s1 + N, B));
-
-    // sort array s2 using make_heap/sort_heap
-    int s2[N];
-    std::copy(A, A + N, s2);
-    VERIFY(std::equal(s2, s2 + N, A));
-
-    std::make_heap(s2, s2 + N);
-    std::sort_heap(s2, s2 + N);
-    VERIFY(std::equal(s2, s2 + N, B));
+  // sort array s1 using push_heap/pop_heap
+  int s1[N];
+  std::copy(A, A + N, s1);
+  VERIFY(std::equal(s1, s1 + N, A));
+  
+  for (int i = 2; i <= N; ++i)
+    std::push_heap(s1, s1 + i);
+  
+  for (int i = N; i >= 2; --i)
+    std::pop_heap(s1, s1 + i);
+  
+  VERIFY(std::equal(s1, s1 + N, B));
+
+  // sort array s2 using make_heap/sort_heap
+  int s2[N];
+  std::copy(A, A + N, s2);
+  VERIFY(std::equal(s2, s2 + N, A));
+  
+  std::make_heap(s2, s2 + N);
+  std::sort_heap(s2, s2 + N);
+  VERIFY(std::equal(s2, s2 + N, B));
 }
 
 // Perform same tests as above but with the comparison predicate
@@ -85,49 +84,43 @@ test01()
 void
 test02()
 {
-    Gt gt;
+  Gt gt;
 //    const int logN = static_cast<int>(std::log(static_cast<double>(N)) + 0.5);
-    const int logN = 3;
-
-    int s1[N];
-    std::copy(A, A + N, s1);
-    VERIFY(std::equal(s1, s1 + N, A));
-
-    for (int i = 2; i <= N; ++i) {
-        std::push_heap(s1, s1 + i, gt);
-#ifndef _GLIBCXX_DEBUG
-        VERIFY(gt.count() <= logN);
-#endif
-        gt.reset();
+  const int logN = 3;
+  
+  int s1[N];
+  std::copy(A, A + N, s1);
+  VERIFY(std::equal(s1, s1 + N, A));
+  
+  for (int i = 2; i <= N; ++i)
+    {
+      std::push_heap(s1, s1 + i, gt);
+      VERIFY(gt.count() <= logN);
+      gt.reset();
     }
 
-    for (int i = N; i >= 2; --i) {
-        std::pop_heap(s1, s1 + i, gt);
-#ifndef _GLIBCXX_DEBUG
-        VERIFY(gt.count() <= 2 * logN);
-#endif
-        gt.reset();
+  for (int i = N; i >= 2; --i)
+    {
+      std::pop_heap(s1, s1 + i, gt);
+      VERIFY(gt.count() <= 2 * logN);
+      gt.reset();
     }
 
-    VERIFY(std::equal(s1, s1 + N, C));
-
-    // sort array s2 using make_heap/sort_heap
-    int s2[N];
-    std::copy(A, A + N, s2);
-    VERIFY(std::equal(s2, s2 + N, A));
-
-    std::make_heap(s2, s2 + N, gt);
-#ifndef _GLIBCXX_DEBUG
-    VERIFY(gt.count() <= 3 * N);
-#endif
-    gt.reset();
-
-    std::sort_heap(s2, s2 + N, gt);
-#ifndef _GLIBCXX_DEBUG
-    VERIFY(gt.count() <= N * logN);
-#endif
-
-    VERIFY(std::equal(s2, s2 + N, C));
+  VERIFY(std::equal(s1, s1 + N, C));
+  
+  // sort array s2 using make_heap/sort_heap
+  int s2[N];
+  std::copy(A, A + N, s2);
+  VERIFY(std::equal(s2, s2 + N, A));
+  
+  std::make_heap(s2, s2 + N, gt);
+  VERIFY(gt.count() <= 3 * N);
+  gt.reset();
+
+  std::sort_heap(s2, s2 + N, gt);
+  VERIFY(gt.count() <= N * logN);
+  
+  VERIFY(std::equal(s2, s2 + N, C));
 }
 
 int
@@ -135,6 +128,5 @@ main()
 {
   test01();
   test02();
-
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc b/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc
index a97f2f789cd7..06eae990c80a 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc
@@ -1,6 +1,6 @@
 // 2004-01-25 jlquinn@gcc.gnu.org
 
-// Copyright (C) 2004 Free Software Foundation
+// Copyright (C) 2004, 2005 Free Software Foundation
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -42,21 +42,22 @@ void operator delete[] (void *p) throw() { operator delete(p); }
 int main ()
 {
   bool test __attribute__((unused)) = true;
-  const int i = std::ios::xalloc ();
+  const int i = std::ios::xalloc();
+  VERIFY( i >= 0 );
 
   new_fails = 1;
   
   // Successive accesses to failure storage clears to zero.
-  std::cout.iword(100) = 0xdeadbeef;
-  VERIFY(std::cout.iword(100) == 0);
+  std::cout.iword(100) = 69;
+  VERIFY( std::cout.iword(100) == 0 );
   
   // Access to pword failure storage shouldn't clear iword pword storage.
   long& lr = std::cout.iword(100);
-  lr = 0xdeadbeef;
+  lr = 69;
   
   void* pv = std::cout.pword(100);
-  VERIFY(pv == 0);
-  VERIFY(lr == 0xdeadbeef);
+  VERIFY( pv == 0 );
+  VERIFY( lr == 69 );
   
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/27_io/types/1.cc b/libstdc++-v3/testsuite/27_io/types/1.cc
index 276c99c7fd3d..59965c820ab5 100644
--- a/libstdc++-v3/testsuite/27_io/types/1.cc
+++ b/libstdc++-v3/testsuite/27_io/types/1.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2002, 2004 Free Software Foundation
+// Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -25,8 +25,8 @@
 // Annex D, deprecated.
 void test01()
 {
-  std::ios_base::streampos spos;
-  std::ios_base::streamoff soff;
+  typedef std::ios_base::streampos streampos_type;
+  typedef std::ios_base::streamoff streamoff_type;
 }
 
 int main(void)
diff --git a/libstdc++-v3/testsuite/ext/array_allocator/2.cc b/libstdc++-v3/testsuite/ext/array_allocator/2.cc
index 79f8c5399131..6ec4a1771ee6 100644
--- a/libstdc++-v3/testsuite/ext/array_allocator/2.cc
+++ b/libstdc++-v3/testsuite/ext/array_allocator/2.cc
@@ -1,7 +1,7 @@
 // Expected execution error for PR19495.
 // { dg-do run { xfail powerpc*-*-linux* } }
 
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -47,7 +47,6 @@ void test01()
   typedef __gnu_cxx::array_allocator<char_type, array_type> allocator_type;
   typedef basic_string<char_type, traits_type, allocator_type> string_type;
 
-  size_t index = array_type::_S_index;
   allocator_type a(&extern_array);
   string_type s(a);
     
diff --git a/libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_global.cc b/libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_global.cc
index 7e670f0c4cf8..97604735f202 100644
--- a/libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_global.cc
+++ b/libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_global.cc
@@ -1,5 +1,5 @@
 //
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -57,7 +57,8 @@ void operator delete(void* p) throw()
   if (count == 0)
     printf("All memory released \n");
   else
-    printf("%u allocations to be released \n", count);
+    printf("%lu allocations to be released \n",
+	   static_cast<unsigned long>(count));
   free(p);
 }
 
diff --git a/libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_local.cc b/libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_local.cc
index 175a833fbc57..aafffae9d707 100644
--- a/libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_local.cc
+++ b/libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_local.cc
@@ -1,5 +1,5 @@
 //
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -44,7 +44,8 @@ void operator delete(void* p) throw()
   if (alloc_cnt == 0)
     printf("All memory released \n");
   else
-    printf("%u allocations to be released \n", alloc_cnt);
+    printf("%lu allocations to be released \n",
+	   static_cast<unsigned long>(alloc_cnt));
   free(p);
 }
 
diff --git a/libstdc++-v3/testsuite/testsuite_allocator.h b/libstdc++-v3/testsuite/testsuite_allocator.h
index 307a0384dc5e..3beb29d32b4a 100644
--- a/libstdc++-v3/testsuite/testsuite_allocator.h
+++ b/libstdc++-v3/testsuite/testsuite_allocator.h
@@ -184,7 +184,7 @@ namespace __gnu_test
     check_new(Alloc a = Alloc())
     {
       bool test __attribute__((unused)) = true;
-      typename Alloc::pointer p = a.allocate(10);
+      a.allocate(10);
       test &= ( new_called == uses_global_new );
       return test;
     }
@@ -201,7 +201,7 @@ namespace __gnu_test
     }
 
   template<typename Alloc>
-    bool 
+    void 
     check_deallocate_null()
     {
       // Let's not core here...
diff --git a/libstdc++-v3/testsuite/testsuite_hooks.h b/libstdc++-v3/testsuite/testsuite_hooks.h
index 8a5276f50c24..38b80630fc23 100644
--- a/libstdc++-v3/testsuite/testsuite_hooks.h
+++ b/libstdc++-v3/testsuite/testsuite_hooks.h
@@ -104,10 +104,9 @@ namespace __gnu_test
   // bitmask_operators
   template<typename bitmask_type>
     void
-    bitmask_operators()
+    bitmask_operators(bitmask_type a = bitmask_type(),
+		      bitmask_type b = bitmask_type())
     {
-      bitmask_type a;
-      bitmask_type b;
       a | b;
       a & b;
       a ^ b;
@@ -168,13 +167,13 @@ namespace __gnu_test
   };
  
   inline bool
-  operator==(const NonDefaultConstructible& lhs,
-	     const NonDefaultConstructible& rhs)
+  operator==(const NonDefaultConstructible&,
+	     const NonDefaultConstructible&)
   { return false; }
 
   inline bool
-  operator<(const NonDefaultConstructible& lhs,
-	    const NonDefaultConstructible& rhs)
+  operator<(const NonDefaultConstructible&,
+	    const NonDefaultConstructible&)
   { return false; }
 
 
diff --git a/libstdc++-v3/testsuite/thread/18185.cc b/libstdc++-v3/testsuite/thread/18185.cc
index 9c2d4adc9d26..4ec6a6d0b3b6 100644
--- a/libstdc++-v3/testsuite/thread/18185.cc
+++ b/libstdc++-v3/testsuite/thread/18185.cc
@@ -1,5 +1,5 @@
 //
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -25,8 +25,8 @@
 #include <string>
 #include <pthread.h>
 
-static void *
-foo (void *p)
+static void*
+foo (void*)
 {
   typedef std::char_traits<char> traits_type;
   typedef __gnu_cxx::new_allocator<char> allocator_type;
@@ -47,7 +47,7 @@ int
 main ()
 {
   pthread_t t;
-  int j = pthread_create (&t, 0, foo, 0);
-  int i = pthread_join (t, 0);
+  pthread_create (&t, 0, foo, 0);
+  pthread_join (t, 0);
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/tr1/3_function_objects/mem_fn.cc b/libstdc++-v3/testsuite/tr1/3_function_objects/mem_fn.cc
index 74caeef88ab3..2f780c1a9944 100644
--- a/libstdc++-v3/testsuite/tr1/3_function_objects/mem_fn.cc
+++ b/libstdc++-v3/testsuite/tr1/3_function_objects/mem_fn.cc
@@ -39,7 +39,7 @@ struct dumb_ptr
 };
 
 // Test mem_fn with a data member
-void test01()
+void test01(int r = 0)
 {
   using std::tr1::mem_fn;
 
@@ -69,6 +69,9 @@ void test01()
   const int& bypc = mem_fn(&X::bar)(ypc);
   const int& byd = mem_fn(&X::bar)(yd);
   const int& bydc = mem_fn(&X::bar)(ydc);
+  
+  // Avoid unused variable warnings.
+  r = bx + bxc + bxp + bxpc + bxd + bxdc + by + byc + byp + bypc + byd + bydc;
 }
 
 int main()
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc
index a6ebca06691a..1c6c8edd670c 100644
--- a/libstdc++-v3/testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc
@@ -2,7 +2,7 @@
 
 // 2004-10-20  Benjamin Kosnik  <bkoz@redhat.com>
 //
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -31,6 +31,8 @@ test01()
 
   array_type a = { 0, 1, 2, 3, 4 };
   array_type b = { 0, 1, 2, 3 };
+
+  a = b;
 }
 
 int main()
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc
index 472524578590..75b3e97720e5 100644
--- a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc
@@ -1,6 +1,6 @@
 // 2004-10-20  Benjamin Kosnik  <bkoz@redhat.com>
 //
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -38,6 +38,7 @@ test01()
 
   // 3
   // begin() == end()
+  VERIFY( a.begin() == a.end() );
   VERIFY( b.begin() == b.end() );
 
   // 4: ?
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/insert/multiset_range.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/insert/multiset_range.cc
index ab543e481bd8..a83fce3cd61b 100644
--- a/libstdc++-v3/testsuite/tr1/6_containers/unordered/insert/multiset_range.cc
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered/insert/multiset_range.cc
@@ -27,7 +27,7 @@
 #include <iterator>
 #include <algorithm>
 #include <tr1/unordered_set>
-#include "testsuite_hooks.h"
+#include <testsuite_hooks.h>
 
 bool test __attribute__((unused)) = true;
 
@@ -42,7 +42,7 @@ void test01()
 			     "magenta", "yellow", "orange", "pink", "gray" };
 
   s.insert(A+0, A+N);
-  VERIFY(s.size() == N);
+  VERIFY(s.size() == static_cast<unsigned int>(N));
   VERIFY(std::distance(s.begin(), s.end()) == N);
 
   for (int i = 0; i < N; ++i) {
@@ -62,7 +62,7 @@ void test02()
   const int A[N] = { 3, 7, 4, 8, 2, 4, 6, 7 };
 
   s.insert(A+0, A+N);
-  VERIFY(s.size() == N);
+  VERIFY(s.size() == static_cast<unsigned int>(N));
   VERIFY(std::distance(s.begin(), s.end()) == N);
 
   VERIFY(std::count(s.begin(), s.end(), 2) == 1);
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/insert/set_range.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/insert/set_range.cc
index 24f973846b11..bfa4f73b1b20 100644
--- a/libstdc++-v3/testsuite/tr1/6_containers/unordered/insert/set_range.cc
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered/insert/set_range.cc
@@ -27,7 +27,7 @@
 #include <iterator>
 #include <algorithm>
 #include <tr1/unordered_set>
-#include "testsuite_hooks.h"
+#include <testsuite_hooks.h>
 
 bool test __attribute__((unused)) = true;
 
@@ -42,7 +42,7 @@ void test01()
 			     "magenta", "yellow", "orange", "pink", "gray" };
 
   s.insert(A+0, A+N);
-  VERIFY(s.size() == N);
+  VERIFY(s.size() == static_cast<unsigned int>(N));
   VERIFY(std::distance(s.begin(), s.end()) == N);
 
   for (int i = 0; i < N; ++i) {
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/hash.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/hash.cc
index da4515160a5e..382d69f715c4 100644
--- a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/hash.cc
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/hash.cc
@@ -1,6 +1,6 @@
 // { dg-do compile }
 
-// 2005-2-17  Matt Austern  <austern@apple.com>
+// 2005-02-17  Matt Austern  <austern@apple.com>
 //
 // Copyright (C) 2005 Free Software Foundation, Inc.
 //
@@ -25,30 +25,27 @@
 #include <string>
 #include <tr1/functional>
 
-int main()
-{
-  using namespace std::tr1;
+using namespace std::tr1;
 
-  // Verify that we can instantiate hash for every required type.
-
-  hash<bool> hb;
-  hash<char> hc;
-  hash<signed char> hsc;
-  hash<unsigned char> huc;
-  hash<short> hs;
-  hash<int> hi;
-  hash<long> hl;
-  hash<unsigned short> hus;
-  hash<unsigned int> hui;
-  hash<unsigned long> hul;
-  hash<float> hf;
-  hash<double> hd;
-  hash<long double> hld;
-  hash<void*> hp;
-  hash<std::string> hstr;
+// Verify that we can instantiate hash for every required type.
+template class hash<bool>;
+template class hash<char>;
+template class hash<signed char>;
+template class hash<unsigned char>;
+template class hash<short>;
+template class hash<int>;
+template class hash<long>;
+template class hash<unsigned short>;
+template class hash<unsigned int>;
+template class hash<unsigned long>;
+template class hash<float>;
+template class hash<double>;
+template class hash<long double>;
+template class hash<void*>;
+template class hash<std::string>;
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  hash<wchar_t> hw;
-  hash<std::wstring> hwstr;
+template class hash<wchar_t>;
+template class hash<std::wstring>;
 #endif
-}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/map.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/map.cc
index adb2913c9a30..cb1cf2fc98e2 100644
--- a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/map.cc
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/map.cc
@@ -1,8 +1,8 @@
 // { dg-do compile }
 
-// 2005-2-17  Matt Austern  <austern@apple.com>
+// 2005-02-17  Matt Austern  <austern@apple.com>
 //
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -25,13 +25,10 @@
 #include <string>
 #include <tr1/unordered_map>
 
-int main()
-{
-  using namespace std;
-  using namespace std::tr1;
+using namespace std;
+using namespace std::tr1;
 
-  unordered_map<string, float> m1;
-  unordered_map<string, float,
-                hash<string>, equal_to<string>, 
-                allocator<pair<const string, float> >, true> s2;
-}
+template class unordered_map<string, float>;
+template class unordered_map<string, float,
+			     hash<string>, equal_to<string>, 
+			     allocator<pair<const string, float> >, true>;
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multimap.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multimap.cc
index 9225d7974e97..73282612951f 100644
--- a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multimap.cc
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multimap.cc
@@ -1,6 +1,6 @@
 // { dg-do compile }
 
-// 2005-2-17  Matt Austern  <austern@apple.com>
+// 2005-02-17  Matt Austern  <austern@apple.com>
 //
 // Copyright (C) 2005 Free Software Foundation, Inc.
 //
@@ -25,13 +25,10 @@
 #include <string>
 #include <tr1/unordered_map>
 
-int main()
-{
-  using namespace std;
-  using namespace std::tr1;
+using namespace std;
+using namespace std::tr1;
 
-  unordered_multimap<string, float> m1;
-  unordered_multimap<string, float,
-                     hash<string>, equal_to<string>, 
-                     allocator<pair<const string, float> >, true> s2;
-}
+template class unordered_multimap<string, float>;
+template class unordered_multimap<string, float,
+				  hash<string>, equal_to<string>, 
+				  allocator<pair<const string, float> >, true>;
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multiset.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multiset.cc
index ce138c340bb2..e022e8bd8561 100644
--- a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multiset.cc
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multiset.cc
@@ -1,6 +1,6 @@
 // { dg-do compile }
 
-// 2005-2-17  Matt Austern  <austern@apple.com>
+// 2005-02-17  Matt Austern  <austern@apple.com>
 //
 // Copyright (C) 2005 Free Software Foundation, Inc.
 //
@@ -24,11 +24,9 @@
 
 #include <tr1/unordered_set>
 
-int main()
-{
-  using namespace std;
-  using namespace std::tr1;
+using namespace std;
+using namespace std::tr1;
 
-  unordered_multiset<int> s1;
-  unordered_multiset<int, hash<int>, equal_to<int>, allocator<int>, true> s2;
-}
+template class unordered_multiset<int>;
+template class unordered_multiset<int, hash<int>, equal_to<int>,
+				  allocator<int>, true>;
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/set.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/set.cc
index 32bde7165f59..9bb892eccd64 100644
--- a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/set.cc
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/set.cc
@@ -1,6 +1,6 @@
 // { dg-do compile }
 
-// 2005-2-17  Matt Austern  <austern@apple.com>
+// 2005-02-17  Matt Austern  <austern@apple.com>
 //
 // Copyright (C) 2005 Free Software Foundation, Inc.
 //
@@ -24,11 +24,9 @@
 
 #include <tr1/unordered_set>
 
-int main()
-{
-  using namespace std;
-  using namespace std::tr1;
+using namespace std;
+using namespace std::tr1;
 
-  unordered_set<int> s1;
-  unordered_set<int, hash<int>, equal_to<int>, allocator<int>, true> s2;
-}
+template class unordered_set<int>;
+template class unordered_set<int, hash<int>, equal_to<int>,
+			     allocator<int>, true>;
-- 
GitLab