]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++config (_GLIBCXX_STD): New.
authorBenjamin Kosnik <bkoz@redhat.com>
Fri, 16 Apr 2004 19:04:07 +0000 (19:04 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Fri, 16 Apr 2004 19:04:07 +0000 (19:04 +0000)
2004-04-16  Benjamin Kosnik  <bkoz@redhat.com>

* include/bits/c++config (_GLIBCXX_STD): New.
* src/list.cc: Use it.
* include/std/std_bitset.h: Same.
* include/bits/vector.tcc: Same.
* include/bits/stl_set.h: Same.
* include/bits/stl_multiset.h: Same.
* include/bits/stl_multimap.h: Same.
* include/bits/stl_map.h: Same.
* include/bits/stl_list.h: Same.
* include/bits/stl_vector.h: Same.
* include/bits/stl_bvector.h: Same.
* include/bits/stl_deque.h: Same.
* include/bits/deque.tcc: Same.
* include/bits/list.tcc: Same.
* include/debug/vector: Same.
* include/debug/set.h: Same.
* include/debug/multiset.h: Same.
* include/debug/multimap.h: Same.
* include/debug/map.h: Same.
* include/debug/list: Same.
* include/debug/deque: Same.
* include/debug/bitset: Same.
* include/debug/formatter.h (__gnu_debug): Remove using directive.
Add using declaration for std::type_info.
* include/debug/safe_iterator.h: Add using declaration for
std::iterator_traits and std::pair.
* src/debug_list.cc: New.
* src/Makefile.am: Add debug_list.cc.
* src/Makefile.in: Regenerate.
* config/linker-map.gnu: Add _List_node_base exports for std and
__gnu_norm.

* include/bits/stl_bvector.h (_Bvector_base): Use _Bvector_impl
idiom that other containers use.
* testsuite/23_containers/vector/bool/clear_allocator.cc: New.

From-SVN: r80763

31 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/Makefile.in
libstdc++-v3/config/linker-map.gnu
libstdc++-v3/include/bits/c++config
libstdc++-v3/include/bits/deque.tcc
libstdc++-v3/include/bits/list.tcc
libstdc++-v3/include/bits/stl_bvector.h
libstdc++-v3/include/bits/stl_deque.h
libstdc++-v3/include/bits/stl_list.h
libstdc++-v3/include/bits/stl_map.h
libstdc++-v3/include/bits/stl_multimap.h
libstdc++-v3/include/bits/stl_multiset.h
libstdc++-v3/include/bits/stl_set.h
libstdc++-v3/include/bits/stl_vector.h
libstdc++-v3/include/bits/vector.tcc
libstdc++-v3/include/debug/bitset
libstdc++-v3/include/debug/deque
libstdc++-v3/include/debug/formatter.h
libstdc++-v3/include/debug/list
libstdc++-v3/include/debug/map.h
libstdc++-v3/include/debug/multimap.h
libstdc++-v3/include/debug/multiset.h
libstdc++-v3/include/debug/safe_iterator.h
libstdc++-v3/include/debug/set.h
libstdc++-v3/include/debug/vector
libstdc++-v3/include/std/std_bitset.h
libstdc++-v3/src/Makefile.am
libstdc++-v3/src/Makefile.in
libstdc++-v3/src/debug_list.cc [new file with mode: 0644]
libstdc++-v3/src/list.cc
libstdc++-v3/testsuite/23_containers/vector/bool/clear_allocator.cc [new file with mode: 0644]

index f6846551c128ab4a7f7c04c477d7806e32a9b068..386efbc3e830781e254853695d3cc3b2bb752cd5 100644 (file)
@@ -1,3 +1,41 @@
+2004-04-16  Benjamin Kosnik  <bkoz@redhat.com>
+       
+       * include/bits/c++config (_GLIBCXX_STD): New.
+       * src/list.cc: Use it.
+       * include/std/std_bitset.h: Same.
+       * include/bits/vector.tcc: Same.
+       * include/bits/stl_set.h: Same.
+       * include/bits/stl_multiset.h: Same.
+       * include/bits/stl_multimap.h: Same.
+       * include/bits/stl_map.h: Same.
+       * include/bits/stl_list.h: Same.
+       * include/bits/stl_vector.h: Same.
+       * include/bits/stl_bvector.h: Same.
+       * include/bits/stl_deque.h: Same.
+       * include/bits/deque.tcc: Same.
+       * include/bits/list.tcc: Same.
+       * include/debug/vector: Same.
+       * include/debug/set.h: Same.
+       * include/debug/multiset.h: Same.
+       * include/debug/multimap.h: Same.
+       * include/debug/map.h: Same.
+       * include/debug/list: Same.
+       * include/debug/deque: Same.
+       * include/debug/bitset: Same.   
+       * include/debug/formatter.h (__gnu_debug): Remove using directive.
+       Add using declaration for std::type_info.
+       * include/debug/safe_iterator.h: Add using declaration for
+       std::iterator_traits and std::pair.
+       * src/debug_list.cc: New.
+       * src/Makefile.am: Add debug_list.cc.
+       * src/Makefile.in: Regenerate.
+       * config/linker-map.gnu: Add _List_node_base exports for std and
+       __gnu_norm.
+
+       * include/bits/stl_bvector.h (_Bvector_base): Use _Bvector_impl
+       idiom that other containers use.
+       * testsuite/23_containers/vector/bool/clear_allocator.cc: New.
+                       
 2004-04-16  Paolo Carlini  <pcarlini@suse.de>
 
        PR libstdc++/14975
index 051ace1e5869a99723cd82c426b4a3258afeee87..cf4d198bdc189486904141b3fafb4bd8fa592fdd 100644 (file)
@@ -44,7 +44,7 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/../config.guess \
        $(top_srcdir)/configure $(top_srcdir)/fragment.am \
        $(top_srcdir)/scripts/check_survey.in \
        $(top_srcdir)/scripts/testsuite_flags.in ../ABOUT-NLS \
-       ../COPYING ../COPYING.LIB ../ChangeLog ../README \
+       ../COPYING ../COPYING.LIB ../ChangeLog ../README ../compile \
        ../config.guess ../config.rpath ../config.sub ../install-sh \
        ../ltcf-c.sh ../ltcf-cxx.sh ../ltcf-gcj.sh ../ltconfig \
        ../ltmain.sh ../missing ../mkinstalldirs ../ylwrap ChangeLog \
index 7dd9a2a12f79b58102004e0e5d0cf5719d61da75..b9205db85a03a0044b6b0ae867b3f3b1e8aa5ba2 100644 (file)
@@ -55,6 +55,11 @@ GLIBCXX_3.4 {
       std::locale::_S_normalize_category*;
       std::locale::_[T-Za-z]*;
       std::[A-Zm-z]*;
+      std::_List_node_base::hook*;
+      std::_List_node_base::swap*;
+      std::_List_node_base::unhook*;
+      std::_List_node_base::reverse*;
+      std::_List_node_base::transfer*;
       std::__throw_*;
       std::__basic_file*;
       std::__timepunct*;
@@ -66,10 +71,14 @@ GLIBCXX_3.4 {
       std::__moneypunct_cache*;
       std::__numpunct_cache*;
       std::__timepunct_cache*;
-      __gnu_norm::*;
       __gnu_debug::_Safe_iterator_base*;
       __gnu_debug::_Safe_sequence_base*;
-      __gnu_debug::_Error_formatter*
+      __gnu_debug::_Error_formatter*;
+      __gnu_norm::_List_node_base::hook*;
+      __gnu_norm::_List_node_base::swap*;
+      __gnu_norm::_List_node_base::unhook*;
+      __gnu_norm::_List_node_base::reverse*;
+      __gnu_norm::_List_node_base::transfer*
     };
 
     # Names not in an 'extern' block are mangled names.
index 58d9bb048983f8ac5c0ca6cb58d96be91a3dd9dc..473777f8d2aa217b46e7d2c5cb1fb5d02ff3e9a7 100644 (file)
@@ -1,6 +1,6 @@
 // Predefined symbols and macros -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 # define _GLIBCXX_EXTERN_TEMPLATE 1
 #endif
 
-// To enable debug mode.
-namespace __gnu_norm 
-{ 
-  using namespace std; 
-}
-
+// Debug mode support. Debug mode basic_string is not allowed to be
+// associated with std, because of locale and exception link
+// dependence.
 namespace __gnu_debug_def { }
 
 namespace __gnu_debug 
 { 
-  using namespace __gnu_debug_def __attribute__ ((strong));
+  using namespace __gnu_debug_def;
 }
 
+#ifdef _GLIBCXX_DEBUG
+# define _GLIBCXX_STD __gnu_norm
+namespace __gnu_norm 
+{ 
+  using namespace std; 
+}
 namespace std
 {
-#ifdef _GLIBCXX_DEBUG
   using namespace __gnu_debug_def __attribute__ ((strong));
+}
 #else
-  using namespace __gnu_norm __attribute__ ((strong));
+# define _GLIBCXX_STD std
 #endif
-}
+
 
 // The remainder of the prewritten config is automatic; all the
 // user hooks are listed above.
index 22fc573d9c0577070b440b482c9d51234a415070..e8e043886abbfee5e2fb36b6237f4d8b1e9eb79f 100644 (file)
@@ -61,7 +61,7 @@
 #ifndef _DEQUE_TCC
 #define _DEQUE_TCC 1
 
-namespace __gnu_norm
+namespace _GLIBCXX_STD
 {
   template <typename _Tp, typename _Alloc>
     deque<_Tp,_Alloc>&
@@ -714,6 +714,6 @@ namespace __gnu_norm
       this->_M_impl._M_start._M_set_node(__new_nstart);
       this->_M_impl._M_finish._M_set_node(__new_nstart + __old_num_nodes - 1);
     }
-} // namespace __gnu_norm
+} // namespace std
 
 #endif
