From c8fa8df081a323eeb832e18eb4242f1f217becbb Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Sat, 24 Jan 2026 20:33:59 -0500 Subject: [PATCH] Noexcept refinements --- include/boost/leaf/context.hpp | 4 ++-- include/boost/leaf/diagnostics.hpp | 2 -- include/boost/leaf/error.hpp | 5 ++--- include/boost/leaf/result.hpp | 8 ++++---- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/include/boost/leaf/context.hpp b/include/boost/leaf/context.hpp index bbfab30..5ae3bba 100644 --- a/include/boost/leaf/context.hpp +++ b/include/boost/leaf/context.hpp @@ -195,7 +195,7 @@ namespace detail tuple_for_each::deactivate(tup); } - BOOST_LEAF_CONSTEXPR static void unload( Tup & tup, int err_id ) noexcept + BOOST_LEAF_CONSTEXPR static void unload( Tup & tup, int err_id ) noexcept(!BOOST_LEAF_CFG_CAPTURE) { static_assert(!std::is_same(tup))>::type>::value, "Bug in LEAF: context type deduction"); BOOST_LEAF_ASSERT(err_id != 0); @@ -357,7 +357,7 @@ public: tuple_for_each::value,Tup>::deactivate(tup_); } - BOOST_LEAF_CONSTEXPR void unload(error_id id) noexcept + BOOST_LEAF_CONSTEXPR void unload(error_id id) noexcept(!BOOST_LEAF_CFG_CAPTURE) { BOOST_LEAF_ASSERT(!is_active()); detail::tuple_for_each::value,Tup>::unload(tup_, id.value()); diff --git a/include/boost/leaf/diagnostics.hpp b/include/boost/leaf/diagnostics.hpp index d9e0fa5..04758f5 100644 --- a/include/boost/leaf/diagnostics.hpp +++ b/include/boost/leaf/diagnostics.hpp @@ -217,8 +217,6 @@ namespace detail #endif // #else (#if BOOST_LEAF_CFG_CAPTURE) -using verbose_diagnostic_info = diagnostic_details; - } } // namespace boost::leaf #endif // #ifndef BOOST_LEAF_DIAGNOSTICS_HPP_INCLUDED diff --git a/include/boost/leaf/error.hpp b/include/boost/leaf/error.hpp index af0fabc..360bc9b 100644 --- a/include/boost/leaf/error.hpp +++ b/include/boost/leaf/error.hpp @@ -118,7 +118,6 @@ struct show_in_diagnostics: std::false_type namespace serialization { - template typename std::enable_if::value>::type serialize(Encoder &, T const &, char const *, Unused && ...) @@ -863,13 +862,13 @@ namespace detail } } -inline error_id new_error() +BOOST_LEAF_ATTRIBUTE_NODISCARD inline error_id new_error() { return detail::make_error_id(detail::start_new_error()); } template -inline error_id new_error( Item && ... item ) +BOOST_LEAF_ATTRIBUTE_NODISCARD inline error_id new_error( Item && ... item ) { return detail::make_error_id(detail::start_new_error()).load(std::forward(item)...); } diff --git a/include/boost/leaf/result.hpp b/include/boost/leaf/result.hpp index c04b0f0..6f8fe15 100644 --- a/include/boost/leaf/result.hpp +++ b/include/boost/leaf/result.hpp @@ -410,13 +410,13 @@ public: #endif // #else (#if defined(BOOST_STRICT_CONFIG) || !defined(__clang__)) #if BOOST_LEAF_CFG_STD_SYSTEM_ERROR - result( std::error_code const & ec ) noexcept: + result( std::error_code const & ec ) noexcept(!BOOST_LEAF_CFG_CAPTURE): what_(error_id(ec)) { } template ::value, int>::type> - result( Enum e ) noexcept: + result( Enum e ) noexcept(!BOOST_LEAF_CFG_CAPTURE): what_(error_id(e)) { } @@ -652,13 +652,13 @@ public: } #if BOOST_LEAF_CFG_STD_SYSTEM_ERROR - result( std::error_code const & ec ) noexcept: + result( std::error_code const & ec ) noexcept(!BOOST_LEAF_CFG_CAPTURE): base(ec) { } template ::value, int>::type> - result( Enum e ) noexcept: + result( Enum e ) noexcept(!BOOST_LEAF_CFG_CAPTURE): base(e) { }