Merge remote-tracking branch 'origin/develop'

This commit is contained in:
Emil Dotchevski
2019-06-06 15:18:09 -07:00
16 changed files with 72 additions and 26 deletions

30
CMakeLists.txt Normal file
View File

@ -0,0 +1,30 @@
# Copyright 2019 Mike Dev
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
#
# NOTE: CMake support for Boost.Exception is currently experimental at best
# and the interface is likely to change in the future
cmake_minimum_required( VERSION 3.5 )
project( BoostException LANGUAGES CXX )
# We treat Boost.Exception as header only for now.
# See https://github.com/boostorg/exception/pull/17
# for more information.
add_library( boost_exception INTERFACE )
add_library( Boost::exception ALIAS boost_exception )
target_include_directories( boost_exception INTERFACE include )
target_link_libraries( boost_exception
INTERFACE
Boost::assert
Boost::config
Boost::core
Boost::smart_ptr
Boost::throw_exception
Boost::tuple
Boost::type_traits
)

View File

@ -35,14 +35,14 @@ error: //Base for all exception objects we throw.
public: public:
char const * char const *
what() const throw() what() const BOOST_NOEXCEPT_OR_NOTHROW
{ {
return "example_io error"; return "example_io error";
} }
protected: protected:
~error() throw() ~error() BOOST_NOEXCEPT_OR_NOTHROW
{ {
} }
}; };

View File

@ -35,7 +35,7 @@ boost
virtual error_info_base * clone() const = 0; virtual error_info_base * clone() const = 0;
virtual virtual
~error_info_base() throw() ~error_info_base() BOOST_NOEXCEPT_OR_NOTHROW
{ {
} }
}; };
@ -46,7 +46,7 @@ boost
error_info: error_info:
public exception_detail::error_info_base public exception_detail::error_info_base
{ {
error_info_base * exception_detail::error_info_base *
clone() const clone() const
{ {
return new error_info<Tag,T>(*this); return new error_info<Tag,T>(*this);
@ -73,7 +73,7 @@ boost
} }
#endif #endif
#endif #endif
~error_info() throw() ~error_info() BOOST_NOEXCEPT_OR_NOTHROW
{ {
} }
value_type const & value_type const &

View File

@ -105,7 +105,7 @@ boost
boost::exception, boost::exception,
std::bad_alloc std::bad_alloc
{ {
~bad_alloc_() throw() { } ~bad_alloc_() BOOST_NOEXCEPT_OR_NOTHROW { }
}; };
struct struct
@ -113,7 +113,7 @@ boost
boost::exception, boost::exception,
std::bad_exception std::bad_exception
{ {
~bad_exception_() throw() { } ~bad_exception_() BOOST_NOEXCEPT_OR_NOTHROW { }
}; };
template <class Exception> template <class Exception>
@ -174,7 +174,7 @@ boost
add_original_type(e); add_original_type(e);
} }
~unknown_exception() throw() ~unknown_exception() BOOST_NOEXCEPT_OR_NOTHROW
{ {
} }
@ -220,7 +220,7 @@ boost
add_original_type(e1); add_original_type(e1);
} }
~current_exception_std_exception_wrapper() throw() ~current_exception_std_exception_wrapper() BOOST_NOEXCEPT_OR_NOTHROW
{ {
} }

View File

