patches/gcc/4.0.0/150-pr21951.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon May 25 17:22:54 2009 +0000 (2009-05-25)
branchgcc-4.4
changeset 1382 b3b1369752ba
permissions -rw-r--r--
/devel/gcc-4.4:
- TODO: add new item

-------- diffstat follows --------
/devel/gcc-4.4/TODO | 1 1 0 0 +
1 file changed, 1 insertion(+)
     1 Workaround for buglet in std::vector etc. when compiling 
     2 with gcc-4.0.0 -Wall -O -fno-exceptions
     3 Fixes:
     4 
     5 .../include/c++/4.0.0/bits/vector.tcc: In member function 'void std::vector<_Tp,
     6 _Alloc>::reserve(size_t) [with _Tp = int, _Alloc = std::allocator<int>]':
     7 .../include/c++/4.0.0/bits/vector.tcc:78: warning: control may reach end of
     8 non-void function 'typename _Alloc::pointer std::vector<_Tp,
     9 _Alloc>::_M_allocate_and_copy(size_t, _ForwardIterator, _ForwardIterator) [with
    10 _ForwardIterator = int*, _Tp = int, _Alloc = std::allocator<int>]' being inlined
    11 
    12 See http://gcc.gnu.org/PR21951
    13 
    14 --- gcc-4.0.1-20050607/libstdc++-v3/include/bits/stl_vector.h.old	2005-06-11 03:58:20.000000000 -0700
    15 +++ gcc-4.0.1-20050607/libstdc++-v3/include/bits/stl_vector.h	2005-06-11 04:01:21.000000000 -0700
    16 @@ -765,13 +765,13 @@
    17  	    {
    18  	      std::__uninitialized_copy_a(__first, __last, __result,
    19  					  this->get_allocator());
    20 -	      return __result;
    21  	    }
    22  	  catch(...)
    23  	    {
    24  	      _M_deallocate(__result, __n);
    25  	      __throw_exception_again;
    26  	    }
    27 +	  return __result;
    28  	}
    29  
    30  
    31 --- gcc-4.0.1-20050607/libstdc++-v3/include/bits/stl_uninitialized.h.old	2005-06-11 03:58:20.000000000 -0700
    32 +++ gcc-4.0.1-20050607/libstdc++-v3/include/bits/stl_uninitialized.h	2005-06-11 04:05:18.990003248 -0700
    33 @@ -84,13 +84,13 @@
    34  	{
    35  	  for (; __first != __last; ++__first, ++__cur)
    36  	    std::_Construct(&*__cur, *__first);
    37 -	  return __cur;
    38  	}
    39        catch(...)
    40  	{
    41  	  std::_Destroy(__result, __cur);
    42  	  __throw_exception_again;
    43  	}
    44 +      return __cur;
    45      }
    46  
    47    /**
    48 @@ -236,13 +236,13 @@
    49  	{
    50  	  for (; __first != __last; ++__first, ++__cur)
    51  	    __alloc.construct(&*__cur, *__first);
    52 -	  return __cur;
    53  	}
    54        catch(...)
    55  	{
    56  	  std::_Destroy(__result, __cur, __alloc);
    57  	  __throw_exception_again;
    58  	}
    59 +      return __cur;
    60      }
    61  
    62    template<typename _InputIterator, typename _ForwardIterator, typename _Tp>
    63 @@ -337,11 +337,13 @@
    64  	{
    65  	  return std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc);
    66  	}
    67 +#ifdef __EXCEPTIONS  // work around http://gcc.gnu.org/PR21951 in gcc-4.0 only
    68        catch(...)
    69  	{
    70  	  std::_Destroy(__result, __mid, __alloc);
    71  	  __throw_exception_again;
    72  	}
    73 +#endif
    74      }
    75  
    76    // __uninitialized_fill_copy
    77 @@ -360,11 +362,13 @@
    78  	{
    79  	  return std::__uninitialized_copy_a(__first, __last, __mid, __alloc);
    80  	}
    81 +#ifdef __EXCEPTIONS  // work around http://gcc.gnu.org/PR21951 in gcc-4.0 only
    82        catch(...)
    83  	{
    84  	  std::_Destroy(__result, __mid, __alloc);
    85  	  __throw_exception_again;
    86  	}
    87 +#endif
    88      }
    89  
    90    // __uninitialized_copy_fill
    91 --- gcc-4.0.1-20050607/libstdc++-v3/include/ext/rope.old	2005-06-11 03:58:20.000000000 -0700
    92 +++ gcc-4.0.1-20050607/libstdc++-v3/include/ext/rope	2005-06-11 04:13:26.628870872 -0700
    93 @@ -1645,11 +1645,13 @@
    94  	_S_cond_store_eos(__buf[__size]);
    95  	try
    96  	  { return _S_new_RopeLeaf(__buf, __size, __a); }
    97 +#ifdef __EXCEPTIONS  // work around http://gcc.gnu.org/PR21951 in gcc-4.0 only
    98  	catch(...)
    99  	  {
   100  	    _RopeRep::__STL_FREE_STRING(__buf, __size, __a);
   101  	    __throw_exception_again;
   102  	  }
   103 +#endif
   104        }
   105  
   106        // Concatenation of nonempty strings.
   107 --- gcc-4.0.1-20050607/libstdc++-v3/include/ext/memory.old	2005-06-11 03:58:20.000000000 -0700
   108 +++ gcc-4.0.1-20050607/libstdc++-v3/include/ext/memory	2005-06-11 04:13:52.897877376 -0700
   109 @@ -85,11 +85,13 @@
   110  	    std::_Construct(&*__cur, *__first);
   111  	  return pair<_InputIter, _ForwardIter>(__first, __cur);
   112  	}
   113 +#ifdef __EXCEPTIONS  // work around http://gcc.gnu.org/PR21951 in gcc-4.0 only
   114        catch(...)
   115  	{
   116  	  std::_Destroy(__result, __cur);
   117  	  __throw_exception_again;
   118  	}
   119 +#endif
   120      }
   121  
   122    template<typename _RandomAccessIter, typename _Size, typename _ForwardIter>
   123 @@ -144,11 +146,13 @@
   124  	    __alloc.construct(&*__cur, *__first);
   125  	  return pair<_InputIter, _ForwardIter>(__first, __cur);
   126  	}
   127 +#ifdef __EXCEPTIONS  // work around http://gcc.gnu.org/PR21951 in gcc-4.0 only
   128        catch(...)
   129  	{
   130  	  std::_Destroy(__result, __cur, __alloc);
   131  	  __throw_exception_again;
   132  	}
   133 +#endif
   134      }
   135  
   136    template<typename _InputIter, typename _Size, typename _ForwardIter,
   137 --- gcc-4.0.1-20050607/libstdc++-v3/include/ext/hashtable.h.old	2005-06-11 03:58:20.000000000 -0700
   138 +++ gcc-4.0.1-20050607/libstdc++-v3/include/ext/hashtable.h	2005-06-11 04:14:28.384482592 -0700
   139 @@ -607,13 +607,13 @@
   140  	try
   141  	  {
   142  	    this->get_allocator().construct(&__n->_M_val, __obj);
   143 -	    return __n;
   144  	  }
   145  	catch(...)
   146  	  {
   147  	    _M_put_node(__n);
   148  	    __throw_exception_again;
   149  	  }
   150 +	return __n;
   151        }
   152  
   153        void