Commit ec98d010 by Jonathan Wakely Committed by Jonathan Wakely

re PR libstdc++/56905 ([C++11][DR 1130] std::copy_exception should be removed or no longer be used)

	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
parent 77bce07c
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> 2013-04-22 Jason Merrill <jason@redhat.com>
* src/c++11/hashtable_c++0x.cc: Include ext/aligned_buffer.h. * src/c++11/hashtable_c++0x.cc: Include ext/aligned_buffer.h.
......
...@@ -361,7 +361,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -361,7 +361,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (static_cast<bool>(__res)) if (static_cast<bool>(__res))
{ {
error_code __ec(make_error_code(future_errc::broken_promise)); 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); lock_guard<mutex> __lock(_M_mutex);
_M_result.swap(__res); _M_result.swap(__res);
......
...@@ -166,7 +166,7 @@ namespace std ...@@ -166,7 +166,7 @@ namespace std
/// Obtain an exception_ptr pointing to a copy of the supplied object. /// Obtain an exception_ptr pointing to a copy of the supplied object.
template<typename _Ex> template<typename _Ex>
exception_ptr exception_ptr
copy_exception(_Ex __ex) _GLIBCXX_USE_NOEXCEPT make_exception_ptr(_Ex __ex) _GLIBCXX_USE_NOEXCEPT
{ {
__try __try
{ {
...@@ -183,10 +183,15 @@ namespace std ...@@ -183,10 +183,15 @@ namespace std
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 1130. copy_exception name misleading // 1130. copy_exception name misleading
/// Obtain an exception_ptr pointing to a copy of the supplied object. /// 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> template<typename _Ex>
exception_ptr exception_ptr
make_exception_ptr(_Ex __ex) _GLIBCXX_USE_NOEXCEPT copy_exception(_Ex __ex) _GLIBCXX_USE_NOEXCEPT _GLIBCXX_DEPRECATED;
{ return std::copy_exception<_Ex>(__ex); }
template<typename _Ex>
exception_ptr
copy_exception(_Ex __ex) _GLIBCXX_USE_NOEXCEPT
{ return std::make_exception_ptr<_Ex>(__ex); }
// @} group exceptions // @} group exceptions
} // namespace std } // namespace std
......
...@@ -28,7 +28,7 @@ void test01() ...@@ -28,7 +28,7 @@ void test01()
{ {
bool test = true; 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); std::exception_ptr p2 = std::move(p1);
VERIFY( p1 == 0 ); VERIFY( p1 == 0 );
VERIFY( !(p2 == 0) ); VERIFY( !(p2 == 0) );
......
...@@ -34,7 +34,7 @@ void test01() ...@@ -34,7 +34,7 @@ void test01()
using namespace std; using namespace std;
try { try {
rethrow_exception(copy_exception(0)); rethrow_exception(make_exception_ptr(0));
} catch(...) { } catch(...) {
} }
} }
...@@ -45,7 +45,7 @@ void test02() ...@@ -45,7 +45,7 @@ void test02()
using namespace std; using namespace std;
try { try {
rethrow_exception(copy_exception(runtime_error("test"))); rethrow_exception(make_exception_ptr(runtime_error("test")));
} catch(exception &e) { } catch(exception &e) {
VERIFY( typeid(e) == typeid(runtime_error) ); VERIFY( typeid(e) == typeid(runtime_error) );
VERIFY( strcmp(e.what(), "test") == 0 ); VERIFY( strcmp(e.what(), "test") == 0 );
......
...@@ -37,7 +37,7 @@ void test01() ...@@ -37,7 +37,7 @@ void test01()
std::promise<int> p1; std::promise<int> p1;
std::future<int> f1(p1.get_future()); std::future<int> f1(p1.get_future());
p1.set_exception(std::copy_exception(value)); p1.set_exception(std::make_exception_ptr(value));
try try
{ {
(void) f1.get(); (void) f1.get();
...@@ -57,7 +57,7 @@ void test02() ...@@ -57,7 +57,7 @@ void test02()
std::promise<int&> p1; std::promise<int&> p1;
std::future<int&> f1(p1.get_future()); std::future<int&> f1(p1.get_future());
p1.set_exception(std::copy_exception(value)); p1.set_exception(std::make_exception_ptr(value));
try try
{ {
(void) f1.get(); (void) f1.get();
...@@ -77,7 +77,7 @@ void test03() ...@@ -77,7 +77,7 @@ void test03()
std::promise<void> p1; std::promise<void> p1;
std::future<void> f1(p1.get_future()); std::future<void> f1(p1.get_future());
p1.set_exception(std::copy_exception(value)); p1.set_exception(std::make_exception_ptr(value));
try try
{ {
f1.get(); f1.get();
......
...@@ -36,7 +36,7 @@ void test01() ...@@ -36,7 +36,7 @@ void test01()
VERIFY( f1.valid() ); VERIFY( f1.valid() );
p1.set_exception(std::copy_exception(0)); p1.set_exception(std::make_exception_ptr(0));
try try
{ {
......
...@@ -34,11 +34,11 @@ void test01() ...@@ -34,11 +34,11 @@ void test01()
std::promise<int> p1; std::promise<int> p1;
std::future<int> f1 = p1.get_future(); std::future<int> f1 = p1.get_future();
p1.set_exception(std::copy_exception(0)); p1.set_exception(std::make_exception_ptr(0));
try try
{ {
p1.set_exception(std::copy_exception(1)); p1.set_exception(std::make_exception_ptr(1));
VERIFY( false ); VERIFY( false );
} }
catch (std::future_error& e) catch (std::future_error& e)
...@@ -72,7 +72,7 @@ void test02() ...@@ -72,7 +72,7 @@ void test02()
try try
{ {
p1.set_exception(std::copy_exception(0)); p1.set_exception(std::make_exception_ptr(0));
VERIFY( false ); VERIFY( false );
} }
catch (std::future_error& e) catch (std::future_error& e)
......
...@@ -65,7 +65,7 @@ void test02() ...@@ -65,7 +65,7 @@ void test02()
try try
{ {
p1.set_exception(std::copy_exception(4)); p1.set_exception(std::make_exception_ptr(4));
VERIFY( false ); VERIFY( false );
} }
catch (std::future_error& e) catch (std::future_error& e)
......
...@@ -38,7 +38,7 @@ void test01() ...@@ -38,7 +38,7 @@ void test01()
std::shared_future<int> f1(p1.get_future()); std::shared_future<int> f1(p1.get_future());
std::shared_future<int> f2(f1); std::shared_future<int> f2(f1);
p1.set_exception(std::copy_exception(value)); p1.set_exception(std::make_exception_ptr(value));
try try
{ {
(void) f1.get(); (void) f1.get();
...@@ -67,7 +67,7 @@ void test02() ...@@ -67,7 +67,7 @@ void test02()
std::shared_future<int&> f1(p1.get_future()); std::shared_future<int&> f1(p1.get_future());
std::shared_future<int&> f2(f1); std::shared_future<int&> f2(f1);
p1.set_exception(std::copy_exception(value)); p1.set_exception(std::make_exception_ptr(value));
try try
{ {
(void) f1.get(); (void) f1.get();
...@@ -96,7 +96,7 @@ void test03() ...@@ -96,7 +96,7 @@ void test03()
std::shared_future<void> f1(p1.get_future()); std::shared_future<void> f1(p1.get_future());
std::shared_future<void> f2(f1); std::shared_future<void> f2(f1);
p1.set_exception(std::copy_exception(value)); p1.set_exception(std::make_exception_ptr(value));
try try
{ {
f1.get(); f1.get();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment