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]

PATCH: Make good on deprecation threat


These extensions were deprecated in 3.2 for removal in 3.4, and documented
as such.  Couldn't even get to them without specifically enabling deprecated
library stuff.  I think it's time that they go away.

Built and tested on i686-linux, no regressions.  The ABI checker shows
one change:

    1 missing symbols
        1
        symbol
        _ZNSt24__default_alloc_templateILb1ELi0EE10reallocateEPvjj
        demangled symbol
        std::__default_alloc_template<true, 0>::reallocate(void*, unsigned, unsigned)

This function was also guarded by "#ifdef _GLIBCPP_DEPRECATED", so users
should be expecting its removal.  (I'm not sure how it's showing up in
the binary library...)

Comments, anyone?



Index: include/bits/deque.tcc
===================================================================
RCS file: /home/pme/Repositories/GCC/gcc/libstdc++-v3/include/bits/deque.tcc,v
retrieving revision 1.4
diff -u -r1.4 deque.tcc
--- include/bits/deque.tcc	16 Dec 2002 18:22:58 -0000	1.4
+++ include/bits/deque.tcc	30 Dec 2002 16:01:44 -0000
@@ -328,29 +328,6 @@
         }
     }
     
-  #ifdef _GLIBCPP_DEPRECATED
-  // Called only if _M_finish._M_cur == _M_finish._M_last - 1.
-  template <typename _Tp, typename _Alloc>
-    void
-    deque<_Tp,_Alloc>::
-    _M_push_back_aux()
-    {
-      _M_reserve_map_at_back();
-      *(_M_finish._M_node + 1) = _M_allocate_node();
-      try
-        {
-          _Construct(_M_finish._M_cur);
-          _M_finish._M_set_node(_M_finish._M_node + 1);
-          _M_finish._M_cur = _M_finish._M_first;
-        }
-      catch(...)
-        {
-          _M_deallocate_node(*(_M_finish._M_node + 1));
-          __throw_exception_again;
-        }
-    }
-  #endif
-    
   // Called only if _M_start._M_cur == _M_start._M_first.
   template <typename _Tp, typename _Alloc>
     void
@@ -374,30 +351,6 @@
         }
     } 
     
-  #ifdef _GLIBCPP_DEPRECATED
-  // Called only if _M_start._M_cur == _M_start._M_first.
-  template <typename _Tp, typename _Alloc>
-    void
-    deque<_Tp,_Alloc>::
-    _M_push_front_aux()
-    {
-      _M_reserve_map_at_front();
-      *(_M_start._M_node - 1) = _M_allocate_node();
-      try
-        {
-          _M_start._M_set_node(_M_start._M_node - 1);
-          _M_start._M_cur = _M_start._M_last - 1;
-          _Construct(_M_start._M_cur);
-        }
-      catch(...)
-        {
-          ++_M_start;
-          _M_deallocate_node(*(_M_start._M_node - 1));
-          __throw_exception_again;
-        }
-    } 
-  #endif
-    
   // Called only if _M_finish._M_cur == _M_finish._M_first.
   template <typename _Tp, typename _Alloc>
     void deque<_Tp,_Alloc>::
@@ -507,44 +460,6 @@
       *__pos = __x_copy;
       return __pos;
     }
-    
-  #ifdef _GLIBCPP_DEPRECATED
-  // Nothing seems to actually use this.  According to the pattern followed by
-  // the rest of the SGI code, it would be called by the deprecated insert(pos)
-  // function, but that has been replaced.  We'll take our time removing this
-  // anyhow; mark for 3.4.  -pme
-  template <typename _Tp, typename _Alloc>
-    typename deque<_Tp,_Alloc>::iterator 
-    deque<_Tp,_Alloc>::
-    _M_insert_aux(iterator __pos)
-    {
-      difference_type __index = __pos - _M_start;
-      if (static_cast<size_type>(__index) < size() / 2)
-      {
-        push_front(front());
-        iterator __front1 = _M_start;
-        ++__front1;
-        iterator __front2 = __front1;
-        ++__front2;
-        __pos = _M_start + __index;
-        iterator __pos1 = __pos;
-        ++__pos1;
-        copy(__front2, __pos1, __front1);
-      }
-      else
-      {
-        push_back(back());
-        iterator __back1 = _M_finish;
-        --__back1;
-        iterator __back2 = __back1;
-        --__back2;
-        __pos = _M_start + __index;
-        copy_backward(__pos, __back2, __back1);
-      }
-      *__pos = value_type();
-      return __pos;
-    }
-  #endif
     
   template <typename _Tp, typename _Alloc>
     void
Index: include/bits/stl_alloc.h
===================================================================
RCS file: /home/pme/Repositories/GCC/gcc/libstdc++-v3/include/bits/stl_alloc.h,v
retrieving revision 1.26
diff -u -r1.26 stl_alloc.h
--- include/bits/stl_alloc.h	16 Nov 2002 17:16:28 -0000	1.26
+++ include/bits/stl_alloc.h	30 Dec 2002 16:00:20 -0000
@@ -74,10 +74,6 @@
  *  into a "standard" one.
  *  @endif
  *
- *  @note The @c reallocate member functions have been deprecated for 3.2
- *        and will be removed in 3.4.  You must define @c _GLIBCPP_DEPRECATED
- *        to make this visible in 3.2; see c++config.h.
- *
  *  The canonical description of these classes is in docs/html/ext/howto.html
  *  or online at http://gcc.gnu.org/onlinedocs/libstdc++/ext/howto.html#3
 */
@@ -129,9 +125,6 @@
     {
     private:
       static void* _S_oom_malloc(size_t);
-#ifdef _GLIBCPP_DEPRECATED
-      static void* _S_oom_realloc(void*, size_t);
-#endif
       static void (* __malloc_alloc_oom_handler)();
 
     public:
@@ -148,17 +141,6 @@
       deallocate(void* __p, size_t /* __n */)
       { free(__p); }
 
-#ifdef _GLIBCPP_DEPRECATED
-      static void*
-      reallocate(void* __p, size_t /* old_sz */, size_t __new_sz)
-      {
-        void* __result = realloc(__p, __new_sz);
-        if (__builtin_expect(__result == 0, 0))
-          __result = _S_oom_realloc(__p, __new_sz);
-        return __result;
-      }
-#endif
-
       static void (* __set_malloc_handler(void (*__f)()))()
       {
         void (* __old)() = __malloc_alloc_oom_handler;
@@ -191,28 +173,6 @@
         }
     }
 
-#ifdef _GLIBCPP_DEPRECATED
-  template<int __inst>
-    void*
-    __malloc_alloc_template<__inst>::
-    _S_oom_realloc(void* __p, size_t __n)
-    {
-      void (* __my_malloc_handler)();
-      void* __result;
-
-      for (;;)
-        {
-          __my_malloc_handler = __malloc_alloc_oom_handler;
-          if (__builtin_expect(__my_malloc_handler == 0, 0))
-            __throw_bad_alloc();
-          (*__my_malloc_handler)();
-          __result = realloc(__p, __n);
-          if (__result)
-            return __result;
-        }
-    }
-#endif
-
   // Should not be referenced within the library anymore.
   typedef __new_alloc                 __mem_interface;
 
@@ -292,20 +252,6 @@
         assert(*(size_t*)__real_p == __n);
         _Alloc::deallocate(__real_p, __n + (int) _S_extra);
       }
-
-#ifdef _GLIBCPP_DEPRECATED
-      static void*
-      reallocate(void* __p, size_t __old_sz, size_t __new_sz)
-      {
-        char* __real_p = (char*)__p - (int) _S_extra;
-        assert(*(size_t*)__real_p == __old_sz);
-        char* __result = (char*) _Alloc::reallocate(__real_p, 
-						    __old_sz + (int) _S_extra,
-						    __new_sz + (int) _S_extra);
-        *(size_t*)__result = __new_sz;
-        return __result + (int) _S_extra;
-      }
-#endif
     };
 
 
@@ -455,11 +401,6 @@
 	    *__my_free_list = __q;
 	  }
       }
-
-#ifdef _GLIBCPP_DEPRECATED
-      static void*
-      reallocate(void* __p, size_t __old_sz, size_t __new_sz);
-#endif
     };
 
   template<bool __threads, int __inst> _Atomic_word
@@ -590,27 +531,6 @@
       return __result;
     }
 
-
-#ifdef _GLIBCPP_DEPRECATED
-  template<bool threads, int inst>
-    void*
-    __default_alloc_template<threads, inst>::
-    reallocate(void* __p, size_t __old_sz, size_t __new_sz)
-    {
-      void* __result;
-      size_t __copy_sz;
-
-      if (__old_sz > (size_t) _MAX_BYTES && __new_sz > (size_t) _MAX_BYTES)
-        return(realloc(__p, __new_sz));
-      if (_S_round_up(__old_sz) == _S_round_up(__new_sz))
-        return(__p);
-      __result = allocate(__new_sz);
-      __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
-      memcpy(__result, __p, __copy_sz);
-      deallocate(__p, __old_sz);
-      return __result;
-    }
-#endif
 
   template<bool __threads, int __inst>
     _STL_mutex_lock
