]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
future: Enable allocator support.
authorJonathan Wakely <jwakely.gcc@gmail.com>
Fri, 8 Oct 2010 01:06:27 +0000 (01:06 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 8 Oct 2010 01:06:27 +0000 (02:06 +0100)
* include/std/future: Enable allocator support.
* testsuite/30_threads/packaged_task/cons/alloc.cc: Expect PASS.
* testsuite/30_threads/promise/cons/alloc.cc: Expect PASS.

From-SVN: r165147

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/future
libstdc++-v3/testsuite/30_threads/packaged_task/cons/alloc.cc
libstdc++-v3/testsuite/30_threads/promise/cons/alloc.cc

index 1b8e8aa3521b1668d2c31a52eb1abadeb34d1e1d..ef37ef57fbfca1857c7a8c03a749321a313619fa 100644 (file)
@@ -1,3 +1,9 @@
+2010-10-08  Jonathan Wakely  <jwakely.gcc@gmail.com>
+
+       * include/std/future: Enable allocator support.
+       * testsuite/30_threads/packaged_task/cons/alloc.cc: Expect PASS.
+       * testsuite/30_threads/promise/cons/alloc.cc: Expect PASS.
+
 2010-10-08  Jonathan Wakely  <jwakely.gcc@gmail.com>
 
        PR libstdc++/45893
index 803c912294eb0eeecae1338905494d84f940b349..0678093fe47af290a1fe323f0efd6e346bf7e870 100644 (file)
@@ -213,8 +213,6 @@ namespace std
        typedef unique_ptr<_Res, _Result_base::_Deleter> type;
       };
 
-    // TODO: use when allocator_arg_t available
-    /*
     /// Result_alloc.
     template<typename _Res, typename _Alloc>
       struct _Result_alloc : _Result<_Res>
@@ -255,7 +253,6 @@ namespace std
         }
         return typename _Ptr<__result_type>::type(__p);
       }
-    */
 
 
     /// Shared state between a promise and one or more associated futures.
@@ -843,14 +840,11 @@ namespace std
        _M_storage(std::move(__rhs._M_storage))
       { }
 
-      // TODO: needs allocator_arg_t
-      /*
       template<typename _Allocator>
         promise(allocator_arg_t, const _Allocator& __a)
         : _M_future(std::allocate_shared<_State>(__a)),
         _M_storage(__future_base::_S_allocate_result<_Res>(__a))
         { }
-      */
 
       promise(const promise&) = delete;
 
@@ -933,14 +927,11 @@ namespace std
        _M_storage(std::move(__rhs._M_storage))
       { }
 
-      // TODO: needs allocator_arg_t
-      /*
       template<typename _Allocator>
         promise(allocator_arg_t, const _Allocator& __a)
         : _M_future(std::allocate_shared<_State>(__a)),
         _M_storage(__future_base::_S_allocate_result<_Res&>(__a))
         { }
-      */
 
       promise(const promise&) = delete;
 
@@ -1012,14 +1003,11 @@ namespace std
       { }
 
 
-      // TODO: needs allocator_arg_t
-      /*
       template<typename _Allocator>
         promise(allocator_arg_t, const _Allocator& __a)
         : _M_future(std::allocate_shared<_State>(__a)),
         _M_storage(__future_base::_S_allocate_result<void>(__a))
         { }
-      */
 
       promise(const promise&) = delete;
 
@@ -1088,11 +1076,8 @@ namespace std
     _M_future->_M_set_result(std::move(__setter));
   }
 
-  // TODO: needs allocators
-  /*
   template<typename _Res, class Alloc>
     struct uses_allocator<promise<_Res>, Alloc> : true_type  { };
-  */
 
 
   template<typename _StateT, typename _Res>
@@ -1142,14 +1127,11 @@ namespace std
       : _M_result(new _Result<_Res>()), _M_task(std::move(__task))
       { }
 
-      // TODO: needs allocator_arg_t
-      /*
       template<typename _Func, typename _Alloc>
         _Task_state(_Func&& __task, const _Alloc& __a)
         : _M_result(_S_allocate_result<_Res>(__a))
         , _M_task(allocator_arg, __a, std::move(__task))
         { }
-      */
 
       void
       _M_run(_Args... __args)
@@ -1208,14 +1190,11 @@ namespace std
       : _M_state(std::make_shared<_State_type>(__fn))
       { }
 
-      // TODO: needs allocator_arg_t
-      /*
       template<typename _Fn, typename _Allocator>
         explicit
         packaged_task(allocator_arg_t __tag, const _Allocator& __a, _Fn __fn)
         : _M_state(std::allocate_shared<_State_type>(__a, std::move(__fn)))
         { }
-      */
 
       ~packaged_task()
       {
index 2565b61b24d0847bdc5c701e78a40540841815b3..99253cde7d3d382e19f48897244475b5ac01087e 100644 (file)
@@ -1,4 +1,4 @@
-// { dg-do compile { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
 // { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
 // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
 // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
@@ -39,7 +39,7 @@ void test01()
 
   uneq_allocator<char> alloc(99);
 
-  packaged_task<int ()> p1(allocator_arg, alloc, f); // { dg-excess-errors "" }
+  packaged_task<int ()> p1(allocator_arg, alloc, f);
   VERIFY( static_cast<bool>(p1) );
   p1();
   VERIFY( p1.get_future().get() == 5 );
index 6d53f4444db62f4f1856197c149e7480a7e92254..0ac560df4752278b0a86732a8dac0f0d023883bd 100644 (file)
@@ -1,4 +1,4 @@
-// { dg-do compile { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
 // { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
 // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
 // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
@@ -35,7 +35,7 @@ void test01()
 
   uneq_allocator<char> alloc(99);
 
-  promise<int> p1(allocator_arg, alloc); // { dg-excess-errors "" }
+  promise<int> p1(allocator_arg, alloc);
   p1.set_value(5);
   VERIFY( p1.get_future().get() == 5 );
 }