index f712be2ab0b29a579d222012c4e70581ffd4a3a6..aaaa8c364bdffdcaedfa1bc109a2818fea1acb73 100644 (file)
@@ -61,7 +61,7 @@
 #ifndef _LIST_TCC
 #define _LIST_TCC 1
 
-namespace __gnu_norm
+namespace _GLIBCXX_STD
 {
   template<typename _Tp, typename _Alloc>
     void
@@ -371,7 +371,7 @@ namespace __gnu_norm
            swap( *(__fill-1) );
          }
       }
-} // namespace __gnu_norm
+} // namespace std
 
 #endif /* _LIST_TCC */
 
index 3ed04e5031be27cdbc8739b9aedc9f9085d3ba63..4ecdf4449259fa0439bb6955ba9419a78d97081c 100644 (file)
@@ -1,4 +1,4 @@
-// bit_vector and vector<bool> specialization -*- C++ -*-
+// vector<bool> specialization -*- C++ -*-
 
 // Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 //
@@ -61,7 +61,7 @@
 #ifndef _BVECTOR_H
 #define _BVECTOR_H 1
 
-namespace __gnu_norm
+namespace _GLIBCXX_STD
 {
   typedef unsigned long _Bit_type;
   enum { _S_word_bit = int(CHAR_BIT * sizeof(_Bit_type)) };
@@ -322,7 +322,8 @@ namespace __gnu_norm
       return *this;
     }
 
-    const_iterator operator+(difference_type __i) const {
+    const_iterator 
+    operator+(difference_type __i) const {
       const_iterator __tmp = *this;
       return __tmp += __i;
     }
@@ -345,47 +346,52 @@ namespace __gnu_norm
 
   template<class _Alloc>
     class _Bvector_base
-    : public _Alloc::template rebind<_Bit_type>::other
     {
       typedef typename _Alloc::template rebind<_Bit_type>::other
         _Bit_alloc_type;
+      
+      struct _Bvector_impl : public _Bit_alloc_type
+      {
+       _Bit_iterator   _M_start;
+       _Bit_iterator   _M_finish;
+       _Bit_type*      _M_end_of_storage;
+       _Bvector_impl(const _Bit_alloc_type& __a)
+       : _Bit_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage(0)
+       { }
+      };
 
     public:
       typedef _Alloc allocator_type;
 
       allocator_type
       get_allocator() const
-      { return *static_cast<const _Bit_alloc_type*>(this); }
+      { return *static_cast<const _Bit_alloc_type*>(&this->_M_impl); }
 
-      _Bvector_base(const allocator_type& __a)
-      : _Bit_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage(0) { }
+      _Bvector_base(const allocator_type& __a) : _M_impl(__a) { }
 
       ~_Bvector_base() { this->_M_deallocate(); }
 
     protected:
+      _Bvector_impl _M_impl;
+
       _Bit_type*
-      _M_bit_alloc(size_t __n)
-      { return _Bit_alloc_type::allocate((__n + _S_word_bit - 1)
-                                        / _S_word_bit); }
+      _M_allocate(size_t __n)
+      { return _M_impl.allocate((__n + _S_word_bit - 1) / _S_word_bit); }
 
       void
       _M_deallocate()
       {
-       if (_M_start._M_p)
-         _Bit_alloc_type::deallocate(_M_start._M_p,
-                                     _M_end_of_storage - _M_start._M_p);
+       if (_M_impl._M_start._M_p)
+         _M_impl.deallocate(_M_impl._M_start._M_p,
+                           _M_impl._M_end_of_storage - _M_impl._M_start._M_p);
       }
-
-      _Bit_iterator _M_start;
-      _Bit_iterator _M_finish;
-      _Bit_type* _M_end_of_storage;
     };
-} // namespace __gnu_norm
+} // namespace std
 
 // Declare a partial specialization of vector<T, Alloc>.
 #include <bits/stl_vector.h>
 
-namespace __gnu_norm
+namespace _GLIBCXX_STD
 {
   /**
    *  @brief  A specialization of vector for booleans which offers fixed time
@@ -429,41 +435,40 @@ template<typename _Alloc>
     { return _Bvector_base<_Alloc>::get_allocator(); }
 
   protected:
-    using _Bvector_base<_Alloc>::_M_bit_alloc;
+    using _Bvector_base<_Alloc>::_M_allocate;
     using _Bvector_base<_Alloc>::_M_deallocate;
-    using _Bvector_base<_Alloc>::_M_start;
-    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);
+      _Bit_type* __q = this->_M_allocate(__n);
+      this->_M_impl._M_end_of_storage = __q 
+                                      + (__n + _S_word_bit - 1) / _S_word_bit;
+      this->_M_impl._M_start = iterator(__q, 0);
+      this->_M_impl._M_finish = this->_M_start + difference_type(__n);
     }
 
     void _M_insert_aux(iterator __position, bool __x)
     {
-      if (this->_M_finish._M_p != this->_M_end_of_storage)
+      if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage)
        {
-         std::copy_backward(__position, this->_M_finish, this->_M_finish + 1);
+         std::copy_backward(__position, this->_M_impl._M_finish, 
+                            this->_M_impl._M_finish + 1);
          *__position = __x;
-         ++this->_M_finish;
+         ++this->_M_impl._M_finish;
        }
       else
        {
          const size_type __len = size() ? 2 * size()
                                         : static_cast<size_type>(_S_word_bit);
-         _Bit_type * __q = this->_M_bit_alloc(__len);
+         _Bit_type * __q = this->_M_allocate(__len);
          iterator __i = std::copy(begin(), __position, iterator(__q, 0));
          *__i++ = __x;
-         this->_M_finish = std::copy(__position, end(), __i);
+         this->_M_impl._M_finish = std::copy(__position, end(), __i);
          this->_M_deallocate();
-         this->_M_end_of_storage = __q + (__len + _S_word_bit - 1)
+         this->_M_impl._M_end_of_storage = __q + (__len + _S_word_bit - 1)
                                    / _S_word_bit;
-         this->_M_start = iterator(__q, 0);
+         this->_M_impl._M_start = iterator(__q, 0);
        }
     }
 
@@ -471,9 +476,9 @@ template<typename _Alloc>
     void _M_initialize_range(_InputIterator __first, _InputIterator __last,
                              input_iterator_tag)
     {
-      this->_M_start = iterator();
-      this->_M_finish = iterator();
-      this->_M_end_of_storage = 0;
+      this->_M_impl._M_start = iterator();
+      this->_M_impl._M_finish = iterator();
+      this->_M_impl._M_end_of_storage = 0;
       for ( ; __first != __last; ++__first)
         push_back(*__first);
     }
@@ -484,13 +489,12 @@ template<typename _Alloc>
     {
       const size_type __n = std::distance(__first, __last);
       _M_initialize(__n);
-      std::copy(__first, __last, this->_M_start);
+      std::copy(__first, __last, this->_M_impl._M_start);
     }
 
     template<class _InputIterator>
-    void _M_insert_range(iterator __pos,
-                         _InputIterator __first, _InputIterator __last,
-                         input_iterator_tag)
+    void _M_insert_range(iterator __pos, _InputIterator __first, 
+                        _InputIterator __last, input_iterator_tag)
     {
       for ( ; __first != __last; ++__first)
        {
@@ -500,9 +504,8 @@ template<typename _Alloc>
     }
 
     template<class _ForwardIterator>
-    void _M_insert_range(iterator __position,
-                         _ForwardIterator __first, _ForwardIterator __last,
-                         forward_iterator_tag)
+    void _M_insert_range(iterator __position, _ForwardIterator __first, 
+                        _ForwardIterator __last, forward_iterator_tag)
     {
       if (__first != __last)
        {
@@ -510,37 +513,37 @@ template<typename _Alloc>
          if (capacity() - size() >= __n)
            {
              std::copy_backward(__position, end(),
-                                this->_M_finish + difference_type(__n));
+                              this->_M_impl._M_finish + difference_type(__n));
              std::copy(__first, __last, __position);
-             this->_M_finish += difference_type(__n);
+             this->_M_impl._M_finish += difference_type(__n);
            }
          else
            {
              const size_type __len = size() + std::max(size(), __n);
-             _Bit_type * __q = this->_M_bit_alloc(__len);
+             _Bit_type * __q = this->_M_allocate(__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_impl._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);
+             this->_M_impl._M_end_of_storage = __q + (__len + _S_word_bit - 1)
+                                               / _S_word_bit;
+             this->_M_impl._M_start = iterator(__q, 0);
            }
        }
     }
 
   public:
     iterator begin()
-    { return this->_M_start; }
+    { return this->_M_impl._M_start; }
 
     const_iterator begin() const
-    { return this->_M_start; }
+    { return this->_M_impl._M_start; }
 
     iterator end()
-    { return this->_M_finish; }
+    { return this->_M_impl._M_finish; }
 
     const_iterator end() const
-    { return this->_M_finish; }
+    { return this->_M_impl._M_finish; }
 
     reverse_iterator rbegin()
     { return reverse_iterator(end()); }
@@ -561,7 +564,7 @@ template<typename _Alloc>
     { return size_type(-1); }
 
     size_type capacity() const
-    { return size_type(const_iterator(this->_M_end_of_storage, 0)
+    { return size_type(const_iterator(this->_M_impl._M_end_of_storage, 0)
                       - begin()); }
     bool empty() const
     { return begin() == end(); }
@@ -587,45 +590,49 @@ template<typename _Alloc>
     explicit vector(const allocator_type& __a = allocator_type())
       : _Bvector_base<_Alloc>(__a) { }
 
-    vector(size_type __n, bool __value,
+    vector(size_type __n, bool __value, 
           const allocator_type& __a = allocator_type())
-      : _Bvector_base<_Alloc>(__a)
+    : _Bvector_base<_Alloc>(__a)
     {
       _M_initialize(__n);
-      std::fill(this->_M_start._M_p, this->_M_end_of_storage, __value ? ~0 : 0);
+      std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_of_storage, 
+               __value ? ~0 : 0);
     }
 
     explicit vector(size_type __n)
-      : _Bvector_base<_Alloc>(allocator_type())
+    : _Bvector_base<_Alloc>(allocator_type())
     {
       _M_initialize(__n);
-      std::fill(this->_M_start._M_p, this->_M_end_of_storage, 0);
+      std::fill(this->_M_impl._M_start._M_p, 
+               this->_M_impl._M_end_of_storage, 0);
     }
 
     vector(const vector& __x) : _Bvector_base<_Alloc>(__x.get_allocator())
     {
       _M_initialize(__x.size());
-      std::copy(__x.begin(), __x.end(), this->_M_start);
+      std::copy(__x.begin(), __x.end(), this->_M_impl._M_start);
     }
 
     // Check whether it's an integral type.  If so, it's not an iterator.
-
     template<class _Integer>
     void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
     {
       _M_initialize(__n);
-      std::fill(this->_M_start._M_p, this->_M_end_of_storage, __x ? ~0 : 0);
+      std::fill(this->_M_impl._M_start._M_p, 
+               this->_M_impl._M_end_of_storage, __x ? ~0 : 0);
     }
 
     template<class _InputIterator>
-    void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
-                                __false_type)
-    { _M_initialize_range(__first, __last, std::__iterator_category(__first)); }
+      void 
+      _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
+                            __false_type)
+      { _M_initialize_range(__first, __last, 
+                           std::__iterator_category(__first)); }
 
     template<class _InputIterator>
-    vector(_InputIterator __first, _InputIterator __last,
-             const allocator_type& __a = allocator_type())
-      : _Bvector_base<_Alloc>(__a)
+      vector(_InputIterator __first, _InputIterator __last,
+            const allocator_type& __a = allocator_type())
+    : _Bvector_base<_Alloc>(__a)
     {
       typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
       _M_initialize_dispatch(__first, __last, _Integral());
@@ -643,7 +650,7 @@ template<typename _Alloc>
          _M_initialize(__x.size());
        }
       std::copy(__x.begin(), __x.end(), begin());
-      this->_M_finish = begin() + difference_type(__x.size());
+      this->_M_impl._M_finish = begin() + difference_type(__x.size());
       return *this;
     }
 
@@ -656,13 +663,15 @@ template<typename _Alloc>
     {
       if (__n > size())
        {
-         std::fill(this->_M_start._M_p, this->_M_end_of_storage, __x ? ~0 : 0);
+         std::fill(this->_M_impl._M_start._M_p, 
+                   this->_M_impl._M_end_of_storage, __x ? ~0 : 0);
          insert(end(), __n - size(), __x);
        }
       else
        {
          erase(begin() + __n, end());
-         std::fill(this->_M_start._M_p, this->_M_end_of_storage, __x ? ~0 : 0);
+         std::fill(this->_M_impl._M_start._M_p, 
+                   this->_M_impl._M_end_of_storage, __x ? ~0 : 0);
        }
     }
 
@@ -720,11 +729,12 @@ template<typename _Alloc>
        __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));
+         _Bit_type* __q = this->_M_allocate(__n);
+         this->_M_impl._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;
+         this->_M_impl._M_start = iterator(__q, 0);
+         this->_M_impl._M_end_of_storage = __q + (__n + _S_word_bit - 1) / _S_word_bit;
        }
     }
 
@@ -742,17 +752,18 @@ template<typename _Alloc>
 
     void push_back(bool __x)
     {
-      if (this->_M_finish._M_p != this->_M_end_of_storage)
-        *this->_M_finish++ = __x;
+      if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage)
+        *this->_M_impl._M_finish++ = __x;
       else
         _M_insert_aux(end(), __x);
     }
 
     void swap(vector<bool, _Alloc>& __x)
     {
-      std::swap(this->_M_start, __x._M_start);
-      std::swap(this->_M_finish, __x._M_finish);
-      std::swap(this->_M_end_of_storage, __x._M_end_of_storage);
+      std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
+      std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
+      std::swap(this->_M_impl._M_end_of_storage, 
+               __x._M_impl._M_end_of_storage);
     }
 
     // [23.2.5]/1, third-to-last entry in synopsis listing
@@ -766,9 +777,9 @@ template<typename _Alloc>
     iterator insert(iterator __position, bool __x = bool())
     {
       const difference_type __n = __position - begin();
-      if (this->_M_finish._M_p != this->_M_end_of_storage
+      if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage
          && __position == end())
-        *this->_M_finish++ = __x;
+        *this->_M_impl._M_finish++ = __x;
       else
         _M_insert_aux(__position, __x);
       return begin() + __n;
@@ -803,22 +814,22 @@ template<typename _Alloc>
       if (capacity() - size() >= __n)
        {
          std::copy_backward(__position, end(),
-                            this->_M_finish + difference_type(__n));
+                            this->_M_impl._M_finish + difference_type(__n));
          std::fill(__position, __position + difference_type(__n), __x);
-         this->_M_finish += difference_type(__n);
+         this->_M_impl._M_finish += difference_type(__n);
        }
       else
        {
          const size_type __len = size() + std::max(size(), __n);
-         _Bit_type * __q = this->_M_bit_alloc(__len);
+         _Bit_type * __q = this->_M_allocate(__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_impl._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);
+         this->_M_impl._M_end_of_storage = __q + (__len + _S_word_bit - 1)
+                                           / _S_word_bit;
+         this->_M_impl._M_start = iterator(__q, 0);
        }
     }
 
@@ -826,19 +837,19 @@ template<typename _Alloc>
     { _M_fill_insert(__position, __n, __x); }
 
     void pop_back()
-    { --this->_M_finish; }
+    { --this->_M_impl._M_finish; }
 
     iterator erase(iterator __position)
     {
       if (__position + 1 != end())
         std::copy(__position + 1, end(), __position);
-      --this->_M_finish;
+      --this->_M_impl._M_finish;
       return __position;
     }
 
     iterator erase(iterator __first, iterator __last)
     {
-      this->_M_finish = std::copy(__last, end(), __first);
+      this->_M_impl._M_finish = std::copy(__last, end(), __first);
       return __first;
     }
 
@@ -852,14 +863,14 @@ template<typename _Alloc>
 
     void flip()
     {
-      for (_Bit_type * __p = this->_M_start._M_p;
-          __p != this->_M_end_of_storage; ++__p)
+      for (_Bit_type * __p = this->_M_impl._M_start._M_p;
+          __p != this->_M_impl._M_end_of_storage; ++__p)
         *__p = ~*__p;
     }
 
     void clear()
     { erase(begin(), end()); }
   };
-} // namespace __gnu_norm
+} // namespace std
 
 #endif
index 5d237d5f3c157e0097cc582fc88d18ffd7a25464..c2f01a00d3102e9a60aca3fbd34076a43b2274a1 100644 (file)
@@ -65,7 +65,7 @@
 #include <bits/stl_iterator_base_types.h>
 #include <bits/stl_iterator_base_funcs.h>
 
-namespace __gnu_norm
+namespace _GLIBCXX_STD
 {
   /**
    *  @if maint
@@ -1496,6 +1496,6 @@ namespace __gnu_norm
     inline void
     swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y)
     { __x.swap(__y); }
-} // namespace __gnu_norm
+} // namespace std
 
 #endif /* _DEQUE_H */
index c0d821116c753918e07074e342d74c5a83c6b375..c94a0a9bf73b44c95d73b34a32309a0ac73a5442 100644 (file)
@@ -63,7 +63,7 @@
 
 #include <bits/concept_check.h>
 
-namespace __gnu_norm
+namespace _GLIBCXX_STD
 {
   // Supporting structures are split into common and templated types; the
   // latter publicly inherits from the former in an effort to reduce code
@@ -1247,7 +1247,7 @@ namespace __gnu_norm
     inline void
     swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
     { __x.swap(__y); }
-} // namespace __gnu_norm
+} // namespace std
 
 #endif /* _LIST_H */
 
