This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

V3 PATCH: Use this-> in more places


I'm about to check in a fix for PR 11493 and PR 11495 that (as part of
the fix) implements even more of the new name lookup rules.

In particular, this kind of thing:

  template <typename T> void f() { g(); }

will no longer compile.  

That's also true in the case of:

 template <typename T> struct B { void f(int); };
 template <typename T> struct D : public B { void g() { f(3); } };

The call to "f" is invalid because there are no dependent arguments,
so "f" is looked up at parse time.  The right way to right the latter
call is "this->f(3)".

This (boring) patch does that throughout the library.

Tested on i686-pc-linux-gnu, applied on the mainline.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2003-07-13  Mark Mitchell  <mark@codesourcery.com>

	* config/locale/generic/c_locale.h: Include <cstdlib> and
	<cstring>.
	* include/bits/boost_concept_check.h: Add this-> to unqualified
	method calls.
	* include/bits/deque.tcc: Likewise.
	* include/bits/locale_facets.h : Likewise.
	* include/bits/ostream.tcc: Likewise.
	* include/bits/stl_algo.h: Likewise.
	* include/bits/stl_bvector.h: Likewise.
	* include/bits/stl_deque.h: Likewise.
	* include/bits/stl_list.h: Likewise.
	* include/bits/stl_tree.h: Likewise.
	* include/bits/stl_vector.h: Likewise.
	* include/bits/vector.tcc: Likewise.
	* include/ext/rope: Likewise.
	* include/ext/ropeimpl.h: Likewise.
	* include/ext/stdio_filebuf.h: Likewise.

Index: config/locale/generic/c_locale.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/generic/c_locale.h,v
retrieving revision 1.8
diff -c -5 -p -r1.8 c_locale.h
*** config/locale/generic/c_locale.h	5 Jul 2003 04:05:30 -0000	1.8
--- config/locale/generic/c_locale.h	14 Jul 2003 02:48:10 -0000
***************
*** 37,46 ****
--- 37,48 ----
  #define _C_LOCALE_H 1
  
  #pragma GCC system_header
  
  #include <clocale>
+ #include <cstdlib>
+ #include <cstring>
  
  #define _GLIBCXX_NUM_CATEGORIES 0
  
  namespace std
  {
Index: include/bits/boost_concept_check.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/boost_concept_check.h,v
retrieving revision 1.11
diff -c -5 -p -r1.11 boost_concept_check.h
*** include/bits/boost_concept_check.h	5 Jul 2003 04:05:34 -0000	1.11
--- include/bits/boost_concept_check.h	14 Jul 2003 02:48:10 -0000
*************** struct _Aux_require_same<_Tp,_Tp> { type
*** 86,96 ****
    };
  
    template <class _Tp>
    struct _IntegerConcept {
      void __constraints() { 
!       __error_type_must_be_an_integer_type();
      }
    };
    template <> struct _IntegerConcept<short> { void __constraints() {} };
    template <> struct _IntegerConcept<unsigned short> { void __constraints(){} };
    template <> struct _IntegerConcept<int> { void __constraints() {} };
--- 86,96 ----
    };
  
    template <class _Tp>
    struct _IntegerConcept {
      void __constraints() { 
!       this->__error_type_must_be_an_integer_type();
      }
    };
    template <> struct _IntegerConcept<short> { void __constraints() {} };
    template <> struct _IntegerConcept<unsigned short> { void __constraints(){} };
    template <> struct _IntegerConcept<int> { void __constraints() {} };