Index: include/bits/stl_deque.h
===================================================================
RCS file: /home/pme/Repositories/GCC/gcc/libstdc++-v3/include/bits/stl_deque.h,v
retrieving revision 1.33
diff -u -r1.33 stl_deque.h
--- include/bits/stl_deque.h	27 Dec 2002 23:03:02 -0000	1.33
+++ include/bits/stl_deque.h	30 Dec 2002 16:02:23 -0000
@@ -1025,31 +1025,6 @@
         _M_push_front_aux(__x);
     }
   
-  #ifdef _GLIBCPP_DEPRECATED
-    /**
-     *  @brief  Add data to the front of the %deque.
-     *
-     *  This is a typical stack operation.  The function creates a
-     *  default-constructed element at the front of the %deque.  Due to the
-     *  nature of a %deque this operation can be done in constant time.  You
-     *  should consider using push_front(value_type()) instead.
-     *
-     *  @note This was deprecated in 3.2 and will be removed in 3.4.  You must
-     *        define @c _GLIBCPP_DEPRECATED to make this visible in 3.2; see
-     *        c++config.h.
-    */
-    void
-    push_front()
-    {
-      if (_M_start._M_cur != _M_start._M_first) {
-        _Construct(_M_start._M_cur - 1);
-        --_M_start._M_cur;
-      }
-      else
-        _M_push_front_aux();
-    }
-  #endif
-  
     /**
      *  @brief  Add data to the end of the %deque.
      *  @param  x  Data to be added.
@@ -1069,31 +1044,6 @@
         _M_push_back_aux(__x);
     }
   
-  #ifdef _GLIBCPP_DEPRECATED
-    /**
-     *  @brief  Add data to the end of the %deque.
-     *
-     *  This is a typical stack operation.  The function creates a
-     *  default-constructed element at the end of the %deque.  Due to the nature
-     *  of a %deque this operation can be done in constant time.  You should
-     *  consider using push_back(value_type()) instead.
-     *
-     *  @note This was deprecated in 3.2 and will be removed in 3.4.  You must
-     *        define @c _GLIBCPP_DEPRECATED to make this visible in 3.2; see
-     *        c++config.h.
-    */
-    void
-    push_back()
-    {
-      if (_M_finish._M_cur != _M_finish._M_last - 1) {
-        _Construct(_M_finish._M_cur);
-        ++_M_finish._M_cur;
-      }
-      else
-        _M_push_back_aux();
-    }
-  #endif
-  
     /**
      *  @brief  Removes first element.
      *
@@ -1144,25 +1094,6 @@
     iterator
     insert(iterator position, const value_type& __x);
   
-  #ifdef _GLIBCPP_DEPRECATED
-    /**
-     *  @brief  Inserts an element into the %deque.
-     *  @param  position  An iterator into the %deque.
-     *  @return  An iterator that points to the inserted element.
-     *
-     *  This function will insert a default-constructed element before the
-     *  specified location.  You should consider using
-     *  insert(position,value_type()) instead.
-     *
-     *  @note This was deprecated in 3.2 and will be removed in 3.4.  You must
-     *        define @c _GLIBCPP_DEPRECATED to make this visible in 3.2; see
-     *        c++config.h.
-    */
-    iterator
-    insert(iterator __position)
-    { return insert(__position, value_type()); }
-  #endif
-  
     /**
      *  @brief  Inserts a number of copies of given data into the %deque.
      *  @param  position  An iterator into the %deque.
@@ -1392,10 +1323,6 @@
     */
     void _M_push_back_aux(const value_type&);
     void _M_push_front_aux(const value_type&);
-  #ifdef _GLIBCPP_DEPRECATED
-    void _M_push_back_aux();
-    void _M_push_front_aux();
-  #endif
     void _M_pop_back_aux();
     void _M_pop_front_aux();
     //@}
@@ -1458,11 +1385,6 @@
       _M_insert_aux(iterator __pos, 
                     _ForwardIterator __first, _ForwardIterator __last,
                     size_type __n);