index 3a563f174be45198b17c44f2789c02937f1279ff..bd78f57cdf90da3577e9cae9a8ea360e50a80ebe 100644 (file)
@@ -63,7 +63,7 @@
 
 #include <bits/concept_check.h>
 
-namespace __gnu_norm
+namespace _GLIBCXX_STD
 {
   /**
    *  @brief A standard container made up of (key,value) pairs, which can be
@@ -689,6 +689,6 @@ namespace __gnu_norm
     inline void
     swap(map<_Key,_Tp,_Compare,_Alloc>& __x, map<_Key,_Tp,_Compare,_Alloc>& __y)
     { __x.swap(__y); }
-} // namespace __gnu_norm
+} // namespace std
 
 #endif /* _MAP_H */
index cbc7b07a804c741a93f633938e978ed3bb889624..c44aa74a6923f21bf990b7ba938e8b97b0bd0d04 100644 (file)
@@ -63,7 +63,7 @@
 
 #include <bits/concept_check.h>
 
-namespace __gnu_norm
+namespace _GLIBCXX_STD
 {
   // Forward declaration of operators < and ==, needed for friend declaration.
 
@@ -673,6 +673,6 @@ namespace __gnu_norm
     swap(multimap<_Key,_Tp,_Compare,_Alloc>& __x,
          multimap<_Key,_Tp,_Compare,_Alloc>& __y)
     { __x.swap(__y); }
-} // namespace __gnu_norm
+} // namespace std
 
 #endif /* _MULTIMAP_H */
index 887899670b76b28dd169fca8758d1f4a113961ff..c82dee68e4efcb51ef97027be1a97069714b2312 100644 (file)
@@ -63,7 +63,7 @@
 
 #include <bits/concept_check.h>
 
-namespace __gnu_norm
+namespace _GLIBCXX_STD
 {
 
   // Forward declaration of operators < and ==, needed for friend declaration.
@@ -580,6 +580,6 @@ namespace __gnu_norm
         multiset<_Key,_Compare,_Alloc>& __y)
     { __x.swap(__y); }
 
-} // namespace __gnu_norm
+} // namespace std
 
 #endif /* _MULTISET_H */
