]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
mt_allocator.h (__common_pool_policy): Add template template parameter for pool class...
authorBenjamin Kosnik <bkoz@redhat.com>
Thu, 28 Oct 2004 20:46:08 +0000 (20:46 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Thu, 28 Oct 2004 20:46:08 +0000 (20:46 +0000)
2004-10-28  Benjamin Kosnik  <bkoz@redhat.com>

* include/ext/mt_allocator.h (__common_pool_policy): Add template
template parameter for pool class type.
(__per_type_pool_policy): Same.
(__mt_allocator): Don't inherit policy. Qualify policy_type calls.
* testsuite/ext/mt_allocator/check_deallocate_null.cc: Fix.
* testsuite/ext/mt_allocator/check_deallocate_null_thread.cc: Same.
* testsuite/ext/mt_allocator/deallocate_global-2.cc: Same.
* testsuite/ext/mt_allocator/deallocate_global-4.cc: Same.
* testsuite/ext/mt_allocator/deallocate_global_thread-1.cc: Same.
* testsuite/ext/mt_allocator/deallocate_global_thread-3.cc: Same.
* testsuite/ext/mt_allocator/deallocate_local-2.cc: Same.
* testsuite/ext/mt_allocator/deallocate_local-4.cc: Same.
* testsuite/ext/mt_allocator/deallocate_local_thread-1.cc: Same.
* testsuite/ext/mt_allocator/deallocate_local_thread-3.cc: Same.
* testsuite/ext/mt_allocator/instantiate.cc: Same.
* testsuite/ext/mt_allocator/tune-1.cc: Same.
* testsuite/ext/mt_allocator/tune-2.cc: Same.
* testsuite/ext/mt_allocator/tune-3.cc: Same.
* testsuite/ext/mt_allocator/tune-4.cc: Same.

From-SVN: r89776

17 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/ext/mt_allocator.h
libstdc++-v3/testsuite/ext/mt_allocator/check_deallocate_null.cc
libstdc++-v3/testsuite/ext/mt_allocator/check_deallocate_null_thread.cc
libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global-2.cc
libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global-4.cc
libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-1.cc
libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-3.cc
libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-2.cc
libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-4.cc
libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-1.cc
libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-3.cc
libstdc++-v3/testsuite/ext/mt_allocator/instantiate.cc
libstdc++-v3/testsuite/ext/mt_allocator/tune-1.cc
libstdc++-v3/testsuite/ext/mt_allocator/tune-2.cc
libstdc++-v3/testsuite/ext/mt_allocator/tune-3.cc
libstdc++-v3/testsuite/ext/mt_allocator/tune-4.cc

index 0d1c4c08886323497d80f2e5be95d7cd560c1d34..561c3670dc6045e612d01ab5d082116f758c5e83 100644 (file)
@@ -1,3 +1,25 @@
+2004-10-28  Benjamin Kosnik  <bkoz@redhat.com>
+
+       * include/ext/mt_allocator.h (__common_pool_policy): Add template
+       template parameter for pool class type.
+       (__per_type_pool_policy): Same.
+       (__mt_allocator): Don't inherit policy. Qualify policy_type calls.
+       * testsuite/ext/mt_allocator/check_deallocate_null.cc: Fix.
+       * testsuite/ext/mt_allocator/check_deallocate_null_thread.cc: Same.
+       * testsuite/ext/mt_allocator/deallocate_global-2.cc: Same.
+       * testsuite/ext/mt_allocator/deallocate_global-4.cc: Same.
+       * testsuite/ext/mt_allocator/deallocate_global_thread-1.cc: Same.
+       * testsuite/ext/mt_allocator/deallocate_global_thread-3.cc: Same.
+       * testsuite/ext/mt_allocator/deallocate_local-2.cc: Same.
+       * testsuite/ext/mt_allocator/deallocate_local-4.cc: Same.
+       * testsuite/ext/mt_allocator/deallocate_local_thread-1.cc: Same.
+       * testsuite/ext/mt_allocator/deallocate_local_thread-3.cc: Same.
+       * testsuite/ext/mt_allocator/instantiate.cc: Same.
+       * testsuite/ext/mt_allocator/tune-1.cc: Same.
+       * testsuite/ext/mt_allocator/tune-2.cc: Same.
+       * testsuite/ext/mt_allocator/tune-3.cc: Same.
+       * testsuite/ext/mt_allocator/tune-4.cc: Same.
+
 2004-10-28  Paolo Carlini  <pcarlini@suse.de>
 
        * include/bits/locale_facets.tcc (num_get<>::_M_extract_float):
index 6649111a6e7d3f11b5f42a88bb908639eb3db036..e5dab29e6d8ac702388ab1789adcbe6fbfedde7d 100644 (file)
@@ -65,7 +65,7 @@ namespace __gnu_cxx
     // Variables used to configure the behavior of the allocator,
     // assigned and explained in detail below.
     struct _Tune
-    {
+     {
       // Compile time constants for the default _Tune values.
       enum { _S_align = 8 };
       enum { _S_max_bytes = 128 };
@@ -129,19 +129,6 @@ namespace __gnu_cxx
       _M_chunk_size(__chunk), _M_max_threads(__maxthreads),
       _M_freelist_headroom(__headroom), _M_force_new(__force)
       { }
-      
-      bool
-      is_default() const
-      {
-       bool __ret = true;
-       __ret &= _M_align == _S_align;
-       __ret &= _M_max_bytes == _S_max_bytes;
-       __ret &= _M_min_bin == _S_min_bin;
-       __ret &= _M_chunk_size == _S_chunk_size;
-       __ret &= _M_max_threads == _S_max_threads;
-       __ret &= _M_freelist_headroom == _S_freelist_headroom;
-       return __ret;
-      }
     };
     
     struct _Block_address
@@ -173,11 +160,20 @@ namespace __gnu_cxx
     _M_get_align()
     { return _M_options._M_align; }
 
-    explicit __pool_base() 
+    explicit 
+    __pool_base() 
     : _M_options(_Tune()), _M_binmap(NULL), _M_init(false) { }
 
-    explicit __pool_base(const _Tune& __tune) 
-    : _M_options(__tune), _M_binmap(NULL), _M_init(false) { }
+    explicit 
+    __pool_base(const _Tune& __options)
+    : _M_options(__options), _M_binmap(NULL), _M_init(false) { }
+
+  private:
+    explicit 
+    __pool_base(const __pool_base&);
+
+    __pool_base&
+    operator=(const __pool_base&);
 
   protected:
     // Configuration options.
@@ -185,8 +181,9 @@ namespace __gnu_cxx
     
     _Binmap_type*              _M_binmap;
 
-    // We need to create the initial lists and set up some variables
-    // before we can answer to the first request for memory.
+    // Configuration of the pool object via _M_options can happen
+    // after construction but before initialization. After
+    // initialization is complete, this variable is set to true.
     bool                       _M_init;
   };
 
@@ -201,9 +198,74 @@ namespace __gnu_cxx
   template<>
     class __pool<false>;
 
+  // Specialization for single thread.
+  template<>
+    class __pool<false> : public __pool_base
+    {
+    public:
+      union _Block_record
+      {
+       // Points to the block_record of the next free block.
+       _Block_record* volatile         _M_next;
+      };
+
+      struct _Bin_record
+      {
+       // An "array" of pointers to the first free block.
+       _Block_record** volatile        _M_first;
 
+       // A list of the initial addresses of all allocated blocks.
+       _Block_address*                 _M_address;
+      };
+      
+      void
+      _M_initialize_once()
+      {
+       if (__builtin_expect(_M_init == false, false))
+         _M_initialize();
+      }
+
+      void
+      _M_destroy() throw();
+
+      char* 
+      _M_reserve_block(size_t __bytes, const size_t __thread_id);
+    
+      void
+      _M_reclaim_block(char* __p, size_t __bytes);
+    
+      size_t 
+      _M_get_thread_id() { return 0; }
+      
+      const _Bin_record&
+      _M_get_bin(size_t __which)
+      { return _M_bin[__which]; }
+      
+      void
+      _M_adjust_freelist(const _Bin_record&, _Block_record*, size_t)
+      { }
+
+      explicit __pool() 
+      : _M_bin(NULL), _M_bin_size(1) { }
+
+      explicit __pool(const __pool_base::_Tune& __tune) 
+      : __pool_base(__tune), _M_bin(NULL), _M_bin_size(1) { }
+
+    private:
+      // An "array" of bin_records each of which represents a specific
+      // power of 2 size. Memory to this "array" is allocated in
+      // _M_initialize().
+      _Bin_record* volatile    _M_bin;
+      
+      // Actual value calculated in _M_initialize().
+      size_t                   _M_bin_size;     
+
+      void
+      _M_initialize();
+  };
 #ifdef __GTHREADS
-  // Specialization for thread enabled, via gthreads.h.
+   // Specialization for thread enabled, via gthreads.h.
   template<>
     class __pool<true> : public __pool_base
     {
@@ -326,8 +388,6 @@ namespace __gnu_cxx
        _M_once = __tmp;
       }
 
-      ~__pool() { }
-
     private:
       // An "array" of bin_records each of which represents a specific
       // power of 2 size. Memory to this "array" is allocated in
@@ -344,94 +404,24 @@ namespace __gnu_cxx
     };
 #endif
 
-  // Specialization for single thread.
-  template<>
-    class __pool<false> : public __pool_base
-    {
-    public:
-      union _Block_record
-      {
-       // Points to the block_record of the next free block.
-       _Block_record* volatile         _M_next;
-      };
-
-      struct _Bin_record
-      {
-       // An "array" of pointers to the first free block.
-       _Block_record** volatile        _M_first;
 
-       // A list of the initial addresses of all allocated blocks.
-       _Block_address*                 _M_address;
-      };
-      
-      void
-      _M_initialize_once()
-      {
-       if (__builtin_expect(_M_init == false, false))
-         _M_initialize();
-      }
+  template<template <bool> class _PoolTp, bool _Thread>
+    struct __common_pool_policy;
 
-      void
-      _M_destroy() throw();
-
-      char* 
-      _M_reserve_block(size_t __bytes, const size_t __thread_id);
-    
-      void
-      _M_reclaim_block(char* __p, size_t __bytes);
-    
-      size_t 
-      _M_get_thread_id() { return 0; }
-      
-      const _Bin_record&
-      _M_get_bin(size_t __which)
-      { return _M_bin[__which]; }
-      
-      void
-      _M_adjust_freelist(const _Bin_record&, _Block_record*, size_t)
-      { }
-
-      explicit __pool() 
-      : _M_bin(NULL), _M_bin_size(1) { }
-
-      explicit __pool(const __pool_base::_Tune& __tune) 
-      : __pool_base(__tune), _M_bin(NULL), _M_bin_size(1) { }
-
-      ~__pool() { }
-
-    private:
-      // An "array" of bin_records each of which represents a specific
-      // power of 2 size. Memory to this "array" is allocated in
-      // _M_initialize().
-      _Bin_record* volatile    _M_bin;
-      
-      // Actual value calculated in _M_initialize().
-      size_t                   _M_bin_size;     
-
-      void
-      _M_initialize();
-  };
-
-  template<bool _Thread>
-    struct __common_pool_policy 
+  template<template <bool> class _PoolTp>
+    struct __common_pool_policy<_PoolTp, false>
     {
-      typedef __pool<_Thread> __pool_type;
-
-      template<typename _Tp1, bool _Thread1 = _Thread>
-        struct _M_rebind;
-
-      template<typename _Tp1>
-        struct _M_rebind<_Tp1, true>
-        { typedef __common_pool_policy<true> other; };
-
-      template<typename _Tp1>
-        struct _M_rebind<_Tp1, false>
-        { typedef __common_pool_policy<false> other; };
+      typedef _PoolTp<false> pool_type;
+      
+      template<typename _Tp1, template <bool> class _PoolTp1 = _PoolTp, 
+              bool _Thread1 = false>
+        struct _M_rebind
+        { typedef __common_pool_policy<_PoolTp1, _Thread1> other; };
 
-      static __pool_type&
+      static pool_type&
       _S_get_pool()
       { 
-       static __pool_type _S_pool;
+       static pool_type _S_pool;
        return _S_pool;
       }
 
@@ -447,41 +437,24 @@ namespace __gnu_cxx
       }
     };
 