-  
-  #ifdef _GLIBCPP_DEPRECATED
-    // unused, see comment in implementation
-    iterator _M_insert_aux(iterator __pos);
-  #endif
   
     //@{
     /**
Index: include/bits/stl_list.h
===================================================================
RCS file: /home/pme/Repositories/GCC/gcc/libstdc++-v3/include/bits/stl_list.h,v
retrieving revision 1.22
diff -u -r1.22 stl_list.h
--- include/bits/stl_list.h	23 Dec 2002 17:36:24 -0000	1.22
+++ include/bits/stl_list.h	30 Dec 2002 16:02:47 -0000
@@ -702,23 +702,6 @@
     void
     push_front(const value_type& __x) { this->insert(begin(), __x); }
   
-  #ifdef _GLIBCPP_DEPRECATED
-    /**
-     *  @brief  Add data to the front of the %list.
-     *
-     *  This is a typical stack operation.  The function creates a
-     *  default-constructed element at the front of the %list.  Due to the
-     *  nature of a %list this operation can be done in constant time.  You
-     *  should consider using push_front(value_type()) instead.
-     *
-     *  @note This was deprecated in 3.2 and will be removed in 3.4.  You must
-     *        define @c _GLIBCPP_DEPRECATED to make this visible in 3.2; see
-     *        c++config.h.
-    */
-    void
-    push_front() { this->insert(begin(), value_type()); }
-  #endif
-  
     /**
      *  @brief  Removes first element.
      *
@@ -745,23 +728,6 @@
     void
     push_back(const value_type& __x) { this->insert(end(), __x); }
   
-  #ifdef _GLIBCPP_DEPRECATED
-    /**
-     *  @brief  Add data to the end of the %list.
-     *
-     *  This is a typical stack operation.  The function creates a
-     *  default-constructed element at the end of the %list.  Due to the nature
-     *  of a %list this operation can be done in constant time.  You should
-     *  consider using push_back(value_type()) instead.
-     *
-     *  @note This was deprecated in 3.2 and will be removed in 3.4.  You must
-     *        define @c _GLIBCPP_DEPRECATED to make this visible in 3.2; see
-     *        c++config.h.
-    */
-    void
-    push_back() { this->insert(end(), value_type()); }
-  #endif
-  
     /**
      *  @brief  Removes last element.
      *
@@ -793,26 +759,6 @@
     */
     iterator
     insert(iterator __position, const value_type& __x);
-  
-  #ifdef _GLIBCPP_DEPRECATED
-    /**
-     *  @brief  Inserts an element into the %list.
-     *  @param  position  An iterator into the %list.
-     *  @return  An iterator that points to the inserted element.
-     *
-     *  This function will insert a default-constructed element before the
-     *  specified location.  You should consider using
-     *  insert(position,value_type()) instead.
-     *  Due to the nature of a %list this operation can be done in constant
-     *  time, and does not invalidate iterators and references.
-     *
-     *  @note This was deprecated in 3.2 and will be removed in 3.4.  You must
-     *        define @c _GLIBCPP_DEPRECATED to make this visible in 3.2; see
-     *        c++config.h.
-    */
-    iterator
-    insert(iterator __position) { return insert(__position, value_type()); }
-  #endif
   
     /**
      *  @brief  Inserts a number of copies of given data into the %list.
Index: include/bits/stl_vector.h
===================================================================
RCS file: /home/pme/Repositories/GCC/gcc/libstdc++-v3/include/bits/stl_vector.h,v
retrieving revision 1.32
diff -u -r1.32 stl_vector.h
--- include/bits/stl_vector.h	23 Dec 2002 17:36:24 -0000	1.32
+++ include/bits/stl_vector.h	30 Dec 2002 16:01:02 -0000
@@ -631,28 +631,7 @@
        */
       iterator
       insert(iterator __position, const value_type& __x);
-  
-#ifdef _GLIBCPP_DEPRECATED
-      /**
-       *  @brief  Inserts an element into the %vector.
-       *  @param  position  An iterator into the %vector.
-       *  @return  An iterator that points to the inserted element.
-       *
-       *  This function will insert a default-constructed element
-       *  before the specified location.  You should consider using
-       *  insert(position,value_type()) instead.  Note that this kind
-       *  of operation could be expensive for a vector and if it is
-       *  frequently used the user should consider using std::list.
-       *
-       *  @note This was deprecated in 3.2 and will be removed in 3.4.
-       *  You must define @c _GLIBCPP_DEPRECATED to make this visible
-       *  in 3.2; see c++config.h.
-       */
-      iterator
-      insert(iterator __position)
-      { return insert(__position, value_type()); }
-#endif
-      
+
       /**
        *  @brief  Inserts a number of copies of given data into the %vector.
        *  @param  position  An iterator into the %vector.
@@ -913,11 +892,6 @@
       // Called by insert(p,x)
       void
       _M_insert_aux(iterator __position, const value_type& __x);
-      
-#ifdef _GLIBCPP_DEPRECATED
-      // Unused now (same situation as in deque)
-      void _M_insert_aux(iterator __position);
-#endif
     };
   
   


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