|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63565 - in branches/release: boost boost/exception boost/exception/detail libs/exception/doc libs/exception/test
From: emil_at_[hidden]
Date: 2010-07-03 17:32:04
Author: emildotchevski
Date: 2010-07-03 17:32:02 EDT (Sat, 03 Jul 2010)
New Revision: 63565
URL: http://svn.boost.org/trac/boost/changeset/63565
Log:
merging changes from trunk.
Text files modified:
branches/release/boost/exception/detail/exception_ptr.hpp | 12 +++++++-----
branches/release/boost/exception/exception.hpp | 8 ++++----
branches/release/boost/exception/info.hpp | 13 +++++++++----
branches/release/boost/throw_exception.hpp | 40 ++++++++++++++++++++--------------------
branches/release/libs/exception/doc/boost_exception_get_error_info_hpp.html | 4 ++--
branches/release/libs/exception/doc/get_error_info.html | 4 ++--
branches/release/libs/exception/test/no_exceptions_test.cpp | 2 ++
branches/release/libs/exception/test/refcount_ptr_test.cpp | 9 +++++++--
8 files changed, 53 insertions(+), 39 deletions(-)
Modified: branches/release/boost/exception/detail/exception_ptr.hpp
==============================================================================
--- branches/release/boost/exception/detail/exception_ptr.hpp (original)
+++ branches/release/boost/exception/detail/exception_ptr.hpp 2010-07-03 17:32:02 EDT (Sat, 03 Jul 2010)
@@ -73,12 +73,14 @@
exception_ptr
get_bad_alloc()
{
- static exception_ptr e = boost::copy_exception(
- bad_alloc_() <<
- throw_function("boost::current_exception()") <<
+ bad_alloc_ ba;
+ exception_detail::clone_impl<bad_alloc_> c(ba);
+ c <<
+ throw_function(BOOST_CURRENT_FUNCTION) <<
throw_file(__FILE__) <<
- throw_line(__LINE__) );
- return e;
+ throw_line(__LINE__);
+ static exception_ptr ep(new exception_detail::clone_impl<bad_alloc_>(c));
+ return ep;
}
template <int Dummy>
Modified: branches/release/boost/exception/exception.hpp
==============================================================================
--- branches/release/boost/exception/exception.hpp (original)
+++ branches/release/boost/exception/exception.hpp 2010-07-03 17:32:02 EDT (Sat, 03 Jul 2010)
@@ -75,8 +75,8 @@
void
release()
{
- if( px_ )
- px_->release();
+ if( px_ && px_->release() )
+ px_=0;
}
};
}
@@ -134,7 +134,7 @@
class exception;
- template <class>
+ template <class T>
class shared_ptr;
namespace
@@ -150,7 +150,7 @@
virtual shared_ptr<error_info_base> get( type_info_ const & ) const = 0;
virtual void set( shared_ptr<error_info_base> const &, type_info_ const & ) = 0;
virtual void add_ref() const = 0;
- virtual void release() const = 0;
+ virtual bool release() const = 0;
virtual refcount_ptr<exception_detail::error_info_container> clone() const = 0;
protected:
Modified: branches/release/boost/exception/info.hpp
==============================================================================
--- branches/release/boost/exception/info.hpp (original)
+++ branches/release/boost/exception/info.hpp 2010-07-03 17:32:02 EDT (Sat, 03 Jul 2010)
@@ -114,8 +114,8 @@
tmp << header;
for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i )
{
- shared_ptr<error_info_base const> const & x = i->second;
- tmp << '[' << x->tag_typeid_name() << "] = " << x->value_as_string() << '\n';
+ error_info_base const & x = *i->second;
+ tmp << '[' << x.tag_typeid_name() << "] = " << x.value_as_string() << '\n';
}
tmp.str().swap(diagnostic_info_str_);
}
@@ -140,11 +140,16 @@
++count_;
}
- void
+ bool
release() const
{
- if( !--count_ )
+ if( --count_ )
+ return false;
+ else
+ {
delete this;
+ return true;
+ }
}
refcount_ptr<error_info_container>
Modified: branches/release/boost/throw_exception.hpp
==============================================================================
--- branches/release/boost/throw_exception.hpp (original)
+++ branches/release/boost/throw_exception.hpp 2010-07-03 17:32:02 EDT (Sat, 03 Jul 2010)
@@ -43,26 +43,6 @@
namespace boost
{
-#if !defined( BOOST_EXCEPTION_DISABLE )
- namespace
- exception_detail
- {
- template <class E>
- void
- throw_exception_( E const & x, char const * current_function, char const * file, int line )
- {
- throw_exception(
- set_info(
- set_info(
- set_info(
- enable_error_info(x),
- throw_function(current_function)),
- throw_file(file)),
- throw_line(line)));
- }
- }
-#endif
-
#ifdef BOOST_NO_EXCEPTIONS
void throw_exception( std::exception const & e ); // user defined
@@ -86,6 +66,26 @@
#endif
+#if !defined( BOOST_EXCEPTION_DISABLE )
+ namespace
+ exception_detail
+ {
+ template <class E>
+ BOOST_ATTRIBUTE_NORETURN
+ void
+ throw_exception_( E const & x, char const * current_function, char const * file, int line )
+ {
+ boost::throw_exception(
+ set_info(
+ set_info(
+ set_info(
+ enable_error_info(x),
+ throw_function(current_function)),
+ throw_file(file)),
+ throw_line(line)));
+ }
+ }
+#endif
} // namespace boost
#endif // #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED
Modified: branches/release/libs/exception/doc/boost_exception_get_error_info_hpp.html
==============================================================================
--- branches/release/libs/exception/doc/boost_exception_get_error_info_hpp.html (original)
+++ branches/release/libs/exception/doc/boost_exception_get_error_info_hpp.html 2010-07-03 17:32:02 EDT (Sat, 03 Jul 2010)
@@ -28,10 +28,10 @@
boost
{
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">template <class ErrorInfo,class E>
- typename ErrorInfo::<span class="RenoLink">error_info::value_type</span> const * <span class="RenoLink">get_error_info</span>( E const & x );
+ typename ErrorInfo::<span class="RenoLink">error_info::value_type</span> const * <span class="RenoLink">get_error_info</span>( E const & x );
template <class ErrorInfo,class E>
- typename ErrorInfo::<span class="RenoLink">error_info::value_type</span> * <span class="RenoLink">get_error_info</span>( E & x );</span></span>
+ typename ErrorInfo::<span class="RenoLink">error_info::value_type</span> * <span class="RenoLink">get_error_info</span>( E & x );</span></span>
}</pre>
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
See also: <span class="RenoPageList">boost/exception/all.hpp | error_info</span>
Modified: branches/release/libs/exception/doc/get_error_info.html
==============================================================================
--- branches/release/libs/exception/doc/get_error_info.html (original)
+++ branches/release/libs/exception/doc/get_error_info.html 2010-07-03 17:32:02 EDT (Sat, 03 Jul 2010)
@@ -25,10 +25,10 @@
boost
{
<span class="RenoIncludeSPAN"> template <class ErrorInfo,class E>
- typename ErrorInfo::<span class="RenoLink">error_info::value_type</span> const * <span class="RenoLink">get_error_info</span>( E const & x );
+ typename ErrorInfo::<span class="RenoLink">error_info::value_type</span> const * get_error_info( E const & x );
template <class ErrorInfo,class E>
- typename ErrorInfo::<span class="RenoLink">error_info::value_type</span> * <span class="RenoLink">get_error_info</span>( E & x );</span>
+ typename ErrorInfo::<span class="RenoLink">error_info::value_type</span> * get_error_info( E & x );</span>
}</pre>
</div><h4>Requirements:</h4>
<div><ul><li> ErrorInfo must be an instance of the <span class="RenoLink">error_info</span> template.</li>
Modified: branches/release/libs/exception/test/no_exceptions_test.cpp
==============================================================================
--- branches/release/libs/exception/test/no_exceptions_test.cpp (original)
+++ branches/release/libs/exception/test/no_exceptions_test.cpp 2010-07-03 17:32:02 EDT (Sat, 03 Jul 2010)
@@ -9,6 +9,7 @@
#include <boost/exception/info.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/detail/lightweight_test.hpp>
+#include <stdlib.h>
struct
my_exception:
@@ -38,6 +39,7 @@
#ifndef BOOST_NO_RTTI
BOOST_TEST(s.find("my_tag")!=std::string::npos);
#endif
+ exit(0);
}
}
Modified: branches/release/libs/exception/test/refcount_ptr_test.cpp
==============================================================================
--- branches/release/libs/exception/test/refcount_ptr_test.cpp (original)
+++ branches/release/libs/exception/test/refcount_ptr_test.cpp 2010-07-03 17:32:02 EDT (Sat, 03 Jul 2010)
@@ -28,11 +28,16 @@
++count_;
}
- void
+ bool
release()
{
- if( !--count_ )
+ if( --count_ )
+ return false;
+ else
+ {
delete this;
+ return true;
+ }
}
private:
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk