From 3144a406d4b056a67a4d8061532f8242c5981923 Mon Sep 17 00:00:00 2001 From: "Pavel A. Lebedev" Date: Fri, 18 Dec 2020 01:45:19 +0300 Subject: [PATCH] Define boost::wrapexcept even when BOOST_EXCEPTION_DISABLE is defined. Since Boost.Exception started using boost::wrapexcept in implementation of boost::exception_ptr, we need to define it even when BOOST_EXCEPTION_DISABLE is defined, otherwise it won't compile: $ clang++ -DBOOST_EXCEPTION_DISABLE -w -x c++ \ /usr/include/boost/exception_ptr.hpp -fsyntax-only In file included from /usr/include/boost/exception_ptr.hpp:9: /usr/include/boost/exception/detail/exception_ptr.hpp:87:49: error: use of undeclared identifier 'wrapexcept' return exception_ptr(boost::make_shared >(cp)); ^ 1 error generated. --- include/boost/throw_exception.hpp | 50 ++++++++++++++++++------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/include/boost/throw_exception.hpp b/include/boost/throw_exception.hpp index 37b79b6..6a68a1b 100644 --- a/include/boost/throw_exception.hpp +++ b/include/boost/throw_exception.hpp @@ -49,26 +49,7 @@ BOOST_NORETURN void throw_exception( std::exception const & e, boost::source_loc } // namespace boost -#elif defined( BOOST_EXCEPTION_DISABLE ) - -namespace boost -{ - -template BOOST_NORETURN void throw_exception( E const & e ) -{ - throw_exception_assert_compatibility( e ); - throw e; -} - -template BOOST_NORETURN void throw_exception( E const & e, boost::source_location const & ) -{ - throw_exception_assert_compatibility( e ); - throw e; -} - -} // namespace boost - -#else // !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE ) +#else // !defined( BOOST_NO_EXCEPTIONS ) #include @@ -157,6 +138,31 @@ public: } }; +} // namespace boost + +#if defined( BOOST_EXCEPTION_DISABLE ) + +namespace boost +{ + +template BOOST_NORETURN void throw_exception( E const & e ) +{ + throw_exception_assert_compatibility( e ); + throw e; +} + +template BOOST_NORETURN void throw_exception( E const & e, boost::source_location const & ) +{ + throw_exception_assert_compatibility( e ); + throw e; +} + +} // namespace boost + +#else // !defined( BOOST_EXCEPTION_DISABLE ) + +namespace boost +{ // boost::throw_exception template BOOST_NORETURN void throw_exception( E const & e ) @@ -173,7 +179,9 @@ template BOOST_NORETURN void throw_exception( E const & e, boost::sourc } // namespace boost -#endif +#endif // # if defined( BOOST_EXCEPTION_DISABLE ) + +#endif // # if defined( BOOST_NO_EXCEPTIONS ) // BOOST_THROW_EXCEPTION