-  template<>
-    struct __common_pool_policy<true>;
-
 #ifdef __GTHREADS
-  template<>
-    struct __common_pool_policy<true>
+  template<template <bool> class _PoolTp>
+    struct __common_pool_policy<_PoolTp, true>
     {
-      typedef __pool<true> __pool_type;
-
-      template<typename _Tp1, bool _Thread1 = true>
-        struct _M_rebind;
-
-      template<typename _Tp1>
-        struct _M_rebind<_Tp1, true>
-        { typedef __common_pool_policy<true> other; };
-
-      template<typename _Tp1>
-        struct _M_rebind<_Tp1, false>
-        { typedef __common_pool_policy<false> other; };
+      typedef _PoolTp<true> pool_type;
+      
+      template<typename _Tp1, template <bool> class _PoolTp1 = _PoolTp, 
+              bool _Thread1 = true>
+        struct _M_rebind
+        { typedef __common_pool_policy<_PoolTp1, _Thread1> other; };
 
-      static __pool_type&
+      static pool_type&
       _S_get_pool()
       { 
-       static __pool_type _S_pool;
+       static pool_type _S_pool;
        return _S_pool;
       }
 
-      static void
-      _S_destroy_thread_key(void* __freelist_pos)
-      { _S_get_pool()._M_destroy_thread_key(__freelist_pos); }
-      
-      static void
-      _S_initialize() 
-      { _S_get_pool()._M_initialize(_S_destroy_thread_key); }
-
       static void
       _S_initialize_once() 
       { 
@@ -492,34 +465,40 @@ namespace __gnu_cxx
            __init = true;
          }
       }
+
+    private:
+      static void
+      _S_destroy_thread_key(void* __freelist_pos)
+      { _S_get_pool()._M_destroy_thread_key(__freelist_pos); }
+      
+      static void
+      _S_initialize() 
+      { _S_get_pool()._M_initialize(_S_destroy_thread_key); }
    };
 #endif
 
+  template<typename _Tp, template <bool> class _PoolTp, bool _Thread>
+    struct __per_type_pool_policy;
 
-  template<typename _Tp, bool _Thread>
-    struct __per_type_pool_policy
+  template<typename _Tp, template <bool> class _PoolTp>
+    struct __per_type_pool_policy<_Tp, _PoolTp, false>
     {
-      typedef __pool<_Thread> __pool_type;
-
-      template<typename _Tp1, bool _Thread1 = _Thread>
-        struct _M_rebind;
+      typedef _Tp value_type;
+      typedef _PoolTp<false> pool_type;
 
-      template<typename _Tp1>
-        struct _M_rebind<_Tp1, false>
-        { typedef __per_type_pool_policy<_Tp1, false> other; };
+      template<typename _Tp1, template <bool> class _PoolTp1 = _PoolTp, 
+              bool _Thread1 = false>
+        struct _M_rebind
+        { typedef __per_type_pool_policy<_Tp1, _PoolTp1, _Thread1> other; };
 
-      template<typename _Tp1>
-        struct _M_rebind<_Tp1, true>
-        { typedef __per_type_pool_policy<_Tp1, true> other; };
-
-      // Avoid static initialization ordering issues.
-      static __pool_type&
-      _S_get_pool() 
+      static pool_type&
+      _S_get_pool()
       { 
-       // Sane defaults for the __pool_type.
-       const static size_t __align = __alignof__(_Tp) >= sizeof(typename __pool_type::_Block_record) ? __alignof__(_Tp) : sizeof(typename __pool_type::_Block_record);
-       static __pool_base::_Tune _S_tune(__align, sizeof(_Tp) * 128, (sizeof(_Tp) * 2) >= __align ? sizeof(_Tp) * 2 : __align, __pool_type::_Tune::_S_chunk_size, __pool_type::_Tune::_S_max_threads, __pool_type::_Tune::_S_freelist_headroom, getenv("GLIBCXX_FORCE_NEW") ? true : false);
-       static __pool_type _S_pool(_S_tune);
+       // Sane defaults for the _PoolTp.
+       const static size_t __align = __alignof__(_Tp) >= sizeof(typename pool_type::_Block_record) ? __alignof__(_Tp) : sizeof(typename pool_type::_Block_record);
+       static __pool_base::_Tune _S_tune(__align, sizeof(_Tp) * 128, (sizeof(_Tp) * 2) >= __align ? sizeof(_Tp) * 2 : __align, __pool_base::_Tune::_S_chunk_size, __pool_base::_Tune::_S_max_threads, __pool_base::_Tune::_S_freelist_headroom, getenv("GLIBCXX_FORCE_NEW") ? true : false);
+       static pool_type _S_pool(_S_tune);
        return _S_pool;
       }
 
@@ -535,45 +514,28 @@ namespace __gnu_cxx
       }
     };
 
-  template<typename _Tp>
-    struct __per_type_pool_policy<_Tp, true>;
-
 #ifdef __GTHREADS
-  template<typename _Tp>
-    struct __per_type_pool_policy<_Tp, true>
+  template<typename _Tp, template <bool> class _PoolTp>
+    struct __per_type_pool_policy<_Tp, _PoolTp, true>
     {
-      typedef __pool<true> __pool_type;
-
-      template<typename _Tp1, bool _Thread1 = true>
-        struct _M_rebind;
+      typedef _Tp value_type;
+      typedef _PoolTp<true> pool_type;
 
-      template<typename _Tp1>
-        struct _M_rebind<_Tp1, false>
-        { typedef __per_type_pool_policy<_Tp1, false> other; };
+     template<typename _Tp1, template <bool> class _PoolTp1 = _PoolTp, 
+              bool _Thread1 = true>
+        struct _M_rebind
+        { typedef __per_type_pool_policy<_Tp1, _PoolTp1, _Thread1> other; };
 
-      template<typename _Tp1>
-        struct _M_rebind<_Tp1, true>
-        { typedef __per_type_pool_policy<_Tp1, true> other; };
-
-      // Avoid static initialization ordering issues.
-      static __pool_type&
-      _S_get_pool( ) 
+      static pool_type&
+      _S_get_pool()
       { 
-       // Sane defaults for the __pool_type.
-       const static size_t __align = __alignof__(_Tp) >= sizeof(typename __pool_type::_Block_record) ? __alignof__(_Tp) : sizeof(typename __pool_type::_Block_record);
-       static __pool_base::_Tune _S_tune(__align, sizeof(_Tp) * 128, (sizeof(_Tp) * 2) >= __align ? sizeof(_Tp) * 2 : __align, __pool_type::_Tune::_S_chunk_size, __pool_type::_Tune::_S_max_threads, __pool_type::_Tune::_S_freelist_headroom, getenv("GLIBCXX_FORCE_NEW") ? true : false);
-       static __pool_type _S_pool(_S_tune);
+       // Sane defaults for the _PoolTp.
+       const static size_t __align = __alignof__(_Tp) >= sizeof(typename pool_type::_Block_record) ? __alignof__(_Tp) : sizeof(typename pool_type::_Block_record);
+       static __pool_base::_Tune _S_tune(__align, sizeof(_Tp) * 128, (sizeof(_Tp) * 2) >= __align ? sizeof(_Tp) * 2 : __align, __pool_base::_Tune::_S_chunk_size, __pool_base::_Tune::_S_max_threads, __pool_base::_Tune::_S_freelist_headroom, getenv("GLIBCXX_FORCE_NEW") ? true : false);
+       static pool_type _S_pool(_S_tune);
        return _S_pool;
       }
 
-      static void
-      _S_destroy_thread_key(void* __freelist_pos)
-      { _S_get_pool()._M_destroy_thread_key(__freelist_pos); }
-      
-      static void
-      _S_initialize() 
-      { _S_get_pool()._M_initialize(_S_destroy_thread_key); }
-
       static void
       _S_initialize_once() 
       { 
@@ -584,6 +546,15 @@ namespace __gnu_cxx
            __init = true;
          }
       }
+
+    private:
+      static void
+      _S_destroy_thread_key(void* __freelist_pos)
+      { _S_get_pool()._M_destroy_thread_key(__freelist_pos); }
+      
+      static void
+      _S_initialize() 
+      { _S_get_pool()._M_initialize(_S_destroy_thread_key); }
     };
 #endif
 
@@ -622,13 +593,14 @@ namespace __gnu_cxx
     };
 
 #ifdef __GTHREADS
-#define __default_policy __common_pool_policy<true>
+#define __thread_default true
 #else
-#define __default_policy __common_pool_policy<false>
+#define __thread_default false
 #endif
 
-  template<typename _Tp, typename _Poolp = __default_policy>
-    class __mt_alloc : public __mt_alloc_base<_Tp>, _Poolp
+  template<typename _Tp, 
+          typename _Poolp = __common_pool_policy<__pool, __thread_default> >
+    class __mt_alloc : public __mt_alloc_base<_Tp>
     {
     public:
       typedef size_t                           size_type;
@@ -638,8 +610,8 @@ namespace __gnu_cxx
       typedef _Tp&                             reference;
       typedef const _Tp&                       const_reference;
       typedef _Tp                              value_type;
-      typedef _Poolp                           __policy_type;
-      typedef typename _Poolp::__pool_type     __pool_type;
+      typedef _Poolp                           __policy_type;
+      typedef typename _Poolp::pool_type       __pool_type;
 
       template<typename _Tp1, typename _Poolp1 = _Poolp>
         struct rebind
@@ -670,12 +642,12 @@ namespace __gnu_cxx
       _M_get_options()
       { 
        // Return a copy, not a reference, for external consumption.
-       return __pool_base::_Tune(this->_S_get_pool()._M_get_options()); 
+       return __policy_type::_S_get_pool()._M_get_options();
       }
       
       void
       _M_set_options(__pool_base::_Tune __t)
-      { this->_S_get_pool()._M_set_options(__t); }
+      { __policy_type::_S_get_pool()._M_set_options(__t); }
     };
 
   template<typename _Tp, typename _Poolp>