@ -45,6 +45,10 @@ boost
std::exception const * se=current_exception_cast<std::exception const>(); std::exception const * se=current_exception_cast<std::exception const>();
if( be || se ) if( be || se )
return exception_detail::diagnostic_information_impl(be,se,true,verbose); return exception_detail::diagnostic_information_impl(be,se,true,verbose);
#if defined(__GLIBCXX__) && __cplusplus >= 201103L && !defined(BOOST_NO_RTTI)
else if (auto* p=std::current_exception().__cxa_exception_type())
return "Dynamic exception type: "+boost::core::demangle(p->name());
#endif
else else
return "No diagnostic information available."; return "No diagnostic information available.";
} }
@ -157,7 +161,7 @@ boost
core::demangle((be?(BOOST_EXCEPTION_DYNAMIC_TYPEID(*be)):(BOOST_EXCEPTION_DYNAMIC_TYPEID(*se))).type_->name()) << '\n'; core::demangle((be?(BOOST_EXCEPTION_DYNAMIC_TYPEID(*be)):(BOOST_EXCEPTION_DYNAMIC_TYPEID(*se))).type_->name()) << '\n';
#endif #endif
if( with_what && se && verbose ) if( with_what && se && verbose )
tmp << "std::exception::what: " << wh << '\n'; tmp << "std::exception::what: " << (wh ? wh : "(null)") << '\n';
if( be ) if( be )
if( char const * s=exception_detail::get_diagnostic_information(*be,tmp.str().c_str()) ) if( char const * s=exception_detail::get_diagnostic_information(*be,tmp.str().c_str()) )
if( *s ) if( *s )
@ -175,7 +179,7 @@ boost
inline inline
char const * char const *
diagnostic_information_what( exception const & e, bool verbose=true ) throw() diagnostic_information_what( exception const & e, bool verbose=true ) BOOST_NOEXCEPT_OR_NOTHROW
{ {
char const * w=0; char const * w=0;
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS

View File

@ -62,7 +62,7 @@ boost
{ {
} }
~error_info_container_impl() throw() ~error_info_container_impl() BOOST_NOEXCEPT_OR_NOTHROW
{ {
} }

View File

@ -230,7 +230,7 @@ namespace
{ {
} }
~cloned_exception() throw() ~cloned_exception() BOOST_NOEXCEPT_OR_NOTHROW
{ {
} }

View File

@ -71,3 +71,5 @@ compile errinfo_file_name_hpp_test.cpp ;
compile errinfo_file_open_mode_hpp_test.cpp ; compile errinfo_file_open_mode_hpp_test.cpp ;
compile errinfo_nested_exception_hpp_test.cpp ; compile errinfo_nested_exception_hpp_test.cpp ;
compile errinfo_type_info_name_hpp_test.cpp ; compile errinfo_type_info_name_hpp_test.cpp ;
compile bug_11874_test.cpp ;

10
test/bug_11874_test.cpp Normal file
View File

@ -0,0 +1,10 @@
//Copyright (c) 2006-2017 Emil Dotchevski and Reverge Studios, Inc.
//Distributed under the Boost Software License, Version 1.0. (See accompanying
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/thread.hpp>
int main()
{
}

View File

@ -73,7 +73,7 @@ derives_std_boost_exception:
{ {
} }
char const * what() const throw() char const * what() const BOOST_NOEXCEPT_OR_NOTHROW
{ {
return wh_; return wh_;
} }

View File

@ -29,7 +29,7 @@ err:
} }
virtual virtual
~err() throw() ~err() BOOST_NOEXCEPT_OR_NOTHROW
{ {
--exc_count; --exc_count;
} }

View File

@ -28,7 +28,7 @@ error1:
boost::exception boost::exception
{ {
char const * char const *
what() const throw() what() const BOOST_NOEXCEPT_OR_NOTHROW
{ {
return "error1"; return "error1";
} }
@ -45,7 +45,7 @@ error3:
std::exception std::exception
{ {
char const * char const *
what() const throw() what() const BOOST_NOEXCEPT_OR_NOTHROW
{ {
return "error3"; return "error3";
} }
@ -57,7 +57,7 @@ error4:
boost::exception boost::exception
{ {
char const * char const *
what() const throw() what() const BOOST_NOEXCEPT_OR_NOTHROW
{ {
return diagnostic_information_what(*this); return diagnostic_information_what(*this);
} }

View File

@ -87,7 +87,7 @@ exc:
} }
virtual virtual
~exc() throw() ~exc() BOOST_NOEXCEPT_OR_NOTHROW
{ {
--exc_count; --exc_count;
} }

View File

@ -20,7 +20,7 @@ boost
} }
derives_boost_exception:: derives_boost_exception::
~derives_boost_exception() throw() ~derives_boost_exception() BOOST_NOEXCEPT_OR_NOTHROW
{ {
} }
@ -32,7 +32,7 @@ boost
} }
derives_boost_exception_virtually:: derives_boost_exception_virtually::
~derives_boost_exception_virtually() throw() ~derives_boost_exception_virtually() BOOST_NOEXCEPT_OR_NOTHROW
{ {
} }
@ -44,7 +44,7 @@ boost
} }
derives_std_exception:: derives_std_exception::
~derives_std_exception() throw() ~derives_std_exception() BOOST_NOEXCEPT_OR_NOTHROW
{ {
} }

View File

@ -21,7 +21,7 @@ boost
public std::exception public std::exception
{ {
explicit derives_boost_exception( int x ); explicit derives_boost_exception( int x );
virtual ~derives_boost_exception() throw(); virtual ~derives_boost_exception() BOOST_NOEXCEPT_OR_NOTHROW;
int x_; int x_;
}; };
@ -31,7 +31,7 @@ boost
public std::exception public std::exception
{ {
explicit derives_boost_exception_virtually( int x ); explicit derives_boost_exception_virtually( int x );
virtual ~derives_boost_exception_virtually() throw(); virtual ~derives_boost_exception_virtually() BOOST_NOEXCEPT_OR_NOTHROW;
int x_; int x_;
}; };
@ -40,7 +40,7 @@ boost
public std::exception public std::exception
{ {
explicit derives_std_exception( int x ); explicit derives_std_exception( int x );
virtual ~derives_std_exception() throw(); virtual ~derives_std_exception() BOOST_NOEXCEPT_OR_NOTHROW;
int x_; int x_;
}; };

View File

@ -17,7 +17,7 @@ my_exception:
std::exception std::exception
{ {
char const * char const *
what() const throw() what() const BOOST_NOEXCEPT_OR_NOTHROW
{ {
return "my_exception"; return "my_exception";
} }