*************** struct _Aux_require_same<_Tp,_Tp> { type
*** 102,123 ****
                                                  { void __constraints() {} };
  
    template <class _Tp>
    struct _SignedIntegerConcept {
      void __constraints() { 
!       __error_type_must_be_a_signed_integer_type();
      }
    };
    template <> struct _SignedIntegerConcept<short> { void __constraints() {} };
    template <> struct _SignedIntegerConcept<int> { void __constraints() {} };
    template <> struct _SignedIntegerConcept<long> { void __constraints() {} };
    template <> struct _SignedIntegerConcept<long long> { void __constraints(){}};
  
    template <class _Tp>
    struct _UnsignedIntegerConcept {
      void __constraints() { 
!       __error_type_must_be_an_unsigned_integer_type();
      }
    };
    template <> struct _UnsignedIntegerConcept<unsigned short>
      { void __constraints() {} };
    template <> struct _UnsignedIntegerConcept<unsigned int>
--- 102,123 ----
                                                  { void __constraints() {} };
  
    template <class _Tp>
    struct _SignedIntegerConcept {
      void __constraints() { 
!       this->__error_type_must_be_a_signed_integer_type();
      }
    };
    template <> struct _SignedIntegerConcept<short> { void __constraints() {} };
    template <> struct _SignedIntegerConcept<int> { void __constraints() {} };
    template <> struct _SignedIntegerConcept<long> { void __constraints() {} };
    template <> struct _SignedIntegerConcept<long long> { void __constraints(){}};
  
    template <class _Tp>
    struct _UnsignedIntegerConcept {
      void __constraints() { 
!       this->__error_type_must_be_an_unsigned_integer_type();
      }
    };
    template <> struct _UnsignedIntegerConcept<unsigned short>
      { void __constraints() {} };
    template <> struct _UnsignedIntegerConcept<unsigned int>
Index: include/bits/deque.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/deque.tcc,v
retrieving revision 1.9
diff -c -5 -p -r1.9 deque.tcc
*** include/bits/deque.tcc	5 Jul 2003 04:05:34 -0000	1.9
--- include/bits/deque.tcc	14 Jul 2003 02:48:10 -0000
*************** namespace std
*** 266,276 ****
        void
        deque<_Tp,_Alloc>::
        _M_range_initialize(_InputIterator __first, _InputIterator __last,
                            input_iterator_tag)
        {
!         _M_initialize_map(0);
          try
            {
              for ( ; __first != __last; ++__first)
                push_back(*__first);
            }
--- 266,276 ----
        void
        deque<_Tp,_Alloc>::
        _M_range_initialize(_InputIterator __first, _InputIterator __last,
                            input_iterator_tag)
        {
!         this->_M_initialize_map(0);
          try
            {
              for ( ; __first != __last; ++__first)
                push_back(*__first);
            }
*************** namespace std
*** 287,297 ****
        deque<_Tp,_Alloc>::
        _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
                            forward_iterator_tag)
        {
          size_type __n = std::distance(__first, __last);
!         _M_initialize_map(__n);
        
          _Map_pointer __cur_node;
          try
            {
              for (__cur_node = this->_M_start._M_node; 
--- 287,297 ----
        deque<_Tp,_Alloc>::
        _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
                            forward_iterator_tag)
        {
          size_type __n = std::distance(__first, __last);
!         this->_M_initialize_map(__n);
        
          _Map_pointer __cur_node;
          try
            {
              for (__cur_node = this->_M_start._M_node; 
*************** namespace std
*** 318,328 ****
      deque<_Tp,_Alloc>::
      _M_push_back_aux(const value_type& __t)
      {
        value_type __t_copy = __t;
        _M_reserve_map_at_back();
!       *(this->_M_finish._M_node + 1) = _M_allocate_node();
        try
          {
            std::_Construct(this->_M_finish._M_cur, __t_copy);
            this->_M_finish._M_set_node(this->_M_finish._M_node + 1);
            this->_M_finish._M_cur = this->_M_finish._M_first;
--- 318,328 ----
      deque<_Tp,_Alloc>::
      _M_push_back_aux(const value_type& __t)
      {
        value_type __t_copy = __t;
        _M_reserve_map_at_back();
!       *(this->_M_finish._M_node + 1) = this->_M_allocate_node();
        try
          {
            std::_Construct(this->_M_finish._M_cur, __t_copy);
            this->_M_finish._M_set_node(this->_M_finish._M_node + 1);
            this->_M_finish._M_cur = this->_M_finish._M_first;
*************** namespace std
*** 340,350 ****
      deque<_Tp,_Alloc>::
      _M_push_front_aux(const value_type& __t)
      {
        value_type __t_copy = __t;
        _M_reserve_map_at_front();
!       *(this->_M_start._M_node - 1) = _M_allocate_node();
        try
          {
            this->_M_start._M_set_node(this->_M_start._M_node - 1);
            this->_M_start._M_cur = this->_M_start._M_last - 1;
            std::_Construct(this->_M_start._M_cur, __t_copy);
--- 340,350 ----
      deque<_Tp,_Alloc>::
      _M_push_front_aux(const value_type& __t)
      {
        value_type __t_copy = __t;
        _M_reserve_map_at_front();
!       *(this->_M_start._M_node - 1) = this->_M_allocate_node();
        try
          {
            this->_M_start._M_set_node(this->_M_start._M_node - 1);
            this->_M_start._M_cur = this->_M_start._M_last - 1;
            std::_Construct(this->_M_start._M_cur, __t_copy);
*************** namespace std
*** 629,639 ****
        _M_reserve_map_at_front(__new_nodes);
        size_type __i;
        try
          {
            for (__i = 1; __i <= __new_nodes; ++__i)
!             *(this->_M_start._M_node - __i) = _M_allocate_node();
          }
        catch(...)
          {
            for (size_type __j = 1; __j < __i; ++__j)
              _M_deallocate_node(*(this->_M_start._M_node - __j));      
--- 629,639 ----
        _M_reserve_map_at_front(__new_nodes);
        size_type __i;
        try
          {
            for (__i = 1; __i <= __new_nodes; ++__i)
!             *(this->_M_start._M_node - __i) = this->_M_allocate_node();
          }
        catch(...)
          {
            for (size_type __j = 1; __j < __i; ++__j)
              _M_deallocate_node(*(this->_M_start._M_node - __j));      
*************** namespace std
*** 651,661 ****
        _M_reserve_map_at_back(__new_nodes);
        size_type __i;
        try
          {
            for (__i = 1; __i <= __new_nodes; ++__i)
!             *(this->_M_finish._M_node + __i) = _M_allocate_node();
          }
        catch(...)
          {
            for (size_type __j = 1; __j < __i; ++__j)
              _M_deallocate_node(*(this->_M_finish._M_node + __j));      
--- 651,661 ----
        _M_reserve_map_at_back(__new_nodes);
        size_type __i;
        try
          {
            for (__i = 1; __i <= __new_nodes; ++__i)
!             *(this->_M_finish._M_node + __i) = this->_M_allocate_node();
          }
        catch(...)
          {
            for (size_type __j = 1; __j < __i; ++__j)
              _M_deallocate_node(*(this->_M_finish._M_node + __j));      
*************** namespace std
*** 690,700 ****
        else
        {
          size_type __new_map_size = 
            this->_M_map_size + std::max(this->_M_map_size, __nodes_to_add) + 2;
      
!         _Map_pointer __new_map = _M_allocate_map(__new_map_size);
          __new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2
                               + (__add_at_front ? __nodes_to_add : 0);
          std::copy(this->_M_start._M_node,
  		  this->_M_finish._M_node + 1,
  		  __new_nstart);
--- 690,700 ----
        else
        {
          size_type __new_map_size = 
            this->_M_map_size + std::max(this->_M_map_size, __nodes_to_add) + 2;
      
!         _Map_pointer __new_map = this->_M_allocate_map(__new_map_size);
          __new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2
                               + (__add_at_front ? __nodes_to_add : 0);
          std::copy(this->_M_start._M_node,
  		  this->_M_finish._M_node + 1,
  		  __new_nstart);
Index: include/bits/locale_facets.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/locale_facets.h,v
retrieving revision 1.61
diff -c -5 -p -r1.61 locale_facets.h
*** include/bits/locale_facets.h	10 Jul 2003 06:21:11 -0000	1.61
--- include/bits/locale_facets.h	14 Jul 2003 02:48:13 -0000
*************** namespace std
*** 771,788 ****
  
        explicit 
        numpunct_byname(const char* __s, size_t __refs = 0)
        : numpunct<_CharT>(__refs)
        {
! 	_S_create_c_locale(_M_c_locale_numpunct, __s);
! 	_M_initialize_numpunct(_M_c_locale_numpunct);	
        }
  
      protected:
        virtual 
        ~numpunct_byname() 
!       { _S_destroy_c_locale(_M_c_locale_numpunct); }
      };
  
    template<typename _CharT, typename _InIter>
      class num_get : public locale::facet, public __num_base
      {
--- 771,788 ----
  
        explicit 
        numpunct_byname(const char* __s, size_t __refs = 0)
        : numpunct<_CharT>(__refs)
        {
! 	this->_S_create_c_locale(_M_c_locale_numpunct, __s);
! 	this->_M_initialize_numpunct(_M_c_locale_numpunct);	
        }
  
      protected:
        virtual 
        ~numpunct_byname() 
!       { this->_S_destroy_c_locale(_M_c_locale_numpunct); }
      };
  
    template<typename _CharT, typename _InIter>
      class num_get : public locale::facet, public __num_base
      {
*************** namespace std
*** 1132,1143 ****
  
        explicit 
        collate_byname(const char* __s, size_t __refs = 0)
        : collate<_CharT>(__refs) 
        { 
! 	_S_destroy_c_locale(this->_M_c_locale_collate);
! 	_S_create_c_locale(this->_M_c_locale_collate, __s); 
        }
  
      protected:
        virtual   
        ~collate_byname() { }
--- 1132,1143 ----
  
        explicit 
        collate_byname(const char* __s, size_t __refs = 0)
        : collate<_CharT>(__refs) 
        { 
! 	this->_S_destroy_c_locale(this->_M_c_locale_collate);
! 	this->_S_create_c_locale(this->_M_c_locale_collate, __s); 
        }
  
      protected:
        virtual   
        ~collate_byname() { }
*************** namespace std
*** 1715,1732 ****
  
        explicit 
        moneypunct_byname(const char* __s, size_t __refs = 0)
        : moneypunct<_CharT, _Intl>(__refs)
        {
! 	_S_create_c_locale(_M_c_locale_moneypunct, __s);
! 	_M_initialize_moneypunct(_M_c_locale_moneypunct);	
        }
  
      protected:
        virtual 
        ~moneypunct_byname() 
!       { _S_destroy_c_locale(_M_c_locale_moneypunct); }
      };
  
    template<typename _CharT, bool _Intl>
      const bool moneypunct_byname<_CharT, _Intl>::intl;
  
--- 1715,1732 ----
  
        explicit 
        moneypunct_byname(const char* __s, size_t __refs = 0)
        : moneypunct<_CharT, _Intl>(__refs)
        {
! 	this->_S_create_c_locale(_M_c_locale_moneypunct, __s);
! 	this->_M_initialize_moneypunct(_M_c_locale_moneypunct);	
        }
  
      protected:
        virtual 
        ~moneypunct_byname() 
!       { this->_S_destroy_c_locale(_M_c_locale_moneypunct); }
      };
  
    template<typename _CharT, bool _Intl>
      const bool moneypunct_byname<_CharT, _Intl>::intl;
  
Index: include/bits/ostream.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/ostream.tcc,v
retrieving revision 1.41
diff -c -5 -p -r1.41 ostream.tcc
*** include/bits/ostream.tcc	5 Jul 2003 04:05:35 -0000	1.41
--- include/bits/ostream.tcc	14 Jul 2003 02:48:13 -0000
*************** namespace std 
*** 385,395 ****
      basic_ostream<_CharT, _Traits>::put(char_type __c)
      { 
        sentry __cerb(*this);
        if (__cerb) 
  	{
! 	  int_type __put = rdbuf()->sputc(__c); 
  	  if (traits_type::eq_int_type(__put, traits_type::eof()))
  	    this->setstate(ios_base::badbit);
  	}
        return *this;  
      }
--- 385,395 ----
      basic_ostream<_CharT, _Traits>::put(char_type __c)
      { 
        sentry __cerb(*this);
        if (__cerb) 
  	{
! 	  int_type __put = this->rdbuf()->sputc(__c); 
  	  if (traits_type::eq_int_type(__put, traits_type::eof()))
  	    this->setstate(ios_base::badbit);
  	}
        return *this;  
      }
Index: include/bits/stl_algo.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_algo.h,v
retrieving revision 1.33
diff -c -5 -p -r1.33 stl_algo.h
*** include/bits/stl_algo.h	5 Jul 2003 04:05:35 -0000	1.33
--- include/bits/stl_algo.h	14 Jul 2003 02:48:14 -0000
*************** namespace std
*** 944,954 ****
      generate_n(_OutputIterator __first, _Size __n, _Generator __gen)
      {
        // concept requirements
        __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
              // "the type returned by a _Generator"
!             __typeof__(gen())>)
  
        for ( ; __n > 0; --__n, ++__first)
  	*__first = __gen();
        return __first;
      }
--- 944,954 ----
      generate_n(_OutputIterator __first, _Size __n, _Generator __gen)
      {
        // concept requirements
        __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
              // "the type returned by a _Generator"
!             __typeof__(__gen())>)
  
        for ( ; __n > 0; --__n, ++__first)
  	*__first = __gen();
        return __first;
      }
Index: include/bits/stl_bvector.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_bvector.h,v
retrieving revision 1.27
diff -c -5 -p -r1.27 stl_bvector.h
*** include/bits/stl_bvector.h	5 Jul 2003 04:05:35 -0000	1.27
--- include/bits/stl_bvector.h	14 Jul 2003 02:48:14 -0000
*************** template <typename _Alloc> 
*** 371,381 ****
      using _Bvector_base<_Alloc>::_M_finish;
      using _Bvector_base<_Alloc>::_M_end_of_storage;
    
    protected:
      void _M_initialize(size_type __n) {
!       _Bit_type * __q = _M_bit_alloc(__n);
        this->_M_end_of_storage = __q + (__n + _S_word_bit - 1)/_S_word_bit;
        this->_M_start = iterator(__q, 0);
        this->_M_finish = this->_M_start + difference_type(__n);
      }
      void _M_insert_aux(iterator __position, bool __x) {
--- 371,381 ----
      using _Bvector_base<_Alloc>::_M_finish;
      using _Bvector_base<_Alloc>::_M_end_of_storage;
    
    protected:
      void _M_initialize(size_type __n) {
!       _Bit_type * __q = this->_M_bit_alloc(__n);
        this->_M_end_of_storage = __q + (__n + _S_word_bit - 1)/_S_word_bit;
        this->_M_start = iterator(__q, 0);
        this->_M_finish = this->_M_start + difference_type(__n);
      }
      void _M_insert_aux(iterator __position, bool __x) {
*************** template <typename _Alloc> 
*** 385,399 ****
          ++this->_M_finish;
        }
        else {
          size_type __len = size() 
  	                  ? 2 * size() : static_cast<size_type>(_S_word_bit);
!         _Bit_type * __q = _M_bit_alloc(__len);
          iterator __i = std::copy(begin(), __position, iterator(__q, 0));
          *__i++ = __x;
          this->_M_finish = std::copy(__position, end(), __i);
!         _M_deallocate();
          this->_M_end_of_storage = __q + (__len + _S_word_bit - 1)/_S_word_bit;
          this->_M_start = iterator(__q, 0);
        }
      }
    
--- 385,399 ----
          ++this->_M_finish;
        }
        else {
          size_type __len = size() 
  	                  ? 2 * size() : static_cast<size_type>(_S_word_bit);
!         _Bit_type * __q = this->_M_bit_alloc(__len);
          iterator __i = std::copy(begin(), __position, iterator(__q, 0));
          *__i++ = __x;
          this->_M_finish = std::copy(__position, end(), __i);
!         this->_M_deallocate();
          this->_M_end_of_storage = __q + (__len + _S_word_bit - 1)/_S_word_bit;
          this->_M_start = iterator(__q, 0);
        }
      }
    
*************** template <typename _Alloc> 
*** 437,451 ****
            std::copy(__first, __last, __position);
            this->_M_finish += difference_type(__n);
          }
          else {
            size_type __len = size() + std::max(size(), __n);
!           _Bit_type * __q = _M_bit_alloc(__len);
            iterator __i = std::copy(begin(), __position, iterator(__q, 0));
            __i = std::copy(__first, __last, __i);
            this->_M_finish = std::copy(__position, end(), __i);
!           _M_deallocate();
            this->_M_end_of_storage
  	    = __q + (__len + _S_word_bit - 1)/_S_word_bit;
            this->_M_start = iterator(__q, 0);
          }
        }
--- 437,451 ----
            std::copy(__first, __last, __position);
            this->_M_finish += difference_type(__n);
          }
          else {
            size_type __len = size() + std::max(size(), __n);
!           _Bit_type * __q = this->_M_bit_alloc(__len);
            iterator __i = std::copy(begin(), __position, iterator(__q, 0));
            __i = std::copy(__first, __last, __i);
            this->_M_finish = std::copy(__position, end(), __i);
!           this->_M_deallocate();
            this->_M_end_of_storage
  	    = __q + (__len + _S_word_bit - 1)/_S_word_bit;
            this->_M_start = iterator(__q, 0);
          }
        }
*************** template <typename _Alloc> 
*** 537,547 ****
      ~vector() { }
    
      vector& operator=(const vector& __x) {
        if (&__x == this) return *this;
        if (__x.size() > capacity()) {
!         _M_deallocate();
          _M_initialize(__x.size());
        }
        std::copy(__x.begin(), __x.end(), begin());
        this->_M_finish = begin() + difference_type(__x.size());
        return *this;
--- 537,547 ----
      ~vector() { }
    
      vector& operator=(const vector& __x) {
        if (&__x == this) return *this;
        if (__x.size() > capacity()) {
!         this->_M_deallocate();
          _M_initialize(__x.size());
        }
        std::copy(__x.begin(), __x.end(), begin());
        this->_M_finish = begin() + difference_type(__x.size());
        return *this;
*************** template <typename _Alloc> 
*** 607,619 ****
    
      void reserve(size_type __n) {
        if (__n > this->max_size())
  	__throw_length_error(__N("vector::reserve"));
        if (this->capacity() < __n) {
!         _Bit_type * __q = _M_bit_alloc(__n);
          this->_M_finish = std::copy(begin(), end(), iterator(__q, 0));
!         _M_deallocate();
          this->_M_start = iterator(__q, 0);
          this->_M_end_of_storage = __q + (__n + _S_word_bit - 1)/_S_word_bit;
        }
      }
    
--- 607,619 ----
    
      void reserve(size_type __n) {
        if (__n > this->max_size())
  	__throw_length_error(__N("vector::reserve"));
        if (this->capacity() < __n) {
!         _Bit_type * __q = this->_M_bit_alloc(__n);
          this->_M_finish = std::copy(begin(), end(), iterator(__q, 0));
!         this->_M_deallocate();
          this->_M_start = iterator(__q, 0);
          this->_M_end_of_storage = __q + (__n + _S_word_bit - 1)/_S_word_bit;
        }
      }
    
*************** template <typename _Alloc> 
*** 680,694 ****
          std::fill(__position, __position + difference_type(__n), __x);
          this->_M_finish += difference_type(__n);
        }
        else {
          size_type __len = size() + std::max(size(), __n);
!         _Bit_type * __q = _M_bit_alloc(__len);
          iterator __i = std::copy(begin(), __position, iterator(__q, 0));
          std::fill_n(__i, __n, __x);
          this->_M_finish = std::copy(__position, end(), __i + difference_type(__n));
!         _M_deallocate();
          this->_M_end_of_storage = __q + (__len + _S_word_bit - 1)/_S_word_bit;
          this->_M_start = iterator(__q, 0);
        }
      }
    
--- 680,694 ----
          std::fill(__position, __position + difference_type(__n), __x);
          this->_M_finish += difference_type(__n);
        }
        else {
          size_type __len = size() + std::max(size(), __n);
!         _Bit_type * __q = this->_M_bit_alloc(__len);
          iterator __i = std::copy(begin(), __position, iterator(__q, 0));
          std::fill_n(__i, __n, __x);
          this->_M_finish = std::copy(__position, end(), __i + difference_type(__n));
!         this->_M_deallocate();
          this->_M_end_of_storage = __q + (__len + _S_word_bit - 1)/_S_word_bit;
          this->_M_start = iterator(__q, 0);
        }
      }
    
Index: include/bits/stl_deque.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_deque.h,v
retrieving revision 1.41
diff -c -5 -p -r1.41 stl_deque.h
*** include/bits/stl_deque.h	5 Jul 2003 04:05:35 -0000	1.41
--- include/bits/stl_deque.h	14 Jul 2003 02:48:15 -0000
*************** namespace std
*** 530,540 ****
    {
      _Tp** __cur;
      try
        {
          for (__cur = __nstart; __cur < __nfinish; ++__cur)
!           *__cur = _M_allocate_node();
        }
      catch(...)
        { 
          _M_destroy_nodes(__nstart, __cur);
          __throw_exception_again; 
--- 530,540 ----
    {
      _Tp** __cur;
      try
        {
          for (__cur = __nstart; __cur < __nfinish; ++__cur)
!           *__cur = this->_M_allocate_node();
        }
      catch(...)
        { 
          _M_destroy_nodes(__nstart, __cur);
          __throw_exception_again; 
Index: include/bits/stl_list.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_list.h,v
retrieving revision 1.28
diff -c -5 -p -r1.28 stl_list.h
*** include/bits/stl_list.h	6 Jul 2003 00:58:52 -0000	1.28
--- include/bits/stl_list.h	14 Jul 2003 02:48:17 -0000
*************** namespace std
*** 404,414 ****
       *  @endif
      */
      _Node*
      _M_create_node(const value_type& __x)
      {
!       _Node* __p = _M_get_node();
        try {
          std::_Construct(&__p->_M_data, __x);
        }
        catch(...)
        {
--- 404,414 ----
       *  @endif
      */
      _Node*
      _M_create_node(const value_type& __x)
      {
!       _Node* __p = this->_M_get_node();
        try {
          std::_Construct(&__p->_M_data, __x);
        }
        catch(...)
        {
*************** namespace std
*** 425,435 ****
       *  @endif
      */
      _Node*
      _M_create_node()
      {
!       _Node* __p = _M_get_node();
        try {
          std::_Construct(&__p->_M_data);
        }
        catch(...)
        {
--- 425,435 ----
       *  @endif
      */
      _Node*
      _M_create_node()
      {
!       _Node* __p = this->_M_get_node();
        try {
          std::_Construct(&__p->_M_data);
        }
        catch(...)
        {
Index: include/bits/stl_tree.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_tree.h,v
retrieving revision 1.26
diff -c -5 -p -r1.26 stl_tree.h
*** include/bits/stl_tree.h	9 Jul 2003 20:58:32 -0000	1.26
--- include/bits/stl_tree.h	14 Jul 2003 02:48:17 -0000
*************** namespace std
*** 334,344 ****
        using _Base::_M_header;
        
        _Link_type
        _M_create_node(const value_type& __x)
        {
! 	_Link_type __tmp = _M_get_node();
  	try 
  	  { std::_Construct(&__tmp->_M_value_field, __x); }
  	catch(...)
  	  {
  	  _M_put_node(__tmp);
--- 334,344 ----
        using _Base::_M_header;
        
        _Link_type
        _M_create_node(const value_type& __x)
        {
! 	_Link_type __tmp = this->_M_get_node();
  	try 
  	  { std::_Construct(&__tmp->_M_value_field, __x); }
  	catch(...)
  	  {
  	  _M_put_node(__tmp);
Index: include/bits/stl_vector.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_vector.h,v
retrieving revision 1.39
diff -c -5 -p -r1.39 stl_vector.h
*** include/bits/stl_vector.h	5 Jul 2003 04:05:35 -0000	1.39
--- include/bits/stl_vector.h	14 Jul 2003 02:48:17 -0000
*************** namespace std
*** 151,161 ****
        : _Base(__a) { }
        
        _Vector_base(size_t __n, const allocator_type& __a)
        : _Base(__a)
        {
! 	this->_M_start = _M_allocate(__n);
  	this->_M_finish = this->_M_start;
  	this->_M_end_of_storage = this->_M_start + __n;
        }
        
        ~_Vector_base() 
--- 151,161 ----
        : _Base(__a) { }
        
        _Vector_base(size_t __n, const allocator_type& __a)
        : _Base(__a)
        {
! 	this->_M_start = this->_M_allocate(__n);
  	this->_M_finish = this->_M_start;
  	this->_M_end_of_storage = this->_M_start + __n;
        }
        
        ~_Vector_base() 
*************** namespace std
*** 751,761 ****
        template<typename _ForwardIterator>
          pointer
          _M_allocate_and_copy(size_type __n,
  			     _ForwardIterator __first, _ForwardIterator __last)
          {
! 	  pointer __result = _M_allocate(__n);
  	  try
  	    {
  	      std::uninitialized_copy(__first, __last, __result);
  	      return __result;
  	    }
--- 751,761 ----
        template<typename _ForwardIterator>
          pointer
          _M_allocate_and_copy(size_type __n,
  			     _ForwardIterator __first, _ForwardIterator __last)
          {
! 	  pointer __result = this->_M_allocate(__n);
  	  try
  	    {
  	      std::uninitialized_copy(__first, __last, __result);
  	      return __result;
  	    }
*************** namespace std
*** 805,815 ****
          void 
          _M_range_initialize(_ForwardIterator __first,
  			    _ForwardIterator __last, forward_iterator_tag)
          {
  	  size_type __n = std::distance(__first, __last);
! 	  this->_M_start = _M_allocate(__n);
  	  this->_M_end_of_storage = this->_M_start + __n;
  	  this->_M_finish = std::uninitialized_copy(__first, __last,
  						    this->_M_start);
  	}
        
--- 805,815 ----
          void 
          _M_range_initialize(_ForwardIterator __first,
  			    _ForwardIterator __last, forward_iterator_tag)
          {
  	  size_type __n = std::distance(__first, __last);
! 	  this->_M_start = this->_M_allocate(__n);
  	  this->_M_end_of_storage = this->_M_start + __n;
  	  this->_M_finish = std::uninitialized_copy(__first, __last,
  						    this->_M_start);
  	}
        
Index: include/bits/vector.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/vector.tcc,v
retrieving revision 1.9
diff -c -5 -p -r1.9 vector.tcc
*** include/bits/vector.tcc	5 Jul 2003 04:05:36 -0000	1.9
--- include/bits/vector.tcc	14 Jul 2003 02:48:18 -0000
*************** namespace std
*** 239,249 ****
        }
        else
        {
          const size_type __old_size = size();
          const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
!         iterator __new_start(_M_allocate(__len));
          iterator __new_finish(__new_start);
          try
            {
              __new_finish = std::uninitialized_copy(iterator(this->_M_start),
  						   __position,
--- 239,249 ----
        }
        else
        {
          const size_type __old_size = size();
          const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
!         iterator __new_start(this->_M_allocate(__len));
          iterator __new_finish(__new_start);
          try
            {
              __new_finish = std::uninitialized_copy(iterator(this->_M_start),
  						   __position,
*************** namespace std
*** 347,357 ****
  	  }
          else
  	  {
  	    const size_type __old_size = size();
  	    const size_type __len = __old_size + std::max(__old_size, __n);
! 	    iterator __new_start(_M_allocate(__len));
  	    iterator __new_finish(__new_start);
  	    try
  	      {
  		__new_finish = std::uninitialized_copy(begin(), __position,
  						       __new_start);
--- 347,357 ----
  	  }
          else
  	  {
  	    const size_type __old_size = size();
  	    const size_type __len = __old_size + std::max(__old_size, __n);
! 	    iterator __new_start(this->_M_allocate(__len));
  	    iterator __new_finish(__new_start);
  	    try
  	      {
  		__new_finish = std::uninitialized_copy(begin(), __position,
  						       __new_start);
*************** namespace std
*** 424,434 ****
          }
          else
          {
            const size_type __old_size = size();
            const size_type __len = __old_size + std::max(__old_size, __n);
!           iterator __new_start(_M_allocate(__len));
            iterator __new_finish(__new_start);
            try
              {
                __new_finish = std::uninitialized_copy(iterator(this->_M_start),
  						     __position, __new_start);
--- 424,434 ----
          }
          else
          {
            const size_type __old_size = size();
            const size_type __len = __old_size + std::max(__old_size, __n);
!           iterator __new_start(this->_M_allocate(__len));
            iterator __new_finish(__new_start);
            try
              {
                __new_finish = std::uninitialized_copy(iterator(this->_M_start),
  						     __position, __new_start);
Index: include/ext/rope
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/rope,v
retrieving revision 1.10
diff -c -5 -p -r1.10 rope
*** include/ext/rope	4 Jul 2003 12:10:13 -0000	1.10
--- include/ext/rope	14 Jul 2003 02:48:18 -0000
*************** struct _Rope_RopeLeaf : public _Rope_Rop
*** 604,616 ****
          // the proper allocator and the properly padded size.
          // In contrast, the destructor deallocates the data:
  # ifndef __GC
      ~_Rope_RopeLeaf() {
          if (_M_data != this->_M_c_string) {
!             _M_free_c_string();
          }
!         __STL_FREE_STRING(_M_data, this->_M_size, get_allocator());
      }
  # endif
  };
  
  template<class _CharT, class _Alloc>
--- 604,616 ----
          // the proper allocator and the properly padded size.
          // In contrast, the destructor deallocates the data:
  # ifndef __GC
      ~_Rope_RopeLeaf() {
          if (_M_data != this->_M_c_string) {
! 	  this->_M_free_c_string();
          }
!         __STL_FREE_STRING(_M_data, this->_M_size, this->get_allocator());
      }
  # endif
  };
  
  template<class _CharT, class _Alloc>
*************** struct _Rope_RopeConcatenation : public 
*** 630,642 ****
                                       __l->_M_size + __r->_M_size, __a),
          _M_left(__l), _M_right(__r)
        {}
  # ifndef __GC
      ~_Rope_RopeConcatenation() {
!         _M_free_c_string();
!         _M_left->_M_unref_nonnil();
!         _M_right->_M_unref_nonnil();
      }
  # endif
  };
  
  template<class _CharT, class _Alloc>
--- 630,642 ----
                                       __l->_M_size + __r->_M_size, __a),
          _M_left(__l), _M_right(__r)
        {}
  # ifndef __GC
      ~_Rope_RopeConcatenation() {
!       this->_M_free_c_string();
!       _M_left->_M_unref_nonnil();
!       _M_right->_M_unref_nonnil();
      }
  # endif
  };
  
  template<class _CharT, class _Alloc>
*************** struct _Rope_RopeFunction : public _Rope
*** 676,686 ****
              }
  #       endif
      }
  # ifndef __GC
      ~_Rope_RopeFunction() {
!           _M_free_c_string();
            if (_M_delete_when_done) {
                delete _M_fn;
            }
      }
  # endif
--- 676,686 ----
              }
  #       endif
      }
  # ifndef __GC
      ~_Rope_RopeFunction() {
!           this->_M_free_c_string();
            if (_M_delete_when_done) {
                delete _M_fn;
            }
      }
  # endif
*************** class _Rope_const_iterator : public _Rop
*** 977,1021 ****
          if (0 != this->_M_buf_ptr
  	    && (__next = this->_M_buf_ptr + 1) < this->_M_buf_end) {
              this->_M_buf_ptr = __next;
              ++this->_M_current_pos;
          } else {
!             _M_incr(1);
          }
          return *this;
      }
      _Rope_const_iterator& operator+=(ptrdiff_t __n) {
          if (__n >= 0) {
!             _M_incr(__n);
          } else {
!             _M_decr(-__n);
          }
          return *this;
      }
      _Rope_const_iterator& operator--() {
!         _M_decr(1);
          return *this;
      }
      _Rope_const_iterator& operator-=(ptrdiff_t __n) {
          if (__n >= 0) {
!             _M_decr(__n);
          } else {
!             _M_incr(-__n);
          }
          return *this;
      }
      _Rope_const_iterator operator++(int) {
          size_t __old_pos = this->_M_current_pos;
!         _M_incr(1);
          return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
          // This makes a subsequent dereference expensive.
          // Perhaps we should instead copy the iterator
          // if it has a valid cache?
      }
      _Rope_const_iterator operator--(int) {
          size_t __old_pos = this->_M_current_pos;
!         _M_decr(1);
          return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
      }
      template<class _CharT2, class _Alloc2>
      friend _Rope_const_iterator<_CharT2,_Alloc2> operator-
          (const _Rope_const_iterator<_CharT2,_Alloc2>& __x,
--- 977,1021 ----
          if (0 != this->_M_buf_ptr
  	    && (__next = this->_M_buf_ptr + 1) < this->_M_buf_end) {
              this->_M_buf_ptr = __next;
              ++this->_M_current_pos;
          } else {
!             this->_M_incr(1);
          }
          return *this;
      }
      _Rope_const_iterator& operator+=(ptrdiff_t __n) {
          if (__n >= 0) {
!             this->_M_incr(__n);
          } else {
! 	    this->_M_decr(-__n);
          }
          return *this;
      }
      _Rope_const_iterator& operator--() {
!         this->_M_decr(1);
          return *this;
      }
      _Rope_const_iterator& operator-=(ptrdiff_t __n) {
          if (__n >= 0) {
!             this->_M_decr(__n);
          } else {
!             this->_M_incr(-__n);
          }
          return *this;
      }
      _Rope_const_iterator operator++(int) {
          size_t __old_pos = this->_M_current_pos;
!         this->_M_incr(1);
          return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
          // This makes a subsequent dereference expensive.
          // Perhaps we should instead copy the iterator
          // if it has a valid cache?
      }
      _Rope_const_iterator operator--(int) {
          size_t __old_pos = this->_M_current_pos;
!         this->_M_decr(1);
          return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
      }
      template<class _CharT2, class _Alloc2>
      friend _Rope_const_iterator<_CharT2,_Alloc2> operator-
          (const _Rope_const_iterator<_CharT2,_Alloc2>& __x,
*************** class _Rope_iterator : public _Rope_iter
*** 1110,1150 ****
              return _Rope_char_ref_proxy<_CharT,_Alloc>(
                 _M_root_rope, this->_M_current_pos, *this->_M_buf_ptr);
          }
      }
      _Rope_iterator& operator++() {
!         _M_incr(1);
          return *this;
      }
      _Rope_iterator& operator+=(ptrdiff_t __n) {
          if (__n >= 0) {
!             _M_incr(__n);
          } else {
!             _M_decr(-__n);
          }
          return *this;
      }
      _Rope_iterator& operator--() {
!         _M_decr(1);
          return *this;
      }
      _Rope_iterator& operator-=(ptrdiff_t __n) {
          if (__n >= 0) {
!             _M_decr(__n);
          } else {
!             _M_incr(-__n);
          }
          return *this;
      }
      _Rope_iterator operator++(int) {
          size_t __old_pos = this->_M_current_pos;
!         _M_incr(1);
          return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
      }
      _Rope_iterator operator--(int) {
          size_t __old_pos = this->_M_current_pos;
!         _M_decr(1);
          return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
      }
      reference operator[](ptrdiff_t __n) {
          return _Rope_char_ref_proxy<_CharT,_Alloc>(
            _M_root_rope, this->_M_current_pos + __n);
--- 1110,1150 ----
              return _Rope_char_ref_proxy<_CharT,_Alloc>(
                 _M_root_rope, this->_M_current_pos, *this->_M_buf_ptr);
          }
      }
      _Rope_iterator& operator++() {
!         this->_M_incr(1);
          return *this;
      }
      _Rope_iterator& operator+=(ptrdiff_t __n) {
          if (__n >= 0) {
!             this->_M_incr(__n);
          } else {
!             this->_M_decr(-__n);
          }
          return *this;
      }
      _Rope_iterator& operator--() {
!         this->_M_decr(1);
          return *this;
      }
      _Rope_iterator& operator-=(ptrdiff_t __n) {
          if (__n >= 0) {
!             this->_M_decr(__n);
          } else {
!             this->_M_incr(-__n);
          }
          return *this;
      }
      _Rope_iterator operator++(int) {
          size_t __old_pos = this->_M_current_pos;
!         this->_M_incr(1);
          return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
      }
      _Rope_iterator operator--(int) {
          size_t __old_pos = this->_M_current_pos;
!         this->_M_decr(1);
          return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
      }
      reference operator[](ptrdiff_t __n) {
          return _Rope_char_ref_proxy<_CharT,_Alloc>(
            _M_root_rope, this->_M_current_pos + __n);
*************** class rope : public _Rope_base<_CharT,_A
*** 1648,1658 ****
  
          void push_front(_CharT __x)
          {
              _RopeRep* __old = this->_M_tree_ptr;
              _RopeRep* __left =
!               __STL_ROPE_FROM_UNOWNED_CHAR_PTR(&__x, 1, get_allocator());
              try {
                this->_M_tree_ptr = _S_concat(__left, this->_M_tree_ptr);
                _S_unref(__old);
                _S_unref(__left);
              }
--- 1648,1658 ----
  
          void push_front(_CharT __x)
          {
              _RopeRep* __old = this->_M_tree_ptr;
              _RopeRep* __left =
!               __STL_ROPE_FROM_UNOWNED_CHAR_PTR(&__x, 1, this->get_allocator());
              try {
                this->_M_tree_ptr = _S_concat(__left, this->_M_tree_ptr);
                _S_unref(__old);
                _S_unref(__left);
              }
Index: include/ext/ropeimpl.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/ropeimpl.h,v
retrieving revision 1.20
diff -c -5 -p -r1.20 ropeimpl.h
*** include/ext/ropeimpl.h	6 Jun 2003 15:50:27 -0000	1.20
--- include/ext/ropeimpl.h	14 Jul 2003 02:48:19 -0000
*************** const _CharT* rope<_CharT,_Alloc>::c_str
*** 1453,1463 ****
      __gthread_mutex_lock (&this->_M_tree_ptr->_M_c_string_lock);
      __GC_CONST _CharT* __result = this->_M_tree_ptr->_M_c_string;
      if (0 == __result)
        {
  	size_t __s = size();
! 	__result = _Data_allocate(__s + 1);
  	_S_flatten(this->_M_tree_ptr, __result);
  	__result[__s] = _S_eos((_CharT*)0);
  	this->_M_tree_ptr->_M_c_string = __result;
        }
      __gthread_mutex_unlock (&this->_M_tree_ptr->_M_c_string_lock);
--- 1453,1463 ----
      __gthread_mutex_lock (&this->_M_tree_ptr->_M_c_string_lock);
      __GC_CONST _CharT* __result = this->_M_tree_ptr->_M_c_string;
      if (0 == __result)
        {
  	size_t __s = size();
! 	__result = this->_Data_allocate(__s + 1);
  	_S_flatten(this->_M_tree_ptr, __result);
  	__result[__s] = _S_eos((_CharT*)0);
  	this->_M_tree_ptr->_M_c_string = __result;
        }
      __gthread_mutex_unlock (&this->_M_tree_ptr->_M_c_string_lock);
*************** const _CharT* rope<_CharT,_Alloc>::repla
*** 1478,1488 ****
      size_t __s = size();
      _CharT* __result = _Data_allocate(_S_rounded_up_size(__s));
      _S_flatten(this->_M_tree_ptr, __result);
      __result[__s] = _S_eos((_CharT*)0);
      this->_M_tree_ptr->_M_unref_nonnil();
!     this->_M_tree_ptr = _S_new_RopeLeaf(__result, __s, get_allocator());
      return(__result);
  }
  
  // Algorithm specializations.  More should be added.
  
--- 1478,1488 ----
      size_t __s = size();
      _CharT* __result = _Data_allocate(_S_rounded_up_size(__s));
      _S_flatten(this->_M_tree_ptr, __result);
      __result[__s] = _S_eos((_CharT*)0);
      this->_M_tree_ptr->_M_unref_nonnil();
!     this->_M_tree_ptr = _S_new_RopeLeaf(__result, __s, this->get_allocator());
      return(__result);
  }
  
  // Algorithm specializations.  More should be added.
  
Index: include/ext/stdio_filebuf.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/stdio_filebuf.h,v
retrieving revision 1.12
diff -c -5 -p -r1.12 stdio_filebuf.h
*** include/ext/stdio_filebuf.h	24 Jun 2003 13:48:09 -0000	1.12
--- include/ext/stdio_filebuf.h	14 Jul 2003 02:48:19 -0000
*************** namespace __gnu_cxx
*** 124,137 ****
        this->_M_file.sys_open(__fd, __mode, __del);
        if (this->is_open())
  	{
  	  this->_M_mode = __mode;
  	  this->_M_buf_size = __size;
! 	  _M_allocate_internal_buffer();
  	  this->_M_reading = false;
  	  this->_M_writing = false;
! 	  _M_set_buffer(-1);
  	}
      }
  
    template<typename _CharT, typename _Traits>
      stdio_filebuf<_CharT, _Traits>::
--- 124,137 ----
        this->_M_file.sys_open(__fd, __mode, __del);
        if (this->is_open())
  	{
  	  this->_M_mode = __mode;
  	  this->_M_buf_size = __size;
! 	  this->_M_allocate_internal_buffer();
  	  this->_M_reading = false;
  	  this->_M_writing = false;
! 	  this->_M_set_buffer(-1);
  	}
      }
  
    template<typename _CharT, typename _Traits>
      stdio_filebuf<_CharT, _Traits>::
*************** namespace __gnu_cxx
*** 141,154 ****
        this->_M_file.sys_open(__f, __mode);
        if (this->is_open())
  	{
  	  this->_M_mode = __mode;
  	  this->_M_buf_size = __size;
! 	  _M_allocate_internal_buffer();
  	  this->_M_reading = false;
  	  this->_M_writing = false;
! 	  _M_set_buffer(-1);
  	}
      }
  } // namespace __gnu_cxx
  
  #endif 
--- 141,154 ----
        this->_M_file.sys_open(__f, __mode);
        if (this->is_open())
  	{
  	  this->_M_mode = __mode;
  	  this->_M_buf_size = __size;
! 	  this->_M_allocate_internal_buffer();
  	  this->_M_reading = false;
  	  this->_M_writing = false;
! 	  this->_M_set_buffer(-1);
  	}
      }
  } // namespace __gnu_cxx
  
  #endif 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]