@@ -683,14 +655,14 @@ namespace __gnu_cxx
     __mt_alloc<_Tp, _Poolp>::
     allocate(size_type __n, const void*)
     {
-      this->_S_initialize_once();
-
       if (__builtin_expect(__n > this->max_size(), false))
        std::__throw_bad_alloc();
 
+      __policy_type::_S_initialize_once();
+
       // Requests larger than _M_max_bytes are handled by operator
       // new/delete directly.
-      __pool_type& __pool = this->_S_get_pool();
+      __pool_type& __pool = __policy_type::_S_get_pool();
       const size_t __bytes = __n * sizeof(_Tp);
       if (__pool._M_check_threshold(__bytes))
        {
@@ -734,7 +706,7 @@ namespace __gnu_cxx
        {
          // Requests larger than _M_max_bytes are handled by
          // operators new/delete directly.
-         __pool_type& __pool = this->_S_get_pool();
+         __pool_type& __pool = __policy_type::_S_get_pool();
          const size_t __bytes = __n * sizeof(_Tp);
          if (__pool._M_check_threshold(__bytes))
            ::operator delete(__p);
@@ -753,7 +725,7 @@ namespace __gnu_cxx
     operator!=(const __mt_alloc<_Tp, _Poolp>&, const __mt_alloc<_Tp, _Poolp>&)
     { return false; }
 
-#undef __default_policy
+#undef __thread_default
 } // namespace __gnu_cxx
 
 #endif
index d9cdb0f7b52744ab724d4127f5f51c7450803e10..9d23c74fdfb3ec3da770603c0fddbb23260a88bb 100644 (file)
@@ -25,7 +25,8 @@
 int main()
 { 
   typedef int value_type;
-  typedef __gnu_cxx::__common_pool_policy<false> policy_type;
+  using __gnu_cxx::__pool;
+  typedef __gnu_cxx::__common_pool_policy<__pool, false> policy_type;
   typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
   __gnu_test::check_deallocate_null<allocator_type>(); 
   return 0;
index 28aed3b3ea0fd21f52fde91d2f0f4293c97c2c91..929b31de3cb080def2cca85d05de85c5a453395f 100644 (file)
@@ -25,7 +25,8 @@
 int main()
 { 
   typedef int value_type;
-  typedef __gnu_cxx::__common_pool_policy<true> policy_type;
+  using __gnu_cxx::__pool;
+  typedef __gnu_cxx::__common_pool_policy<__pool, true> policy_type;
   typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
   __gnu_test::check_deallocate_null<allocator_type>(); 
   return 0;
index 2028520cad7be8a782a425cecb79fa19faaae993..76a9a8c35401ecf9ef36e1c0d0c84bc589e3475b 100644 (file)
@@ -67,7 +67,9 @@ void operator delete(void* p) throw()
 }
 
 typedef std::string value_type;
-typedef __gnu_cxx::__common_pool_policy<false> policy_type;
+using __gnu_cxx::__pool;
+using __gnu_cxx::__common_pool_policy;
+typedef __common_pool_policy<__pool, false> policy_type;
 typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
 typedef std::char_traits<value_type> traits_type;
 typedef std::list<value_type, allocator_type> list_type;
index 3406cda9de451f2da05072fd961ef0d942fd5f84..7de94f5337ac59f3c4149df02a98d4d28df84872 100644 (file)
@@ -67,7 +67,9 @@ void operator delete(void* p) throw()
 }
 
 typedef std::string value_t;
-typedef __gnu_cxx::__per_type_pool_policy<value_t, false> policy_type;
+using __gnu_cxx::__pool;
+using __gnu_cxx::__per_type_pool_policy;
+typedef __per_type_pool_policy<value_t, __pool, false> policy_type;
 typedef __gnu_cxx::__mt_alloc<value_t, policy_type> allocator_type;
 typedef std::char_traits<value_t> traits_type;
 typedef std::list<value_t, allocator_type> list_type;
index aafd40f45891bcd077b081eccfd581e92b648685..0264620c138df3b67b3a0ee4a68370166f3ebd45 100644 (file)
@@ -67,7 +67,9 @@ void operator delete(void* p) throw()
 }
 
 typedef std::string value_type;
-typedef __gnu_cxx::__common_pool_policy<true> policy_type;
+using __gnu_cxx::__pool;
+using __gnu_cxx::__common_pool_policy;
+typedef __common_pool_policy<__pool, true> policy_type;
 typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
 typedef std::char_traits<value_type> traits_type;
 typedef std::list<value_type, allocator_type> list_type;
index 3a6f49d0134f763427f1531c083f90ddc9470d69..c65277548b557e64ecf8a0c04f7774ce3d8f10e0 100644 (file)
@@ -67,7 +67,9 @@ void operator delete(void* p) throw()
 }
 
 typedef std::string value_type;
-typedef __gnu_cxx::__per_type_pool_policy<value_type, true> policy_type;
+using __gnu_cxx::__pool;
+using __gnu_cxx::__per_type_pool_policy;
+typedef __per_type_pool_policy<value_type, __pool, true> policy_type;
 typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
 typedef std::char_traits<value_type> traits_type;
 typedef std::list<value_type, allocator_type> list_type;
index b9a31e2d28e7a317f735608063de53148bb86878..8951e44c9d9c6f165e338eeb3e8b396d7fee6c99 100644 (file)
@@ -66,7 +66,8 @@ void operator delete(void* p) throw()
 
 typedef char value_type;
 typedef std::char_traits<value_type> traits_type;
-typedef __gnu_cxx::__common_pool_policy<false> policy_type;
+using __gnu_cxx::__pool;
+typedef __gnu_cxx::__common_pool_policy<__pool, false> policy_type;
 typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
 typedef std::basic_string<value_type, traits_type, allocator_type> string_type;
 
index 10ee0106fb59d6b654a8493c782ab11a27d44a3b..da2c1e96360c5e39253921335218a23403395f26 100644 (file)
@@ -66,7 +66,9 @@ void operator delete(void* p) throw()
 
 typedef char value_type;
 typedef std::char_traits<value_type> traits_type;
-typedef __gnu_cxx::__per_type_pool_policy<value_type, false> policy_type;
+using __gnu_cxx::__pool;
+using __gnu_cxx::__per_type_pool_policy;
+typedef __per_type_pool_policy<value_type, __pool, false> policy_type;
 typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
 typedef std::basic_string<value_type, traits_type, allocator_type> string_type;
 
index d2a92d55fd9e50915dc54c49a855917c9cc803ac..f0f1c32141ade3eb3bb8010a6f1bb64d615d0aba 100644 (file)
@@ -66,7 +66,8 @@ void operator delete(void* p) throw()
 
 typedef char value_type;
 typedef std::char_traits<value_type> traits_type;
-typedef __gnu_cxx::__common_pool_policy<true> policy_type;
+using __gnu_cxx::__pool;
+typedef __gnu_cxx::__common_pool_policy<__pool, true> policy_type;
 typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
 typedef std::basic_string<value_type, traits_type, allocator_type> string_type;
 
index ba8c1033c021ea7dc49d81d4cff3959b96d72cea..f3d2781978b78a89838443ee2660eab3f610ec53 100644 (file)
@@ -66,7 +66,9 @@ void operator delete(void* p) throw()
 
 typedef char value_type;
 typedef std::char_traits<value_type> traits_type;
-typedef __gnu_cxx::__per_type_pool_policy<value_type, true> policy_type;
+using __gnu_cxx::__pool;
+using __gnu_cxx::__per_type_pool_policy;
+typedef __per_type_pool_policy<value_type, __pool, true> policy_type;
 typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
 typedef std::basic_string<value_type, traits_type, allocator_type> string_type;
 
index 4fa49aa09cc9bdbefb6bbc9769db686c0144d410..30db7f578066b6c7dc565ed610d4f731d3dd56f4 100644 (file)
@@ -27,9 +27,9 @@
 
 using namespace __gnu_cxx;
 template class __mt_alloc<int>;
-template class __mt_alloc<short, __common_pool_policy<false> >;
-template class __mt_alloc<short, __per_type_pool_policy<short, false> >;
+template class __mt_alloc<short, __common_pool_policy<__pool, false> >;
+template class __mt_alloc<short, __per_type_pool_policy<short, __pool, false> >;
 #ifdef __GTHREADS
-template class __mt_alloc<short, __common_pool_policy<true> >;
-template class __mt_alloc<short, __per_type_pool_policy<short, true> >;
+template class __mt_alloc<short, __common_pool_policy<__pool, true> >;
+template class __mt_alloc<short, __per_type_pool_policy<short, __pool, true> >;
 #endif
index fa4dd45b41d9f37f8ba69e986421d523582ac7d4..4f875e2fe1c1c6a5ceec71010925c0204e744470 100644 (file)
@@ -29,10 +29,14 @@ void test01()
   bool test __attribute__((unused)) = true;
 
   typedef __gnu_test::pod_int value_type;
+
+  using __gnu_cxx::__pool;
+  using __gnu_cxx::__common_pool_policy;
+
 #ifdef __GTHREADS
-  typedef __gnu_cxx::__common_pool_policy<true> policy_type;
+  typedef __common_pool_policy<__pool, true> policy_type;
 #else
-  typedef __gnu_cxx::__common_pool_policy<false> policy_type;
+  typedef __common_pool_policy<__pool, false> policy_type;
 #endif
   typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
   typedef __gnu_cxx::__pool_base::_Tune tune_type;
