summaryrefslogtreecommitdiff
path: root/boost/exception/diagnostic_information.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/exception/diagnostic_information.hpp')
-rw-r--r--boost/exception/diagnostic_information.hpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/boost/exception/diagnostic_information.hpp b/boost/exception/diagnostic_information.hpp
index ef89d73144..305e8edd61 100644
--- a/boost/exception/diagnostic_information.hpp
+++ b/boost/exception/diagnostic_information.hpp
@@ -5,7 +5,7 @@
#ifndef UUID_0552D49838DD11DD90146B8956D89593
#define UUID_0552D49838DD11DD90146B8956D89593
-#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
@@ -17,7 +17,7 @@
#include <boost/exception/info.hpp>
#include <boost/utility/enable_if.hpp>
#ifndef BOOST_NO_RTTI
-#include <boost/units/detail/utility.hpp>
+#include <boost/core/demangle.hpp>
#endif
#include <exception>
#include <sstream>
@@ -31,17 +31,17 @@ boost
namespace
exception_detail
{
- std::string diagnostic_information_impl( boost::exception const *, std::exception const *, bool );
+ std::string diagnostic_information_impl( boost::exception const *, std::exception const *, bool, bool );
}
inline
std::string
- current_exception_diagnostic_information()
+ current_exception_diagnostic_information( bool verbose=true)
{
boost::exception const * be=current_exception_cast<boost::exception const>();
std::exception const * se=current_exception_cast<std::exception const>();
if( be || se )
- return exception_detail::diagnostic_information_impl(be,se,true);
+ return exception_detail::diagnostic_information_impl(be,se,true,verbose);
else
return "No diagnostic information available.";
}
@@ -107,7 +107,7 @@ boost
inline
std::string
- diagnostic_information_impl( boost::exception const * be, std::exception const * se, bool with_what )
+ diagnostic_information_impl( boost::exception const * be, std::exception const * se, bool with_what, bool verbose )
{
if( !be && !se )
return "Unknown exception.";
@@ -125,7 +125,7 @@ boost
return wh;
}
std::ostringstream tmp;
- if( be )
+ if( be && verbose )
{
char const * const * f=get_error_info<throw_file>(*be);
int const * l=get_error_info<throw_line>(*be);
@@ -149,36 +149,37 @@ boost
}
}
#ifndef BOOST_NO_RTTI
- tmp << std::string("Dynamic exception type: ") <<
- units::detail::demangle((be?(BOOST_EXCEPTION_DYNAMIC_TYPEID(*be)):(BOOST_EXCEPTION_DYNAMIC_TYPEID(*se))).type_->name()) << '\n';
+ if ( verbose )
+ tmp << std::string("Dynamic exception type: ") <<
+ core::demangle((be?(BOOST_EXCEPTION_DYNAMIC_TYPEID(*be)):(BOOST_EXCEPTION_DYNAMIC_TYPEID(*se))).type_->name()) << '\n';
#endif
- if( with_what && se )
+ if( with_what && se && verbose )
tmp << "std::exception::what: " << wh << '\n';
if( be )
if( char const * s=exception_detail::get_diagnostic_information(*be,tmp.str().c_str()) )
if( *s )
- return s;
+ return std::string(s);
return tmp.str();
}
}
template <class T>
std::string
- diagnostic_information( T const & e )
+ diagnostic_information( T const & e, bool verbose=true )
{
- return exception_detail::diagnostic_information_impl(exception_detail::get_boost_exception(&e),exception_detail::get_std_exception(&e),true);
+ return exception_detail::diagnostic_information_impl(exception_detail::get_boost_exception(&e),exception_detail::get_std_exception(&e),true,verbose);
}
inline
char const *
- diagnostic_information_what( exception const & e ) throw()
+ diagnostic_information_what( exception const & e, bool verbose=true ) throw()
{
char const * w=0;
#ifndef BOOST_NO_EXCEPTIONS
try
{
#endif
- (void) exception_detail::diagnostic_information_impl(&e,0,false);
+ (void) exception_detail::diagnostic_information_impl(&e,0,false,verbose);
if( char const * di=exception_detail::get_diagnostic_information(e,0) )
return di;
else