Merging long-standing changes from Trunk, including the slightly more sophisticated handling of the to_string conversion done in boost::diagnostic_information.

[SVN r83354]
This commit is contained in:
Emil Dotchevski
2013-03-08 02:01:44 +00:00
parent 7e116a36b9
commit a0d47fea34
37 changed files with 181 additions and 200 deletions
+3 -3
View File
@@ -28,7 +28,7 @@ run 2-throw_exception_no_exceptions_test.cpp ;
run 3-throw_exception_no_integration_test.cpp ;
run 4-throw_exception_no_both_test.cpp ;
run cloning_test.cpp ;
run copy_exception_test.cpp /boost//thread : : : <threading>multi ;
run copy_exception_test.cpp ../../thread/src/tss_null.cpp /boost//thread : : : <threading>multi ;
run unknown_exception_test.cpp ;
run exception_test.cpp ;
run enable_error_info_test.cpp helper1.cpp ;
@@ -40,8 +40,8 @@ run refcount_ptr_test.cpp ;
run current_exception_cast_test.cpp ;
run no_exceptions_test.cpp : : : <exception-handling>off ;
run errinfos_test.cpp ;
run exception_ptr_test.cpp/<define>BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR /boost/exception /boost//thread : : : <threading>multi : non_intrusive_exception_ptr_test ;
run exception_ptr_test.cpp /boost//thread : : : <threading>multi ;
run exception_ptr_test.cpp/<define>BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR ../../thread/src/tss_null.cpp /boost/exception /boost//thread : : : <threading>multi : non_intrusive_exception_ptr_test ;
run exception_ptr_test.cpp ../../thread/src/tss_null.cpp /boost//thread : : : <threading>multi ;
compile-fail exception_fail.cpp ;
compile-fail throw_exception_fail.cpp ;
+1 -4
View File
@@ -19,10 +19,7 @@ typedef boost::error_info<struct test_tag2,int> tagged_int2;
std::string
to_string( tagged_int2 const & x )
{
if( x.value()==42 )
return "fourty-two";
else
return "bad value";
return '[' +boost::error_info_name(x) + "] = " + (x.value()==42 ? "fourty-two" : "bad value");
}
struct
+35 -6
View File
@@ -249,12 +249,41 @@ test_catch_add_info()
void
test_add_tuple()
{
typedef boost::tuple<test_1,test_2> test_12;
typedef boost::tuple<test_1,test_2,test_3> test_123;
typedef boost::tuple<test_1,test_2,test_3,test_5> test_1235;
typedef boost::tuple<> tuple_test_;
typedef boost::tuple<test_1> tuple_test_1;
typedef boost::tuple<test_1,test_2> tuple_test_12;
typedef boost::tuple<test_1,test_2,test_3> tuple_test_123;
typedef boost::tuple<test_1,test_2,test_3,test_5> tuple_test_1235;
try
{
throw test_exception() << test_12(42,42u);
throw test_exception() << tuple_test_();
}
catch(
test_exception & x )
{
}
catch(
... )
{
BOOST_TEST(false);
}
try
{
throw test_exception() << tuple_test_1(42);
}
catch(
test_exception & x )
{
BOOST_TEST( *boost::get_error_info<test_1>(x)==42 );
}
catch(
... )
{
BOOST_TEST(false);
}
try
{
throw test_exception() << tuple_test_12(42,42u);
}
catch(
test_exception & x )
@@ -269,7 +298,7 @@ test_add_tuple()
}
try
{
throw test_exception() << test_123(42,42u,42.0f);
throw test_exception() << tuple_test_123(42,42u,42.0f);
}
catch(
test_exception & x )
@@ -285,7 +314,7 @@ test_add_tuple()
}
try
{
throw test_exception() << test_1235(42,42u,42.0f,std::string("42"));
throw test_exception() << tuple_test_1235(42,42u,42.0f,std::string("42"));
}
catch(
test_exception & x )
+8 -5
View File
@@ -44,7 +44,7 @@ thread_handle
explicit
thread_handle( boost::function<void()> const & f ):
t_(boost::bind(thread_wrapper,f,err_))
t_(boost::bind(thread_wrapper,f,boost::ref(err_)))
{
}
@@ -63,8 +63,8 @@ void
join( thread_handle & t )
{
t.t_.join();
if( t.err_ )
rethrow_exception(t.err_);
assert(t.err_);
rethrow_exception(t.err_);
}
boost::detail::atomic_count exc_count(0);
@@ -79,7 +79,9 @@ exc:
++exc_count;
}
exc( exc const & )
exc( exc const & e ):
boost::exception(e),
std::exception(e)
{
++exc_count;
}
@@ -109,6 +111,7 @@ check( boost::shared_ptr<thread_handle> const & t )
try
{
join(*t);
BOOST_TEST(false);
}
catch(
exc & e )
@@ -125,7 +128,7 @@ main()
try
{
std::vector< boost::shared_ptr<thread_handle> > threads;
std::generate_n(std::inserter(threads,threads.end()),256,boost::bind(create_thread,thread_func));
std::generate_n(std::inserter(threads,threads.end()),1,boost::bind(create_thread,thread_func));
std::for_each(threads.begin(),threads.end(),check);
return boost::report_errors();
}