index 28e1a3ceb30de2cf6d752889b63e13e394e89142..bb28bddc7af991b90e16797a45298c815da7421d 100644 (file)
@@ -63,7 +63,7 @@
 
 #include <bits/concept_check.h>
 
-namespace __gnu_norm
+namespace _GLIBCXX_STD
 {
   // Forward declarations of operators < and ==, needed for friend declaration.
   template<class _Key, class _Compare = less<_Key>,
@@ -588,6 +588,6 @@ namespace __gnu_norm
     swap(set<_Key,_Compare,_Alloc>& __x, set<_Key,_Compare,_Alloc>& __y)
     { __x.swap(__y); }
 
-} // namespace __gnu_norm
+} // namespace std
 
 #endif /* _SET_H */
index 10adb6368bed495c92751a89f7f66e7eea041f67..b025393a741892405617a2125be6bedfef63d4ae 100644 (file)
@@ -65,7 +65,7 @@
 #include <bits/functexcept.h>
 #include <bits/concept_check.h>
 
-namespace __gnu_norm
+namespace _GLIBCXX_STD
 {
   /**
    *  @if maint
@@ -927,6 +927,6 @@ namespace __gnu_norm
     inline void
     swap(vector<_Tp,_Alloc>& __x, vector<_Tp,_Alloc>& __y)
     { __x.swap(__y); }
-} // namespace __gnu_norm
+} // namespace std
 
 #endif /* _VECTOR_H */
index dd459a53431bf3f91ffda833d3a0fbc0ff148a39..abd1ba76250eb5eaccb738b9670046b679e06c66 100644 (file)
@@ -61,7 +61,7 @@
 #ifndef _VECTOR_TCC
 #define _VECTOR_TCC 1
 
-namespace __gnu_norm
+namespace _GLIBCXX_STD
 {
   template<typename _Tp, typename _Alloc>
     void
@@ -409,6 +409,6 @@ namespace __gnu_norm
         }
       }
     }
-} // namespace __gnu_norm
+} // namespace std
 
 #endif /* _VECTOR_TCC */
index 1d8875aaa8ac8caea905cf988ed30b9433ab4760..2e2364ff9300dfc06730a2ae864d94e45e010dbf 100644 (file)
@@ -1,6 +1,6 @@
 // Debugging bitset implementation -*- C++ -*-
 
