]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libstdc++/56905 ([C++11][DR 1130] std::copy_exception should be removed or...
authorJonathan Wakely <jwakely.gcc@gmail.com>
Wed, 24 Apr 2013 22:00:16 +0000 (22:00 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 24 Apr 2013 22:00:16 +0000 (23:00 +0100)
PR libstdc++/56905
* libsupc++/exception_ptr.h (copy_exception): Deprecate and
move implementation to make_exception_ptr.
* include/std/future (_State_base::_M_break_promise): Replace
copy_exception with make_exception_ptr.
* testsuite/18_support/exception_ptr/move.cc: Likewise.
* testsuite/18_support/exception_ptr/rethrow_exception.cc: Likewise.
* testsuite/30_threads/future/members/get2.cc: Likewise.
* testsuite/30_threads/promise/members/set_exception.cc: Likewise.
* testsuite/30_threads/promise/members/set_exception2.cc: Likewise.
* testsuite/30_threads/promise/members/set_value2.cc: Likewise.
* testsuite/30_threads/shared_future/members/get2.cc: Likewise.

From-SVN: r198265

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/future
libstdc++-v3/libsupc++/exception_ptr.h
libstdc++-v3/testsuite/18_support/exception_ptr/move.cc
libstdc++-v3/testsuite/18_support/exception_ptr/rethrow_exception.cc
libstdc++-v3/testsuite/30_threads/future/members/get2.cc
libstdc++-v3/testsuite/30_threads/promise/members/set_exception.cc
libstdc++-v3/testsuite/30_threads/promise/members/set_exception2.cc
libstdc++-v3/testsuite/30_threads/promise/members/set_value2.cc
libstdc++-v3/testsuite/30_threads/shared_future/members/get2.cc

index 9a966b098cae7aad7394ae8871210e1988f86000..b8c6f2886cb0da77917b619e090818d56c785937 100644 (file)
@@ -1,3 +1,18 @@
+2013-04-11  Jonathan Wakely  <jwakely.gcc@gmail.com>
+
+       PR libstdc++/56905
+       * libsupc++/exception_ptr.h (copy_exception): Deprecate and
+       move implementation to make_exception_ptr.
+       * include/std/future (_State_base::_M_break_promise): Replace
+       copy_exception with make_exception_ptr.
+       * testsuite/18_support/exception_ptr/move.cc: Likewise.
+       * testsuite/18_support/exception_ptr/rethrow_exception.cc: Likewise.
+       * testsuite/30_threads/future/members/get2.cc: Likewise.
+       * testsuite/30_threads/promise/members/set_exception.cc: Likewise.
+       * testsuite/30_threads/promise/members/set_exception2.cc: Likewise.
+       * testsuite/30_threads/promise/members/set_value2.cc: Likewise.
+       * testsuite/30_threads/shared_future/members/get2.cc: Likewise.
+
 2013-04-22  Jason Merrill  <jason@redhat.com>
 
        * src/c++11/hashtable_c++0x.cc: Include ext/aligned_buffer.h.
index a86a7ca1ee04d1ef7332899aa5e3d71343ed117e..6d6b32b1f4dbe480cedd7d1fda2d6c970a48a462 100644 (file)
@@ -361,7 +361,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        if (static_cast<bool>(__res))
          {
            error_code __ec(make_error_code(future_errc::broken_promise));
-           __res->_M_error = copy_exception(future_error(__ec));
+           __res->_M_error = make_exception_ptr(future_error(__ec));
            {
              lock_guard<mutex> __lock(_M_mutex);
              _M_result.swap(__res);
index bbf8f85d47b86cca964ba9bac31ba0a5c024e18a..effab347c85c7b9ec15649e7d7448f198ea4d6ca 100644 (file)
@@ -166,7 +166,7 @@ namespace std
   /// Obtain an exception_ptr pointing to a copy of the supplied object.
   template<typename _Ex>
     exception_ptr 
-    copy_exception(_Ex __ex) _GLIBCXX_USE_NOEXCEPT
+    make_exception_ptr(_Ex __ex) _GLIBCXX_USE_NOEXCEPT
     {
       __try
        {
@@ -183,10 +183,15 @@ namespace std
   // _GLIBCXX_RESOLVE_LIB_DEFECTS
   // 1130. copy_exception name misleading
   /// Obtain an exception_ptr pointing to a copy of the supplied object.
+  /// This function is deprecated, use std::make_exception_ptr instead.
   template<typename _Ex>
-    exception_ptr 
-    make_exception_ptr(_Ex __ex) _GLIBCXX_USE_NOEXCEPT
-    { return std::copy_exception<_Ex>(__ex); }
+    exception_ptr
+    copy_exception(_Ex __ex) _GLIBCXX_USE_NOEXCEPT _GLIBCXX_DEPRECATED;
+
+  template<typename _Ex>
+    exception_ptr
+    copy_exception(_Ex __ex) _GLIBCXX_USE_NOEXCEPT
+    { return std::make_exception_ptr<_Ex>(__ex); }
 
   // @} group exceptions
 } // namespace std
index 2b7284d699d0a6f8595cdd384c1e09e56bc0f5ae..9c3df1ee546865de21ea42139c3f9b6ac5b7b9fe 100644 (file)
@@ -28,7 +28,7 @@ void test01()
 {
   bool test = true;
  
-  std::exception_ptr p1 = std::copy_exception(test);
+  std::exception_ptr p1 = std::make_exception_ptr(test);
   std::exception_ptr p2 = std::move(p1);
   VERIFY( p1 == 0 );
   VERIFY( !(p2 == 0) );
index 430913c1b9ab5fd6c25126502c11be06ec591aab..39a57feb97c74b3207eb0bde6fe24c7e5da3f2bc 100644 (file)
@@ -34,7 +34,7 @@ void test01()
   using namespace std;
 
   try {
-    rethrow_exception(copy_exception(0));
+    rethrow_exception(make_exception_ptr(0));
   } catch(...) {
   }
 }
@@ -45,7 +45,7 @@ void test02()
   using namespace std;
 
   try {
-    rethrow_exception(copy_exception(runtime_error("test")));
+    rethrow_exception(make_exception_ptr(runtime_error("test")));
   } catch(exception &e) {
     VERIFY( typeid(e) == typeid(runtime_error) );
     VERIFY( strcmp(e.what(), "test") == 0 );
index b74c84d2551aed9ba2bb59d702c4bf623d2e9b2f..2f052405cf6a9f07b1536f811016ff3697f39b2f 100644 (file)
@@ -37,7 +37,7 @@ void test01()
   std::promise<int> p1;
   std::future<int> f1(p1.get_future());
 
-  p1.set_exception(std::copy_exception(value));
+  p1.set_exception(std::make_exception_ptr(value));
   try
   {
     (void) f1.get();
@@ -57,7 +57,7 @@ void test02()
   std::promise<int&> p1;
   std::future<int&> f1(p1.get_future());
 
-  p1.set_exception(std::copy_exception(value));
+  p1.set_exception(std::make_exception_ptr(value));
   try
   {
     (void) f1.get();
@@ -77,7 +77,7 @@ void test03()
   std::promise<void> p1;
   std::future<void> f1(p1.get_future());
 
-  p1.set_exception(std::copy_exception(value));
+  p1.set_exception(std::make_exception_ptr(value));
   try
   {
     f1.get();
index c7f1df2fc88f0d21106c1d5066921a4cbe2dd071..920c116963109d85b25d77406663c47d557af742 100644 (file)
@@ -36,7 +36,7 @@ void test01()
 
   VERIFY( f1.valid() );
 
-  p1.set_exception(std::copy_exception(0));
+  p1.set_exception(std::make_exception_ptr(0));
 
   try
   {
index 527cfbb93b1339556fd0efa19af32fec82c166f3..84c26d6ffcb5799c7defa7ac57b72ffbe4c0018d 100644 (file)
@@ -34,11 +34,11 @@ void test01()
   std::promise<int> p1;
   std::future<int> f1 = p1.get_future();
 
-  p1.set_exception(std::copy_exception(0));
+  p1.set_exception(std::make_exception_ptr(0));
 
   try
   {
-    p1.set_exception(std::copy_exception(1));
+    p1.set_exception(std::make_exception_ptr(1));
     VERIFY( false );
   }
   catch (std::future_error& e)
@@ -72,7 +72,7 @@ void test02()
 
   try
   {
-    p1.set_exception(std::copy_exception(0));
+    p1.set_exception(std::make_exception_ptr(0));
     VERIFY( false );
   }
   catch (std::future_error& e)
index fcba7456b107e3a9da96461397d2906157aed6df..2ee5987f02b615ad804ec863bbb65ddad077f530 100644 (file)
@@ -65,7 +65,7 @@ void test02()
 
   try
   {
-    p1.set_exception(std::copy_exception(4));
+    p1.set_exception(std::make_exception_ptr(4));
     VERIFY( false );
   }
   catch (std::future_error& e)
index 1b8ccea36e0c82d1e1d626f253531f0a364a9fa2..2fed6d510ed20549df832b7a7c39d9e7589226a7 100644 (file)
@@ -38,7 +38,7 @@ void test01()
   std::shared_future<int> f1(p1.get_future());
   std::shared_future<int> f2(f1);
 
-  p1.set_exception(std::copy_exception(value));
+  p1.set_exception(std::make_exception_ptr(value));
   try
   {
     (void) f1.get();
@@ -67,7 +67,7 @@ void test02()
   std::shared_future<int&> f1(p1.get_future());
   std::shared_future<int&> f2(f1);
 
-  p1.set_exception(std::copy_exception(value));
+  p1.set_exception(std::make_exception_ptr(value));
   try
   {
     (void) f1.get();
@@ -96,7 +96,7 @@ void test03()
   std::shared_future<void> f1(p1.get_future());
   std::shared_future<void> f2(f1);
 
-  p1.set_exception(std::copy_exception(value));
+  p1.set_exception(std::make_exception_ptr(value));
   try
   {
     f1.get();