merging changes from trunk.

[SVN r63565]
This commit is contained in:
Emil Dotchevski
2010-07-03 21:32:02 +00:00
parent 029bc12c85
commit eb810d49cb
8 changed files with 53 additions and 39 deletions

View File

@ -28,10 +28,10 @@ namespace
boost boost
{ {
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">template &lt;class ErrorInfo,class E&gt; <span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">template &lt;class ErrorInfo,class E&gt;
typename ErrorInfo::<span class="RenoLink"><a href="error_info::value_type">error_info::value_type</a></span> const * <span class="RenoLink"><a href="get_error_info">get_error_info</a></span>( E const &amp; x ); typename ErrorInfo::<span class="RenoLink"><a href="error_info_value_type.html">error_info::value_type</a></span> const * <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>( E const &amp; x );
template &lt;class ErrorInfo,class E&gt; template &lt;class ErrorInfo,class E&gt;
typename ErrorInfo::<span class="RenoLink"><a href="error_info::value_type">error_info::value_type</a></span> * <span class="RenoLink"><a href="get_error_info">get_error_info</a></span>( E &amp; x );</span></span> typename ErrorInfo::<span class="RenoLink"><a href="error_info_value_type.html">error_info::value_type</a></span> * <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>( E &amp; x );</span></span>
}</pre> }</pre>
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div> </div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
See also: <span class="RenoPageList"><a href="boost_exception_all_hpp.html">boost/exception/all.hpp</a>&nbsp;| <a href="error_info.html">error_info</a></span> See also: <span class="RenoPageList"><a href="boost_exception_all_hpp.html">boost/exception/all.hpp</a>&nbsp;| <a href="error_info.html">error_info</a></span>

View File

@ -25,10 +25,10 @@
boost boost
{ {
<span class="RenoIncludeSPAN"> template &lt;class ErrorInfo,class E&gt; <span class="RenoIncludeSPAN"> template &lt;class ErrorInfo,class E&gt;
typename ErrorInfo::<span class="RenoLink"><a href="error_info::value_type">error_info::value_type</a></span> const * <span class="RenoLink"><a href="get_error_info">get_error_info</a></span>( E const &amp; x ); typename ErrorInfo::<span class="RenoLink"><a href="error_info_value_type.html">error_info::value_type</a></span> const * get_error_info( E const &amp; x );
template &lt;class ErrorInfo,class E&gt; template &lt;class ErrorInfo,class E&gt;
typename ErrorInfo::<span class="RenoLink"><a href="error_info::value_type">error_info::value_type</a></span> * <span class="RenoLink"><a href="get_error_info">get_error_info</a></span>( E &amp; x );</span> typename ErrorInfo::<span class="RenoLink"><a href="error_info_value_type.html">error_info::value_type</a></span> * get_error_info( E &amp; x );</span>
}</pre> }</pre>
</div><h4>Requirements:</h4> </div><h4>Requirements:</h4>
<div><ul><li> ErrorInfo must be an instance of the <span class="RenoLink"><a href="error_info.html">error_info</a></span> template.</li> <div><ul><li> ErrorInfo must be an instance of the <span class="RenoLink"><a href="error_info.html">error_info</a></span> template.</li>

View File

@ -73,12 +73,14 @@ boost
exception_ptr exception_ptr
get_bad_alloc() get_bad_alloc()
{ {
static exception_ptr e = boost::copy_exception( bad_alloc_ ba;
bad_alloc_() << exception_detail::clone_impl<bad_alloc_> c(ba);
throw_function("boost::current_exception()") << c <<
throw_function(BOOST_CURRENT_FUNCTION) <<
throw_file(__FILE__) << throw_file(__FILE__) <<
throw_line(__LINE__) ); throw_line(__LINE__);
return e; static exception_ptr ep(new exception_detail::clone_impl<bad_alloc_>(c));
return ep;
} }
template <int Dummy> template <int Dummy>

View File

@ -75,8 +75,8 @@ boost
void void
release() release()
{ {
if( px_ ) if( px_ && px_->release() )
px_->release(); px_=0;
} }
}; };
} }
@ -134,7 +134,7 @@ boost
class exception; class exception;
template <class> template <class T>
class shared_ptr; class shared_ptr;
namespace namespace
@ -150,7 +150,7 @@ boost
virtual shared_ptr<error_info_base> get( type_info_ const & ) const = 0; 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 set( shared_ptr<error_info_base> const &, type_info_ const & ) = 0;
virtual void add_ref() 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; virtual refcount_ptr<exception_detail::error_info_container> clone() const = 0;
protected: protected:

View File

@ -114,8 +114,8 @@ boost
tmp << header; tmp << header;
for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i ) 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; error_info_base const & x = *i->second;
tmp << '[' << x->tag_typeid_name() << "] = " << x->value_as_string() << '\n'; tmp << '[' << x.tag_typeid_name() << "] = " << x.value_as_string() << '\n';
} }
tmp.str().swap(diagnostic_info_str_); tmp.str().swap(diagnostic_info_str_);
} }
@ -140,11 +140,16 @@ boost
++count_; ++count_;
} }
void bool
release() const release() const
{ {
if( !--count_ ) if( --count_ )
return false;
else
{
delete this; delete this;
return true;
}
} }
refcount_ptr<error_info_container> refcount_ptr<error_info_container>

View File

@ -43,26 +43,6 @@
namespace boost 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 #ifdef BOOST_NO_EXCEPTIONS
void throw_exception( std::exception const & e ); // user defined void throw_exception( std::exception const & e ); // user defined
@ -86,6 +66,26 @@ template<class E> BOOST_ATTRIBUTE_NORETURN inline void throw_exception( E const
#endif #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 } // namespace boost
#endif // #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED #endif // #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED

View File

@ -9,6 +9,7 @@
#include <boost/exception/info.hpp> #include <boost/exception/info.hpp>
#include <boost/exception/diagnostic_information.hpp> #include <boost/exception/diagnostic_information.hpp>
#include <boost/detail/lightweight_test.hpp> #include <boost/detail/lightweight_test.hpp>
#include <stdlib.h>
struct struct
my_exception: my_exception:
@ -38,6 +39,7 @@ boost
#ifndef BOOST_NO_RTTI #ifndef BOOST_NO_RTTI
BOOST_TEST(s.find("my_tag")!=std::string::npos); BOOST_TEST(s.find("my_tag")!=std::string::npos);
#endif #endif
exit(0);
} }
} }

View File

@ -28,11 +28,16 @@ test_type
++count_; ++count_;
} }
void bool
release() release()
{ {
if( !--count_ ) if( --count_ )
return false;
else
{
delete this; delete this;
return true;
}
} }
private: private: