patches/gcc/4.0.0/pr21951.patch
changeset 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/4.0.0/pr21951.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,153 @@
     1.4 +Workaround for buglet in std::vector etc. when compiling 
     1.5 +with gcc-4.0.0 -Wall -O -fno-exceptions
     1.6 +Fixes:
     1.7 +
     1.8 +.../include/c++/4.0.0/bits/vector.tcc: In member function 'void std::vector<_Tp,
     1.9 +_Alloc>::reserve(size_t) [with _Tp = int, _Alloc = std::allocator<int>]':
    1.10 +.../include/c++/4.0.0/bits/vector.tcc:78: warning: control may reach end of
    1.11 +non-void function 'typename _Alloc::pointer std::vector<_Tp,
    1.12 +_Alloc>::_M_allocate_and_copy(size_t, _ForwardIterator, _ForwardIterator) [with
    1.13 +_ForwardIterator = int*, _Tp = int, _Alloc = std::allocator<int>]' being inlined
    1.14 +
    1.15 +See http://gcc.gnu.org/PR21951
    1.16 +
    1.17 +--- gcc-4.0.1-20050607/libstdc++-v3/include/bits/stl_vector.h.old	2005-06-11 03:58:20.000000000 -0700
    1.18 ++++ gcc-4.0.1-20050607/libstdc++-v3/include/bits/stl_vector.h	2005-06-11 04:01:21.000000000 -0700
    1.19 +@@ -765,13 +765,13 @@
    1.20 + 	    {
    1.21 + 	      std::__uninitialized_copy_a(__first, __last, __result,
    1.22 + 					  this->get_allocator());
    1.23 +-	      return __result;
    1.24 + 	    }
    1.25 + 	  catch(...)
    1.26 + 	    {
    1.27 + 	      _M_deallocate(__result, __n);
    1.28 + 	      __throw_exception_again;
    1.29 + 	    }
    1.30 ++	  return __result;
    1.31 + 	}
    1.32 + 
    1.33 + 
    1.34 +--- gcc-4.0.1-20050607/libstdc++-v3/include/bits/stl_uninitialized.h.old	2005-06-11 03:58:20.000000000 -0700
    1.35 ++++ gcc-4.0.1-20050607/libstdc++-v3/include/bits/stl_uninitialized.h	2005-06-11 04:05:18.990003248 -0700
    1.36 +@@ -84,13 +84,13 @@
    1.37 + 	{
    1.38 + 	  for (; __first != __last; ++__first, ++__cur)
    1.39 + 	    std::_Construct(&*__cur, *__first);
    1.40 +-	  return __cur;
    1.41 + 	}
    1.42 +       catch(...)
    1.43 + 	{
    1.44 + 	  std::_Destroy(__result, __cur);
    1.45 + 	  __throw_exception_again;
    1.46 + 	}
    1.47 ++      return __cur;
    1.48 +     }
    1.49 + 
    1.50 +   /**
    1.51 +@@ -236,13 +236,13 @@
    1.52 + 	{
    1.53 + 	  for (; __first != __last; ++__first, ++__cur)
    1.54 + 	    __alloc.construct(&*__cur, *__first);
    1.55 +-	  return __cur;
    1.56 + 	}
    1.57 +       catch(...)
    1.58 + 	{
    1.59 + 	  std::_Destroy(__result, __cur, __alloc);
    1.60 + 	  __throw_exception_again;
    1.61 + 	}
    1.62 ++      return __cur;
    1.63 +     }
    1.64 + 
    1.65 +   template<typename _InputIterator, typename _ForwardIterator, typename _Tp>
    1.66 +@@ -337,11 +337,13 @@
    1.67 + 	{
    1.68 + 	  return std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc);
    1.69 + 	}
    1.70 ++#ifdef __EXCEPTIONS  // work around http://gcc.gnu.org/PR21951 in gcc-4.0 only
    1.71 +       catch(...)
    1.72 + 	{
    1.73 + 	  std::_Destroy(__result, __mid, __alloc);
    1.74 + 	  __throw_exception_again;
    1.75 + 	}
    1.76 ++#endif
    1.77 +     }
    1.78 + 
    1.79 +   // __uninitialized_fill_copy
    1.80 +@@ -360,11 +362,13 @@
    1.81 + 	{
    1.82 + 	  return std::__uninitialized_copy_a(__first, __last, __mid, __alloc);
    1.83 + 	}
    1.84 ++#ifdef __EXCEPTIONS  // work around http://gcc.gnu.org/PR21951 in gcc-4.0 only
    1.85 +       catch(...)
    1.86 + 	{
    1.87 + 	  std::_Destroy(__result, __mid, __alloc);
    1.88 + 	  __throw_exception_again;
    1.89 + 	}
    1.90 ++#endif
    1.91 +     }
    1.92 + 
    1.93 +   // __uninitialized_copy_fill
    1.94 +--- gcc-4.0.1-20050607/libstdc++-v3/include/ext/rope.old	2005-06-11 03:58:20.000000000 -0700
    1.95 ++++ gcc-4.0.1-20050607/libstdc++-v3/include/ext/rope	2005-06-11 04:13:26.628870872 -0700
    1.96 +@@ -1645,11 +1645,13 @@
    1.97 + 	_S_cond_store_eos(__buf[__size]);
    1.98 + 	try
    1.99 + 	  { return _S_new_RopeLeaf(__buf, __size, __a); }
   1.100 ++#ifdef __EXCEPTIONS  // work around http://gcc.gnu.org/PR21951 in gcc-4.0 only
   1.101 + 	catch(...)
   1.102 + 	  {
   1.103 + 	    _RopeRep::__STL_FREE_STRING(__buf, __size, __a);
   1.104 + 	    __throw_exception_again;
   1.105 + 	  }
   1.106 ++#endif
   1.107 +       }
   1.108 + 
   1.109 +       // Concatenation of nonempty strings.
   1.110 +--- gcc-4.0.1-20050607/libstdc++-v3/include/ext/memory.old	2005-06-11 03:58:20.000000000 -0700
   1.111 ++++ gcc-4.0.1-20050607/libstdc++-v3/include/ext/memory	2005-06-11 04:13:52.897877376 -0700
   1.112 +@@ -85,11 +85,13 @@
   1.113 + 	    std::_Construct(&*__cur, *__first);
   1.114 + 	  return pair<_InputIter, _ForwardIter>(__first, __cur);
   1.115 + 	}
   1.116 ++#ifdef __EXCEPTIONS  // work around http://gcc.gnu.org/PR21951 in gcc-4.0 only
   1.117 +       catch(...)
   1.118 + 	{
   1.119 + 	  std::_Destroy(__result, __cur);
   1.120 + 	  __throw_exception_again;
   1.121 + 	}
   1.122 ++#endif
   1.123 +     }
   1.124 + 
   1.125 +   template<typename _RandomAccessIter, typename _Size, typename _ForwardIter>
   1.126 +@@ -144,11 +146,13 @@
   1.127 + 	    __alloc.construct(&*__cur, *__first);
   1.128 + 	  return pair<_InputIter, _ForwardIter>(__first, __cur);
   1.129 + 	}
   1.130 ++#ifdef __EXCEPTIONS  // work around http://gcc.gnu.org/PR21951 in gcc-4.0 only
   1.131 +       catch(...)
   1.132 + 	{
   1.133 + 	  std::_Destroy(__result, __cur, __alloc);
   1.134 + 	  __throw_exception_again;
   1.135 + 	}
   1.136 ++#endif
   1.137 +     }
   1.138 + 
   1.139 +   template<typename _InputIter, typename _Size, typename _ForwardIter,
   1.140 +--- gcc-4.0.1-20050607/libstdc++-v3/include/ext/hashtable.h.old	2005-06-11 03:58:20.000000000 -0700
   1.141 ++++ gcc-4.0.1-20050607/libstdc++-v3/include/ext/hashtable.h	2005-06-11 04:14:28.384482592 -0700
   1.142 +@@ -607,13 +607,13 @@
   1.143 + 	try
   1.144 + 	  {
   1.145 + 	    this->get_allocator().construct(&__n->_M_val, __obj);
   1.146 +-	    return __n;
   1.147 + 	  }
   1.148 + 	catch(...)
   1.149 + 	  {
   1.150 + 	    _M_put_node(__n);
   1.151 + 	    __throw_exception_again;
   1.152 + 	  }
   1.153 ++	return __n;
   1.154 +       }
   1.155 + 
   1.156 +       void