index 1dcf084502b45d0daaa52c1776068015f161fc60..7ae9c93da348b30bbb5a4f3678b09813ff523748 100644 (file)
@@ -29,10 +29,14 @@ void test02()
   bool test __attribute__((unused)) = true;
 
   typedef __gnu_test::pod_int value_type;
+
+  using __gnu_cxx::__pool;
+  using __gnu_cxx::__per_type_pool_policy;
+
 #ifdef __GTHREADS
-  typedef __gnu_cxx::__per_type_pool_policy<value_type, true> policy_type;
+  typedef __per_type_pool_policy<value_type, __pool, true> policy_type;
 #else
-  typedef __gnu_cxx::__per_type_pool_policy<value_type, false> policy_type;
+  typedef __per_type_pool_policy<value_type, __pool, false> policy_type;
 #endif
   typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
   typedef __gnu_cxx::__pool_base::_Tune tune_type;
index 6e8098a609d1c426dbc91a82e95df04e9684361c..81cd4e0380ad8cdc2f41e9524a79f2ea5bf6d0fa 100644 (file)
@@ -27,12 +27,16 @@ template<typename _Tp>
 struct test_policy
 { static bool per_type() { return true; } };
 
-template<bool _Thread>
-struct test_policy<__gnu_cxx::__common_pool_policy<_Thread> >
-{ 
-  typedef __gnu_cxx::__common_pool_policy<_Thread> policy_type;
-  static bool per_type() { return false; } 
-};
+using __gnu_cxx::__pool;
+using __gnu_cxx::__common_pool_policy;
+
+template<>
+struct test_policy<__common_pool_policy<__pool, true> >
+{ static bool per_type() { return false; } };
+
+template<>
+struct test_policy<__common_pool_policy<__pool, false> >
+{ static bool per_type() { return false; } };
 
 // Tune characteristics, two of different types
 template<typename _Tp, typename _Cp>
@@ -85,12 +89,12 @@ void test03()
 int main()
 {
 #ifdef __GTHREADS
-  test03<int, __gnu_cxx::__per_type_pool_policy<int, true> >();
-  test03<int, __gnu_cxx::__common_pool_policy<true> >();
+  test03<int, __gnu_cxx::__per_type_pool_policy<int, __pool, true> >();
+  test03<int, __gnu_cxx::__common_pool_policy<__pool, true> >();
 #endif
 
-  test03<int, __gnu_cxx::__common_pool_policy<false> >();
-  test03<int, __gnu_cxx::__per_type_pool_policy<int, false> >();
+  test03<int, __gnu_cxx::__per_type_pool_policy<int, __pool, false> >();
+  test03<int, __gnu_cxx::__common_pool_policy<__pool, false> >();
 
   return 0;
 }
index 993f7b3a52ebd70046f08446f64015532928b54b..8e2f5119dbfbd2fe1dcd24ef4b09808c29279a7f 100644 (file)
@@ -27,12 +27,16 @@ template<typename _Tp>
 struct test_policy
 { static bool per_type() { return true; } };
 
-template<bool _Thread>
-struct test_policy<__gnu_cxx::__common_pool_policy<_Thread> >
-{ 
-  typedef __gnu_cxx::__common_pool_policy<_Thread> policy_type;
-  static bool per_type() { return false; } 
-};
+using __gnu_cxx::__pool;
+using __gnu_cxx::__common_pool_policy;
+
+template<>
+struct test_policy<__common_pool_policy<__pool, true> >
+{ static bool per_type() { return false; } };
+
+template<>
+struct test_policy<__common_pool_policy<__pool, false> >
+{ static bool per_type() { return false; } };
 
 struct pod2
 {
@@ -104,11 +108,11 @@ void test04()
 int main()
 {
 #ifdef __GTHREADS
-  test04<float, __gnu_cxx::__common_pool_policy<true> >();
-  test04<double, __gnu_cxx::__per_type_pool_policy<double, true> >();
+  test04<float, __gnu_cxx::__common_pool_policy<__pool, true> >();
+  test04<double, __gnu_cxx::__per_type_pool_policy<double, __pool, true> >();
 #endif
-  test04<float, __gnu_cxx::__common_pool_policy<false> >();
-  test04<double, __gnu_cxx::__per_type_pool_policy<double, false> >();
+  test04<float, __gnu_cxx::__common_pool_policy<__pool, false> >();
+  test04<double, __gnu_cxx::__per_type_pool_policy<double, __pool, false> >();
 
   return 0;
 }