-// Copyright (C) 2003
+// Copyright (C) 2003, 2004
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -39,9 +39,10 @@ namespace __gnu_debug_def
 {
   template<size_t _Nb>
     class bitset
-    : public __gnu_norm::bitset<_Nb>, public __gnu_debug::_Safe_sequence_base
+    : public _GLIBCXX_STD::bitset<_Nb>, 
+      public __gnu_debug::_Safe_sequence_base
     {
-      typedef  __gnu_norm::bitset<_Nb>         _Base;
+      typedef _GLIBCXX_STD::bitset<_Nb> _Base;
       typedef __gnu_debug::_Safe_sequence_base  _Safe_base;
 
     public:
index ed68b37a79867d6468721467e7d79bf656c34592..c39a49c04610595f54ff718f248a4768104601d5 100644 (file)
@@ -1,6 +1,6 @@
 // Debugging deque implementation -*- C++ -*-
 
-// Copyright (C) 2003
+// Copyright (C) 2003, 2004
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -39,10 +39,10 @@ namespace __gnu_debug_def
 {
   template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
     class deque
-    : public  __gnu_norm::deque<_Tp, _Allocator>,
-    public __gnu_debug::_Safe_sequence<deque<_Tp, _Allocator> >
+    : public _GLIBCXX_STD::deque<_Tp, _Allocator>,
+      public __gnu_debug::_Safe_sequence<deque<_Tp, _Allocator> >
     {
-      typedef  __gnu_norm::deque<_Tp, _Allocator> _Base;
+      typedef  _GLIBCXX_STD::deque<_Tp, _Allocator> _Base;
       typedef __gnu_debug::_Safe_sequence<deque> _Safe_base;
 
     public:
index 6ed00bd868e6f31ce304a42b1c02908fac6c2656..7022fa7007771324b9ccd3b67aec9e0537efa227 100644 (file)
@@ -1,6 +1,6 @@
 // Debug-mode error formatting implementation -*- C++ -*-
 
-// Copyright (C) 2003
+// Copyright (C) 2003, 2004
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -36,7 +36,7 @@
 
 namespace __gnu_debug
 {
-  using namespace std;
+  using std::type_info;
 
   /** Determine if the two types are the same. */
   template<typename _Type1, typename _Type2>
index f9bb9f9435cc423f02f817fb93f6bcef9a312a3e..556c9d9acff7f6b044bc79e5ff55f0c53f401605 100644 (file)
@@ -1,6 +1,6 @@
 // Debugging list implementation -*- C++ -*-
 
-// Copyright (C) 2003
+// Copyright (C) 2003, 2004
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -40,10 +40,10 @@ namespace __gnu_debug_def
 {
   template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
     class list
-    : public __gnu_norm::list<_Tp, _Allocator>,
+    : public _GLIBCXX_STD::list<_Tp, _Allocator>,
       public __gnu_debug::_Safe_sequence<list<_Tp, _Allocator> >
     {
-      typedef __gnu_norm::list<_Tp, _Allocator> _Base;
+      typedef _GLIBCXX_STD::list<_Tp, _Allocator> _Base;
       typedef __gnu_debug::_Safe_sequence<list>  _Safe_base;
 
     public:
@@ -76,7 +76,7 @@ namespace __gnu_debug_def
       template<class _InputIterator>
       list(_InputIterator __first, _InputIterator __last,
           const _Allocator& __a = _Allocator())
-       : _Base(__gnu_debug::__check_valid_range(__first, __last), __last, __a)
+      : _Base(__gnu_debug::__check_valid_range(__first, __last), __last, __a)
       { }
 
 
index 9470e667434eff93d2f113ae4207dbf1ba6573a8..2a6794b31e0eab147fac96ac40bce80c17773c7a 100644 (file)
@@ -1,6 +1,6 @@
 // Debugging map implementation -*- C++ -*-
 
-// Copyright (C) 2003
+// Copyright (C) 2003, 2004
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -40,10 +40,10 @@ namespace __gnu_debug_def
   template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
           typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
     class map
-    : public __gnu_norm::map<_Key, _Tp, _Compare, _Allocator>,
+    : public _GLIBCXX_STD::map<_Key, _Tp, _Compare, _Allocator>,
       public __gnu_debug::_Safe_sequence<map<_Key, _Tp, _Compare, _Allocator> >
     {
-      typedef __gnu_norm::map<_Key, _Tp, _Compare, _Allocator> _Base;
+      typedef _GLIBCXX_STD::map<_Key, _Tp, _Compare, _Allocator> _Base;
       typedef __gnu_debug::_Safe_sequence<map> _Safe_base;
 
     public:
index 3772c31dc698913e7f83052bba5cf81b3be30859..4de1e3b58f47b06c71e85c2c1eb42c65dd94218f 100644 (file)
@@ -1,6 +1,6 @@
 // Debugging multimap implementation -*- C++ -*-
 
-// Copyright (C) 2003
+// Copyright (C) 2003, 2004
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -40,10 +40,10 @@ namespace __gnu_debug_def
   template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
           typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
     class multimap
-    : public __gnu_norm::multimap<_Key, _Tp, _Compare, _Allocator>,
+    : public _GLIBCXX_STD::multimap<_Key, _Tp, _Compare, _Allocator>,
     public __gnu_debug::_Safe_sequence<multimap<_Key,_Tp,_Compare,_Allocator> >
     {
-      typedef __gnu_norm::multimap<_Key, _Tp, _Compare, _Allocator> _Base;
+      typedef _GLIBCXX_STD::multimap<_Key, _Tp, _Compare, _Allocator> _Base;
       typedef __gnu_debug::_Safe_sequence<multimap> _Safe_base;
 
     public:
index 19bc29a960a8022a2c38823714c2e1d901681b97..92042fef68cefd18f469948da43d6c189f283259 100644 (file)
@@ -1,6 +1,6 @@
 // Debugging multiset implementation -*- C++ -*-
 
-// Copyright (C) 2003
+// Copyright (C) 2003, 2004
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -40,10 +40,10 @@ namespace __gnu_debug_def
   template<typename _Key, typename _Compare = std::less<_Key>,
           typename _Allocator = std::allocator<_Key> >
     class multiset
-    : public __gnu_norm::multiset<_Key, _Compare, _Allocator>,
+    : public _GLIBCXX_STD::multiset<_Key, _Compare, _Allocator>,
       public __gnu_debug::_Safe_sequence<multiset<_Key, _Compare, _Allocator> >
     {
-      typedef __gnu_norm::multiset<_Key, _Compare, _Allocator> _Base;
+      typedef _GLIBCXX_STD::multiset<_Key, _Compare, _Allocator> _Base;
       typedef __gnu_debug::_Safe_sequence<multiset> _Safe_base;
 
     public:
index 72ba3b52f10bd5051326d907583e3e6faf7d8918..7482d6caa6598e2abb7bcb21284773a064f1bd2c 100644 (file)
@@ -1,6 +1,6 @@
 // Safe iterator implementation  -*- C++ -*-
 
-// Copyright (C) 2003
+// Copyright (C) 2003, 2004
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -38,6 +38,9 @@
 
 namespace __gnu_debug
 {
+  using std::iterator_traits;
+  using std::pair;
+
   /** Iterators that derive from _Safe_iterator_base but that aren't
    *  _Safe_iterators can be determined singular or non-singular via
    *  _Safe_iterator_base.
index b9200adf233c8421dd485282bf7500630241c79d..8656cb0aff676fe1eba99c441d7d11ba2e7d6890 100644 (file)
@@ -1,6 +1,6 @@
 // Debugging set implementation -*- C++ -*-
 
-// Copyright (C) 2003
+// Copyright (C) 2003, 2004
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -40,10 +40,10 @@ namespace __gnu_debug_def
   template<typename _Key, typename _Compare = std::less<_Key>,
           typename _Allocator = std::allocator<_Key> >
     class set
-    : public __gnu_norm::set<_Key,_Compare,_Allocator>,
+    : public _GLIBCXX_STD::set<_Key,_Compare,_Allocator>,
       public __gnu_debug::_Safe_sequence<set<_Key, _Compare, _Allocator> >
     {
-      typedef __gnu_norm::set<_Key,_Compare,_Allocator> _Base;
+      typedef _GLIBCXX_STD::set<_Key,_Compare,_Allocator> _Base;
       typedef __gnu_debug::_Safe_sequence<set> _Safe_base;
 
     public:
index f7fa3e8f092e81957a15441abad5a3e5499404bb..0cc2997b9754b2e0abfd04d5d1115042d8116e9f 100644 (file)
@@ -1,6 +1,6 @@
 // Debugging vector implementation -*- C++ -*-
 
-// Copyright (C) 2003
+// Copyright (C) 2003, 2004
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -41,10 +41,10 @@ namespace __gnu_debug_def
   template<typename _Tp,
           typename _Allocator = std::allocator<_Tp> >
     class vector
-    : public __gnu_norm::vector<_Tp, _Allocator>,
+    : public _GLIBCXX_STD::vector<_Tp, _Allocator>,
       public __gnu_debug::_Safe_sequence<vector<_Tp, _Allocator> >
     {
-      typedef __gnu_norm::vector<_Tp, _Allocator> _Base;
+      typedef _GLIBCXX_STD::vector<_Tp, _Allocator> _Base;
       typedef __gnu_debug::_Safe_sequence<vector>              _Safe_base;
 
       typedef typename _Base::const_iterator _Base_const_iterator;
index 04249eca4f8973197b020f71c786e5c3e0101599..fba62c15bcacb4940af0adc5330c7cf6e6fa8311 100644 (file)
 #include <ostream>     // For ostream (operator<<)
 #include <istream>     // For istream (operator>>)
 
-
 #define _GLIBCXX_BITSET_BITS_PER_WORD  numeric_limits<unsigned long>::digits
 #define _GLIBCXX_BITSET_WORDS(__n) \
  ((__n) < 1 ? 0 : ((__n) + _GLIBCXX_BITSET_BITS_PER_WORD - 1)/_GLIBCXX_BITSET_BITS_PER_WORD)
 
-namespace __gnu_norm
+namespace _GLIBCXX_STD
 {
   /**
    *  @if maint
@@ -1218,7 +1217,7 @@ namespace __gnu_norm
       return __os << __tmp;
     }
   //@}
-} // namespace __gnu_norm
+} // namespace std
 
 #undef _GLIBCXX_BITSET_WORDS
 #undef _GLIBCXX_BITSET_BITS_PER_WORD
index d70d1af3ad130f7b429ae9e9819e307516114806..ed4c7107901025eb8e7ceb4d2670057308817430 100644 (file)
@@ -101,6 +101,7 @@ sources = \
        complex_io.cc \
        ctype.cc \
        debug.cc \
+       debug_list.cc \
        functexcept.cc \
        globals_locale.cc \
        globals_io.cc \
index 9c4f48330ca6c360fe23ef68bd41dcb027cf1672..aa192c2b1e2e5d307e80b8b6c688bd02b896224b 100644 (file)
@@ -59,12 +59,12 @@ am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \
        numeric_members.lo time_members.lo
 am__objects_2 = basic_file.lo c++locale.lo
 am__objects_3 = allocator.lo codecvt.lo complex_io.lo ctype.lo \
-       debug.lo functexcept.lo globals_locale.lo globals_io.lo ios.lo \
-       ios_failure.lo ios_init.lo ios_locale.lo limits.lo list.lo \
-       locale.lo locale_init.lo locale_facets.lo localename.lo \
-       stdexcept.lo strstream.lo tree.lo allocator-inst.lo \
-       concept-inst.lo fstream-inst.lo ext-inst.lo io-inst.lo \
-       istream-inst.lo locale-inst.lo locale-misc-inst.lo \
+       debug.lo debug_list.lo functexcept.lo globals_locale.lo \
+       globals_io.lo ios.lo ios_failure.lo ios_init.lo ios_locale.lo \
+       limits.lo list.lo locale.lo locale_init.lo locale_facets.lo \
+       localename.lo stdexcept.lo strstream.lo tree.lo \
+       allocator-inst.lo concept-inst.lo fstream-inst.lo ext-inst.lo \
+       io-inst.lo istream-inst.lo locale-inst.lo locale-misc-inst.lo \
        misc-inst.lo ostream-inst.lo sstream-inst.lo streambuf-inst.lo \
        string-inst.lo valarray-inst.lo wlocale-inst.lo \
        wstring-inst.lo $(am__objects_1) $(am__objects_2)
@@ -299,6 +299,7 @@ sources = \
        complex_io.cc \
        ctype.cc \
        debug.cc \
+       debug_list.cc \
        functexcept.cc \
        globals_locale.cc \
        globals_io.cc \
diff --git a/libstdc++-v3/src/debug_list.cc b/libstdc++-v3/src/debug_list.cc
new file mode 100644 (file)
index 0000000..3d14b28
--- /dev/null
@@ -0,0 +1,34 @@
+// Debugging mode support code for list -*- C++ -*-
+
+// Copyright (C) 2004 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#define _GLIBCXX_DEBUG
+
+#include <bits/c++config.h>
+
+#include "list.cc"
index 2be2d7131938b752984c62653a37771502e0a113..ec94053b41116425d5ebbad7c3275adf2f0c245a 100644 (file)
@@ -55,7 +55,7 @@
 
 #include <list>
 
-namespace __gnu_norm
+namespace _GLIBCXX_STD
 {
   void
   _List_node_base::swap(_List_node_base& __x, _List_node_base& __y)
@@ -121,7 +121,7 @@ namespace __gnu_norm
   }
 
   void
-  _List_node_base::hook(_List_node_base * const __position)
+  _List_node_base::hook(_List_node_base* const __position)
   {
     this->_M_next = __position;
     this->_M_prev = __position->_M_prev;
@@ -137,5 +137,5 @@ namespace __gnu_norm
     __prev_node->_M_next = __next_node;
     __next_node->_M_prev = __prev_node;
   }
-} // namespace __gnu_norm
+} // namespace std
 
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/clear_allocator.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/clear_allocator.cc
new file mode 100644 (file)
index 0000000..ff17716
--- /dev/null
@@ -0,0 +1,88 @@
+// Copyright (C) 2004 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <vector>
+#include <ext/new_allocator.h>
+
+using namespace std;
+using __gnu_cxx::new_allocator;
+
+template<typename T>
+  class clear_alloc : public new_allocator<T> 
+  {
+  public:
+
+    template <typename T1>
+      struct rebind 
+      { typedef clear_alloc<T1> other; };
+
+    virtual void clear() throw()
+    { }
+
+    clear_alloc() throw()
+    { }
+    
+    clear_alloc(clear_alloc const& _wa) throw()
+    { }
+    
+    template<typename T1>
+      clear_alloc(clear_alloc<T1> const& _wa) throw()
+      { }
+
+    virtual ~clear_alloc() throw()
+    { this->clear(); }
+
+    T* allocate(typename new_allocator<T>::size_type n, const void *hint = 0)
+    {
+      this->clear();
+      return new_allocator<T>::allocate(n, hint);
+    }
+    
+    void deallocate(T *ptr, typename new_allocator<T>::size_type n)
+    {
+      this->clear();
+      new_allocator<T>::deallocate(ptr, n);
+    }
+  };
+
+template<typename Container>
+  void Check_Container()
+  {
+    Container* pic = new Container;
+    int x = 230;
+    
+    while (x--)
+      {
+       pic->push_back(x);
+      }
+    
+    pic->get_allocator();
+    
+    // The following has led to infinite recursions or cores.
+    pic->clear();
+
+    delete pic;
+  }
+
+
+int main()
+{
+  Check_Container<std::vector<bool, clear_alloc<bool> > >();
+  return 0;
+}
+