From ec11ab1d9cd6fa4542be854ca8940484d448a666 Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Sun, 8 Sep 2024 22:20:57 -0700 Subject: [PATCH] Renamed namespace leaf_detail -> detail --- include/boost/leaf/config/tls_array.hpp | 2 +- include/boost/leaf/config/tls_cpp11.hpp | 2 +- include/boost/leaf/config/tls_globals.hpp | 2 +- include/boost/leaf/context.hpp | 24 ++++---- include/boost/leaf/detail/capture_list.hpp | 4 +- include/boost/leaf/detail/demangle.hpp | 8 +-- include/boost/leaf/detail/function_traits.hpp | 2 +- include/boost/leaf/detail/optional.hpp | 2 +- include/boost/leaf/detail/print.hpp | 2 +- include/boost/leaf/diagnostics.hpp | 16 ++--- include/boost/leaf/error.hpp | 44 +++++++------- include/boost/leaf/exception.hpp | 28 ++++----- include/boost/leaf/handle_errors.hpp | 60 +++++++++---------- include/boost/leaf/on_error.hpp | 20 +++---- include/boost/leaf/pred.hpp | 22 +++---- include/boost/leaf/result.hpp | 48 +++++++-------- test/boost_exception_test.cpp | 2 +- test/context_deduction_test.cpp | 2 +- test/error_id_test.cpp | 6 +- test/exception_test.cpp | 16 ++--- test/function_traits_test.cpp | 4 +- test/optional_test.cpp | 2 +- test/print_test.cpp | 2 +- test/tls_array_test.cpp | 2 +- 24 files changed, 161 insertions(+), 161 deletions(-) diff --git a/include/boost/leaf/config/tls_array.hpp b/include/boost/leaf/config/tls_array.hpp index 324c578d..a358d75f 100644 --- a/include/boost/leaf/config/tls_array.hpp +++ b/include/boost/leaf/config/tls_array.hpp @@ -53,7 +53,7 @@ static_assert((BOOST_LEAF_CFG_TLS_ARRAY_START_INDEX) >= 0, namespace boost { namespace leaf { -namespace leaf_detail +namespace detail { using atomic_unsigned_int = std::atomic; } diff --git a/include/boost/leaf/config/tls_cpp11.hpp b/include/boost/leaf/config/tls_cpp11.hpp index 8c863ef6..89e22794 100644 --- a/include/boost/leaf/config/tls_cpp11.hpp +++ b/include/boost/leaf/config/tls_cpp11.hpp @@ -16,7 +16,7 @@ namespace boost { namespace leaf { -namespace leaf_detail +namespace detail { using atomic_unsigned_int = std::atomic; } diff --git a/include/boost/leaf/config/tls_globals.hpp b/include/boost/leaf/config/tls_globals.hpp index a21498ff..8d1a7372 100644 --- a/include/boost/leaf/config/tls_globals.hpp +++ b/include/boost/leaf/config/tls_globals.hpp @@ -15,7 +15,7 @@ namespace boost { namespace leaf { -namespace leaf_detail +namespace detail { using atomic_unsigned_int = unsigned int; } diff --git a/include/boost/leaf/context.hpp b/include/boost/leaf/context.hpp index f18b6d39..294ebae5 100644 --- a/include/boost/leaf/context.hpp +++ b/include/boost/leaf/context.hpp @@ -24,7 +24,7 @@ struct is_predicate: std::false_type { }; -namespace leaf_detail +namespace detail { template struct is_exception: std::is_base_of::type> @@ -135,7 +135,7 @@ namespace leaf_detail //////////////////////////////////////// -namespace leaf_detail +namespace detail { template struct get_dispatch @@ -176,7 +176,7 @@ namespace leaf_detail //////////////////////////////////////// -namespace leaf_detail +namespace detail { template struct tuple_for_each @@ -232,7 +232,7 @@ namespace leaf_detail //////////////////////////////////////////// -namespace leaf_detail +namespace detail { template struct does_not_participate_in_context_deduction: std::is_abstract { }; template <> struct does_not_participate_in_context_deduction: std::true_type { }; @@ -273,7 +273,7 @@ class context context( context const & ) = delete; context & operator=( context const & ) = delete; - using Tup = leaf_detail::deduce_e_tuple; + using Tup = detail::deduce_e_tuple; Tup tup_; bool is_active_; @@ -336,7 +336,7 @@ class context BOOST_LEAF_CONSTEXPR void activate() noexcept { - using namespace leaf_detail; + using namespace detail; BOOST_LEAF_ASSERT(!is_active()); tuple_for_each::value,Tup>::activate(tup_); #if !defined(BOOST_LEAF_NO_THREADS) && !defined(NDEBUG) @@ -347,7 +347,7 @@ class context BOOST_LEAF_CONSTEXPR void deactivate() noexcept { - using namespace leaf_detail; + using namespace detail; BOOST_LEAF_ASSERT(is_active()); is_active_ = false; #if !defined(BOOST_LEAF_NO_THREADS) && !defined(NDEBUG) @@ -360,7 +360,7 @@ class context BOOST_LEAF_CONSTEXPR void unload(error_id id) noexcept { BOOST_LEAF_ASSERT(!is_active()); - leaf_detail::tuple_for_each::value,Tup>::unload(tup_, id.value()); + detail::tuple_for_each::value,Tup>::unload(tup_, id.value()); } BOOST_LEAF_CONSTEXPR bool is_active() const noexcept @@ -372,7 +372,7 @@ class context void print( std::basic_ostream & os ) const { char const * prefix = "Contents:"; - leaf_detail::print_tuple_contents(os, &tup_, error_id(), prefix); + detail::print_tuple_contents(os, &tup_, error_id(), prefix); } template @@ -385,7 +385,7 @@ class context template BOOST_LEAF_CONSTEXPR T const * get(error_id err) const noexcept { - leaf_detail::slot const * e = leaf_detail::find_in_tuple>(tup_); + detail::slot const * e = detail::find_in_tuple>(tup_); return e ? e->has_value(err.value()) : nullptr; } @@ -403,7 +403,7 @@ class context //////////////////////////////////////// -namespace leaf_detail +namespace detail { template struct deduce_context_impl; @@ -443,7 +443,7 @@ namespace leaf_detail } template -using context_type_from_handlers = typename leaf_detail::context_type_from_handlers_impl::type; +using context_type_from_handlers = typename detail::context_type_from_handlers_impl::type; //////////////////////////////////////////// diff --git a/include/boost/leaf/detail/capture_list.hpp b/include/boost/leaf/detail/capture_list.hpp index b2c721b7..759571d3 100644 --- a/include/boost/leaf/detail/capture_list.hpp +++ b/include/boost/leaf/detail/capture_list.hpp @@ -17,7 +17,7 @@ namespace boost { namespace leaf { class error_id; -namespace leaf_detail +namespace detail { struct BOOST_LEAF_SYMBOL_VISIBLE tls_tag_id_factory_current_id; @@ -88,7 +88,7 @@ namespace leaf_detail { capture_list moved(first_); first_ = nullptr; - tls::write_uint(unsigned(err_id)); + tls::write_uint(unsigned(err_id)); moved.for_each( [err_id]( node & n ) { diff --git a/include/boost/leaf/detail/demangle.hpp b/include/boost/leaf/detail/demangle.hpp index ac5960a1..e56d1d7b 100644 --- a/include/boost/leaf/detail/demangle.hpp +++ b/include/boost/leaf/detail/demangle.hpp @@ -46,7 +46,7 @@ namespace boost { namespace leaf { -namespace leaf_detail +namespace detail { // The functions below are C++11 constexpr, but we use BOOST_LEAF_ALWAYS_INLINE to control object file // section count / template bleat. Evidently this makes a difference on gcc / windows at least. @@ -145,7 +145,7 @@ namespace n // Unrecognized __PRETTY_FUNCTION__/__FUNCSIG__ formats will result in compiler diagnostics. // In that case, please file an issue on https://github.com/boostorg/leaf. -#define BOOST_LEAF_P(P) (sizeof(char[1 + leaf_detail::check_prefix(BOOST_LEAF_PRETTY_FUNCTION, P)]) - 1) +#define BOOST_LEAF_P(P) (sizeof(char[1 + detail::check_prefix(BOOST_LEAF_PRETTY_FUNCTION, P)]) - 1) // clang style: int const p01 = BOOST_LEAF_P("r boost::leaf::n::p() [T = "); // old clang style: @@ -170,7 +170,7 @@ namespace n int const p15 = BOOST_LEAF_P("struct boost::leaf::n::r __fastcall boost::leaf::n::p<"); #undef BOOST_LEAF_P -#define BOOST_LEAF_S(S) (sizeof(char[1 + leaf_detail::check_suffix(BOOST_LEAF_PRETTY_FUNCTION, S)]) - 1) +#define BOOST_LEAF_S(S) (sizeof(char[1 + detail::check_suffix(BOOST_LEAF_PRETTY_FUNCTION, S)]) - 1) // clang/gcc style: int const s01 = BOOST_LEAF_S("]"); // msvc style: @@ -213,7 +213,7 @@ parsed parse() namespace boost { namespace leaf { -namespace leaf_detail +namespace detail { template std::ostream & demangle_and_print(std::basic_ostream & os, char const * mangled_name) diff --git a/include/boost/leaf/detail/function_traits.hpp b/include/boost/leaf/detail/function_traits.hpp index df871249..fa800b25 100644 --- a/include/boost/leaf/detail/function_traits.hpp +++ b/include/boost/leaf/detail/function_traits.hpp @@ -12,7 +12,7 @@ namespace boost { namespace leaf { -namespace leaf_detail +namespace detail { template struct remove_noexcept { using type = T; }; template struct remove_noexcept { using type = R(*)(A...); }; diff --git a/include/boost/leaf/detail/optional.hpp b/include/boost/leaf/detail/optional.hpp index 873a16bc..57a6c2aa 100644 --- a/include/boost/leaf/detail/optional.hpp +++ b/include/boost/leaf/detail/optional.hpp @@ -13,7 +13,7 @@ namespace boost { namespace leaf { -namespace leaf_detail +namespace detail { template class optional diff --git a/include/boost/leaf/detail/print.hpp b/include/boost/leaf/detail/print.hpp index 0356a92f..bc5cdec2 100644 --- a/include/boost/leaf/detail/print.hpp +++ b/include/boost/leaf/detail/print.hpp @@ -21,7 +21,7 @@ struct show_in_diagnostics: std::true_type { }; -namespace leaf_detail +namespace detail { template struct is_printable: std::false_type diff --git a/include/boost/leaf/diagnostics.hpp b/include/boost/leaf/diagnostics.hpp index 6bd13942..1a93e7e8 100644 --- a/include/boost/leaf/diagnostics.hpp +++ b/include/boost/leaf/diagnostics.hpp @@ -27,7 +27,7 @@ class diagnostic_info: public error_info BOOST_LEAF_CONSTEXPR diagnostic_info( error_info const & ei, Tup const & tup ) noexcept: error_info(ei), tup_(&tup), - print_tuple_contents_(&leaf_detail::print_tuple_contents) + print_tuple_contents_(&detail::print_tuple_contents) { } @@ -47,7 +47,7 @@ class diagnostic_info: public error_info } }; -namespace leaf_detail +namespace detail { struct diagnostic_info_: diagnostic_info { @@ -97,7 +97,7 @@ class diagnostic_info: public error_info } }; -namespace leaf_detail +namespace detail { struct diagnostic_info_: diagnostic_info { @@ -128,14 +128,14 @@ namespace leaf_detail class diagnostic_details: public diagnostic_info { - leaf_detail::dynamic_allocator const * const da_; + detail::dynamic_allocator const * const da_; protected: diagnostic_details( diagnostic_details const & ) noexcept = default; template - BOOST_LEAF_CONSTEXPR diagnostic_details( error_info const & ei, Tup const & tup, leaf_detail::dynamic_allocator const * da ) noexcept: + BOOST_LEAF_CONSTEXPR diagnostic_details( error_info const & ei, Tup const & tup, detail::dynamic_allocator const * da ) noexcept: diagnostic_info(ei, tup), da_(da) { @@ -160,7 +160,7 @@ class diagnostic_details: public diagnostic_info } }; -namespace leaf_detail +namespace detail { struct diagnostic_details_: diagnostic_details { @@ -212,7 +212,7 @@ class diagnostic_details: public diagnostic_info } }; -namespace leaf_detail +namespace detail { struct diagnostic_details_: diagnostic_details { @@ -264,7 +264,7 @@ class diagnostic_details: public diagnostic_info } }; -namespace leaf_detail +namespace detail { struct diagnostic_details_: diagnostic_details { diff --git a/include/boost/leaf/error.hpp b/include/boost/leaf/error.hpp index 3a0e75fb..5264bbcd 100644 --- a/include/boost/leaf/error.hpp +++ b/include/boost/leaf/error.hpp @@ -59,7 +59,7 @@ #endif -#define BOOST_LEAF_NEW_ERROR ::boost::leaf::leaf_detail::inject_loc{__FILE__,__LINE__,__FUNCTION__}+::boost::leaf::new_error +#define BOOST_LEAF_NEW_ERROR ::boost::leaf::detail::inject_loc{__FILE__,__LINE__,__FUNCTION__}+::boost::leaf::new_error namespace boost { namespace leaf { @@ -85,7 +85,7 @@ struct show_in_diagnostics: std::false_type class BOOST_LEAF_SYMBOL_VISIBLE error_id; -namespace leaf_detail +namespace detail { class BOOST_LEAF_SYMBOL_VISIBLE exception_base { @@ -102,7 +102,7 @@ namespace leaf_detail //////////////////////////////////////// -namespace leaf_detail +namespace detail { template class BOOST_LEAF_SYMBOL_VISIBLE slot: @@ -170,7 +170,7 @@ namespace leaf_detail #if BOOST_LEAF_CFG_CAPTURE -namespace leaf_detail +namespace detail { class BOOST_LEAF_SYMBOL_VISIBLE dynamic_allocator: capture_list @@ -305,7 +305,7 @@ namespace leaf_detail if( std::exception_ptr ex = std::current_exception() ) (void) new capturing_exception_node(last_, std::move(ex)); #endif - leaf_detail::capture_list::node * const f = first_; + detail::capture_list::node * const f = first_; first_ = nullptr; last_ = &first_; return { err_id, capture_list(f) }; @@ -399,7 +399,7 @@ namespace leaf_detail } template <> -struct show_in_diagnostics: std::false_type +struct show_in_diagnostics: std::false_type { }; @@ -407,7 +407,7 @@ struct show_in_diagnostics: std::false_type //////////////////////////////////////// -namespace leaf_detail +namespace detail { template inline void slot::unload( int err_id ) noexcept(!BOOST_LEAF_CFG_CAPTURE) @@ -489,7 +489,7 @@ namespace leaf_detail //////////////////////////////////////// -namespace leaf_detail +namespace detail { template ::arity> struct load_item @@ -527,7 +527,7 @@ namespace leaf_detail //////////////////////////////////////// -namespace leaf_detail +namespace detail { struct BOOST_LEAF_SYMBOL_VISIBLE tls_tag_id_factory_current_id; @@ -578,7 +578,7 @@ namespace leaf_detail #if BOOST_LEAF_CFG_STD_SYSTEM_ERROR -namespace leaf_detail +namespace detail { class leaf_category final: public std::error_category { @@ -623,7 +623,7 @@ namespace leaf_detail inline bool is_error_id( std::error_code const & ec ) noexcept { - bool res = (&ec.category() == &leaf_detail::get_error_category<>::cat); + bool res = (&ec.category() == &detail::get_error_category<>::cat); BOOST_LEAF_ASSERT(!res || !ec.value() || ((ec.value()&3)==1)); return res; } @@ -632,14 +632,14 @@ inline bool is_error_id( std::error_code const & ec ) noexcept //////////////////////////////////////// -namespace leaf_detail +namespace detail { BOOST_LEAF_CONSTEXPR error_id make_error_id(int) noexcept; } class BOOST_LEAF_SYMBOL_VISIBLE error_id { - friend error_id BOOST_LEAF_CONSTEXPR leaf_detail::make_error_id(int) noexcept; + friend error_id BOOST_LEAF_CONSTEXPR detail::make_error_id(int) noexcept; int value_; @@ -658,20 +658,20 @@ class BOOST_LEAF_SYMBOL_VISIBLE error_id #if BOOST_LEAF_CFG_STD_SYSTEM_ERROR error_id( std::error_code const & ec ) noexcept: - value_(leaf_detail::import_error_code(ec)) + value_(detail::import_error_code(ec)) { BOOST_LEAF_ASSERT(!value_ || ((value_&3)==1)); } template error_id( Enum e, typename std::enable_if::value, Enum>::type * = 0 ) noexcept: - value_(leaf_detail::import_error_code(e)) + value_(detail::import_error_code(e)) { } operator std::error_code() const noexcept { - return std::error_code(value_, leaf_detail::get_error_category<>::cat); + return std::error_code(value_, detail::get_error_category<>::cat); } #endif @@ -685,7 +685,7 @@ class BOOST_LEAF_SYMBOL_VISIBLE error_id { if (int err_id = value()) { - int const unused[] = { 42, leaf_detail::load_item::load_(err_id, std::forward(item)) }; + int const unused[] = { 42, detail::load_item::load_(err_id, std::forward(item)) }; (void)unused; } return *this; @@ -696,7 +696,7 @@ class BOOST_LEAF_SYMBOL_VISIBLE error_id { if( int err_id = value() ) { - int const unused[] = { 42, leaf_detail::load_item::load_(err_id, std::forward(item))... }; + int const unused[] = { 42, detail::load_item::load_(err_id, std::forward(item))... }; (void) unused; } return *this; @@ -744,7 +744,7 @@ class BOOST_LEAF_SYMBOL_VISIBLE error_id } }; -namespace leaf_detail +namespace detail { BOOST_LEAF_CONSTEXPR inline error_id make_error_id( int err_id ) noexcept { @@ -755,18 +755,18 @@ namespace leaf_detail inline error_id new_error() noexcept { - return leaf_detail::make_error_id(leaf_detail::new_id()); + return detail::make_error_id(detail::new_id()); } template inline error_id new_error( Item && ... item ) noexcept { - return leaf_detail::make_error_id(leaf_detail::new_id()).load(std::forward(item)...); + return detail::make_error_id(detail::new_id()).load(std::forward(item)...); } inline error_id current_error() noexcept { - return leaf_detail::make_error_id(leaf_detail::current_id()); + return detail::make_error_id(detail::current_id()); } //////////////////////////////////////////// diff --git a/include/boost/leaf/exception.hpp b/include/boost/leaf/exception.hpp index be1616b1..fe0c1c33 100644 --- a/include/boost/leaf/exception.hpp +++ b/include/boost/leaf/exception.hpp @@ -20,7 +20,7 @@ namespace boost namespace boost { namespace leaf { -namespace leaf_detail +namespace detail { template [[noreturn]] void throw_exception_impl( T && e ) @@ -35,7 +35,7 @@ namespace leaf_detail namespace boost { namespace leaf { -namespace leaf_detail +namespace detail { template [[noreturn]] void throw_exception_impl( T && e ) @@ -50,11 +50,11 @@ namespace leaf_detail //////////////////////////////////////// -#define BOOST_LEAF_THROW_EXCEPTION ::boost::leaf::leaf_detail::throw_with_loc{__FILE__,__LINE__,__FUNCTION__}+::boost::leaf::leaf_detail::make_exception +#define BOOST_LEAF_THROW_EXCEPTION ::boost::leaf::detail::throw_with_loc{__FILE__,__LINE__,__FUNCTION__}+::boost::leaf::detail::make_exception namespace boost { namespace leaf { -namespace leaf_detail +namespace detail { struct throw_with_loc { @@ -66,14 +66,14 @@ namespace leaf_detail [[noreturn]] friend void operator+( throw_with_loc loc, Ex && ex ) { ex.load_source_location_(loc.file, loc.line, loc.fn); - ::boost::leaf::leaf_detail::throw_exception_impl(std::move(ex)); + ::boost::leaf::detail::throw_exception_impl(std::move(ex)); } }; } //////////////////////////////////////// -namespace leaf_detail +namespace detail { inline void enforce_std_exception( std::exception const & ) noexcept { } @@ -87,7 +87,7 @@ namespace leaf_detail bool is_current_exception() const noexcept { - return tls::read_uint() == unsigned(error_id::value()); + return tls::read_uint() == unsigned(error_id::value()); } error_id get_error_id() const noexcept final override @@ -99,7 +99,7 @@ namespace leaf_detail #if BOOST_LEAF_CFG_DIAGNOSTICS && !defined(BOOST_LEAF_NO_EXCEPTIONS) void print_type_name(std::ostream & os) const final override { - leaf_detail::demangle_and_print(os, typeid(Ex).name()); + detail::demangle_and_print(os, typeid(Ex).name()); } #endif @@ -149,7 +149,7 @@ namespace leaf_detail ~exception() noexcept { if( clear_current_error_ && is_current_exception() ) - tls::write_uint(0); + tls::write_uint(0); } }; @@ -218,8 +218,8 @@ template // Warning: setting a breakpoint here will not intercept exceptions thrown // via BOOST_LEAF_THROW_EXCEPTION or originating in the few other throw // points elsewhere in LEAF. To intercept all of those exceptions as well, - // set a breakpoint inside boost::leaf::leaf_detail::throw_exception_impl. - leaf_detail::throw_exception_impl(leaf_detail::make_exception(std::forward(e)...)); + // set a breakpoint inside boost::leaf::detail::throw_exception_impl. + detail::throw_exception_impl(detail::make_exception(std::forward(e)...)); } //////////////////////////////////////// @@ -229,7 +229,7 @@ template template class BOOST_LEAF_SYMBOL_VISIBLE result; -namespace leaf_detail +namespace detail { inline error_id catch_exceptions_helper( std::exception const &, leaf_detail_mp11::mp_list<> ) { @@ -263,7 +263,7 @@ namespace leaf_detail template inline -leaf_detail::deduce_exception_to_result_return_type> +detail::deduce_exception_to_result_return_type> exception_to_result( F && f ) noexcept { try @@ -272,7 +272,7 @@ exception_to_result( F && f ) noexcept } catch( std::exception const & ex ) { - return leaf_detail::catch_exceptions_helper(ex, leaf_detail_mp11::mp_list()); + return detail::catch_exceptions_helper(ex, leaf_detail_mp11::mp_list()); } catch(...) { diff --git a/include/boost/leaf/handle_errors.hpp b/include/boost/leaf/handle_errors.hpp index 4f91c854..88b11f92 100644 --- a/include/boost/leaf/handle_errors.hpp +++ b/include/boost/leaf/handle_errors.hpp @@ -19,11 +19,11 @@ class BOOST_LEAF_SYMBOL_VISIBLE result; #ifndef BOOST_LEAF_NO_EXCEPTIONS -namespace leaf_detail +namespace detail { inline error_id unpack_error_id(std::exception const & ex) noexcept { - if( leaf_detail::exception_base const * eb = dynamic_cast(&ex) ) + if( detail::exception_base const * eb = dynamic_cast(&ex) ) return eb->get_error_id(); if( error_id const * err_id = dynamic_cast(&ex) ) return *err_id; @@ -91,11 +91,11 @@ class BOOST_LEAF_SYMBOL_VISIBLE error_info { os << "\nCaught:" BOOST_LEAF_CFG_DIAGNOSTICS_FIRST_DELIMITER; #if BOOST_LEAF_CFG_DIAGNOSTICS - if( auto eb = dynamic_cast(ex_) ) + if( auto eb = dynamic_cast(ex_) ) eb->print_type_name(os); else #endif - leaf_detail::demangle_and_print(os, typeid(*ex_).name()); + detail::demangle_and_print(os, typeid(*ex_).name()); os << ": \"" << ex_->what() << '"'; } #endif @@ -109,7 +109,7 @@ class BOOST_LEAF_SYMBOL_VISIBLE error_info } }; -namespace leaf_detail +namespace detail { template <> struct handler_argument_traits: handler_argument_always_available<> @@ -124,7 +124,7 @@ namespace leaf_detail //////////////////////////////////////// -namespace leaf_detail +namespace detail { template struct type_index; @@ -297,7 +297,7 @@ namespace leaf_detail //////////////////////////////////////// -namespace leaf_detail +namespace detail { template template @@ -352,7 +352,7 @@ namespace leaf_detail //////////////////////////////////////// -namespace leaf_detail +namespace detail { template struct handler_matches_any_error: std::false_type @@ -373,7 +373,7 @@ namespace leaf_detail //////////////////////////////////////// -namespace leaf_detail +namespace detail { template BOOST_LEAF_CONSTEXPR inline bool check_handler_( Tup & tup, error_info const & ei, leaf_detail_mp11::mp_list ) noexcept @@ -485,7 +485,7 @@ context:: handle_error( error_id id, H && ... h ) const { BOOST_LEAF_ASSERT(!is_active()); - return leaf_detail::handle_error_(tup(), error_info(id, nullptr, this->get(id)), std::forward(h)...); + return detail::handle_error_(tup(), error_info(id, nullptr, this->get(id)), std::forward(h)...); } template @@ -496,12 +496,12 @@ context:: handle_error( error_id id, H && ... h ) { BOOST_LEAF_ASSERT(!is_active()); - return leaf_detail::handle_error_(tup(), error_info(id, nullptr, this->get(id)), std::forward(h)...); + return detail::handle_error_(tup(), error_info(id, nullptr, this->get(id)), std::forward(h)...); } //////////////////////////////////////// -namespace leaf_detail +namespace detail { template void unload_result( result * r ) @@ -530,7 +530,7 @@ try_handle_all( TryBlock && try_block, H && ... h ) noexcept return std::move(r).value(); else { - leaf_detail::unload_result(&r); + detail::unload_result(&r); error_id id = r.error(); ctx.deactivate(); using R = typename std::decay()().value())>::type; @@ -550,7 +550,7 @@ try_handle_some( TryBlock && try_block, H && ... h ) noexcept return r; else { - leaf_detail::unload_result(&r); + detail::unload_result(&r); error_id id = r.error(); ctx.deactivate(); using R = typename std::decay()())>::type; @@ -573,13 +573,13 @@ try_catch( TryBlock && try_block, H && ... ) noexcept #else -namespace leaf_detail +namespace detail { template decltype(std::declval()()) try_catch_( Ctx & ctx, TryBlock && try_block, H && ... h ) { - using namespace leaf_detail; + using namespace detail; BOOST_LEAF_ASSERT(ctx.is_active()); using R = decltype(std::declval()()); try @@ -591,7 +591,7 @@ namespace leaf_detail catch( std::exception & ex ) { ctx.deactivate(); - error_id id = leaf_detail::unpack_error_id(ex); + error_id id = detail::unpack_error_id(ex); return handle_error_(ctx.tup(), error_info(id, &ex, ctx.template get(id)), std::forward(h)..., [&]() -> R { @@ -621,12 +621,12 @@ try_handle_all( TryBlock && try_block, H && ... h ) static_assert(is_result_type()())>::value, "The return type of the try_block passed to try_handle_all must be registered with leaf::is_result_type"); context_type_from_handlers ctx; auto active_context = activate_context(ctx); - if( auto r = leaf_detail::try_catch_(ctx, std::forward(try_block), std::forward(h)...) ) + if( auto r = detail::try_catch_(ctx, std::forward(try_block), std::forward(h)...) ) return std::move(r).value(); else { BOOST_LEAF_ASSERT(ctx.is_active()); - leaf_detail::unload_result(&r); + detail::unload_result(&r); error_id id = r.error(); ctx.deactivate(); using R = typename std::decay()().value())>::type; @@ -642,11 +642,11 @@ try_handle_some( TryBlock && try_block, H && ... h ) static_assert(is_result_type()())>::value, "The return type of the try_block passed to try_handle_some must be registered with leaf::is_result_type"); context_type_from_handlers ctx; auto active_context = activate_context(ctx); - if( auto r = leaf_detail::try_catch_(ctx, std::forward(try_block), std::forward(h)...) ) + if( auto r = detail::try_catch_(ctx, std::forward(try_block), std::forward(h)...) ) return r; else if( ctx.is_active() ) { - leaf_detail::unload_result(&r); + detail::unload_result(&r); error_id id = r.error(); ctx.deactivate(); using R = typename std::decay()())>::type; @@ -681,8 +681,8 @@ try_catch( TryBlock && try_block, H && ... h ) catch( std::exception & ex ) { ctx.deactivate(); - error_id id = leaf_detail::unpack_error_id(ex); - return leaf_detail::handle_error_(ctx.tup(), error_info(id, &ex, ctx.template get(id)), std::forward(h)..., + error_id id = detail::unpack_error_id(ex); + return detail::handle_error_(ctx.tup(), error_info(id, &ex, ctx.template get(id)), std::forward(h)..., [&]() -> R { ctx.unload(id); @@ -693,7 +693,7 @@ try_catch( TryBlock && try_block, H && ... h ) { ctx.deactivate(); error_id id = current_error(); - return leaf_detail::handle_error_(ctx.tup(), error_info(id, nullptr, ctx.template get(id)), std::forward(h)..., + return detail::handle_error_(ctx.tup(), error_info(id, nullptr, ctx.template get(id)), std::forward(h)..., [&]() -> R { ctx.unload(id); @@ -706,7 +706,7 @@ try_catch( TryBlock && try_block, H && ... h ) #if BOOST_LEAF_CFG_CAPTURE -namespace leaf_detail +namespace detail { template struct try_capture_all_dispatch_non_void @@ -719,7 +719,7 @@ namespace leaf_detail leaf_result try_capture_all_( TryBlock && try_block ) noexcept { - leaf_detail::slot sl; + detail::slot sl; sl.activate(); #ifndef BOOST_LEAF_NO_EXCEPTIONS try @@ -780,7 +780,7 @@ namespace leaf_detail leaf_result try_capture_all_( TryBlock && try_block ) noexcept { - leaf_detail::slot sl; + detail::slot sl; sl.activate(); #ifndef BOOST_LEAF_NO_EXCEPTIONS try @@ -809,10 +809,10 @@ namespace leaf_detail template inline -typename leaf_detail::try_capture_all_dispatch()())>::leaf_result +typename detail::try_capture_all_dispatch()())>::leaf_result try_capture_all( TryBlock && try_block ) noexcept { - return leaf_detail::try_capture_all_dispatch()())>::try_capture_all_(std::forward(try_block)); + return detail::try_capture_all_dispatch()())>::try_capture_all_(std::forward(try_block)); } #endif @@ -826,7 +826,7 @@ namespace boost { namespace exception_detail { template struct namespace boost { namespace leaf { -namespace leaf_detail +namespace detail { template struct match_enum_type; diff --git a/include/boost/leaf/on_error.hpp b/include/boost/leaf/on_error.hpp index 4bbfb3df..439c433f 100644 --- a/include/boost/leaf/on_error.hpp +++ b/include/boost/leaf/on_error.hpp @@ -24,13 +24,13 @@ class error_monitor #if !defined(BOOST_LEAF_NO_EXCEPTIONS) && BOOST_LEAF_STD_UNCAUGHT_EXCEPTIONS uncaught_exceptions_(std::uncaught_exceptions()), #endif - err_id_(leaf_detail::current_id()) + err_id_(detail::current_id()) { } int check_id() const noexcept { - int err_id = leaf_detail::current_id(); + int err_id = detail::current_id(); if( err_id != err_id_ ) return err_id; else @@ -41,7 +41,7 @@ class error_monitor # else if( std::uncaught_exception() ) # endif - return leaf_detail::new_id(); + return detail::new_id(); #endif return 0; } @@ -49,27 +49,27 @@ class error_monitor int get_id() const noexcept { - int err_id = leaf_detail::current_id(); + int err_id = detail::current_id(); if( err_id != err_id_ ) return err_id; else - return leaf_detail::new_id(); + return detail::new_id(); } error_id check() const noexcept { - return leaf_detail::make_error_id(check_id()); + return detail::make_error_id(check_id()); } error_id assigned_error_id() const noexcept { - return leaf_detail::make_error_id(get_id()); + return detail::make_error_id(get_id()); } }; //////////////////////////////////////////// -namespace leaf_detail +namespace detail { template struct tuple_for_each_preload @@ -222,10 +222,10 @@ namespace leaf_detail template BOOST_LEAF_ATTRIBUTE_NODISCARD BOOST_LEAF_CONSTEXPR inline -leaf_detail::preloaded::type...> +detail::preloaded::type...> on_error( Item && ... i ) { - return leaf_detail::preloaded::type...>(std::forward(i)...); + return detail::preloaded::type...>(std::forward(i)...); } } } diff --git a/include/boost/leaf/pred.hpp b/include/boost/leaf/pred.hpp index 8d06eb61..f36e6636 100644 --- a/include/boost/leaf/pred.hpp +++ b/include/boost/leaf/pred.hpp @@ -12,13 +12,13 @@ #if __cplusplus >= 201703L # define BOOST_LEAF_MATCH_ARGS(et,v1,v) auto v1, auto... v #else -# define BOOST_LEAF_MATCH_ARGS(et,v1,v) typename leaf_detail::et::type v1, typename leaf_detail::et::type... v +# define BOOST_LEAF_MATCH_ARGS(et,v1,v) typename detail::et::type v1, typename detail::et::type... v #endif #define BOOST_LEAF_ESC(...) __VA_ARGS__ namespace boost { namespace leaf { -namespace leaf_detail +namespace detail { #if __cplusplus >= 201703L template @@ -76,7 +76,7 @@ BOOST_LEAF_CONSTEXPR inline bool category( std::error_code const & ec ) //////////////////////////////////////// -namespace leaf_detail +namespace detail { template struct match_enum_type @@ -108,7 +108,7 @@ struct match template BOOST_LEAF_CONSTEXPR static bool evaluate(T && x) { - return leaf_detail::cmp_value_pack(std::forward(x), V1, V...); + return detail::cmp_value_pack(std::forward(x), V1, V...); } }; @@ -121,7 +121,7 @@ struct match, V1, V...> BOOST_LEAF_CONSTEXPR static bool evaluate(std::error_code const & e) noexcept { - return leaf_detail::cmp_value_pack(e, V1, V...); + return detail::cmp_value_pack(e, V1, V...); } }; #endif @@ -133,7 +133,7 @@ struct is_predicate>: std::true_type //////////////////////////////////////// -namespace leaf_detail +namespace detail { template struct match_value_enum_type @@ -164,7 +164,7 @@ struct match_value BOOST_LEAF_CONSTEXPR static bool evaluate(E const & e) noexcept { - return leaf_detail::cmp_value_pack(e.value, V1, V...); + return detail::cmp_value_pack(e.value, V1, V...); } }; @@ -177,7 +177,7 @@ struct match_value, V1, V...> BOOST_LEAF_CONSTEXPR static bool evaluate(E const & e) { - return leaf_detail::cmp_value_pack(e.value, V1, V...); + return detail::cmp_value_pack(e.value, V1, V...); } }; #endif @@ -201,7 +201,7 @@ struct match_member BOOST_LEAF_CONSTEXPR static bool evaluate(E const & e) noexcept { - return leaf_detail::cmp_value_pack(e.*P, V1, V...); + return detail::cmp_value_pack(e.*P, V1, V...); } }; @@ -236,7 +236,7 @@ struct is_predicate>: std::true_type #ifndef BOOST_LEAF_NO_EXCEPTIONS -namespace leaf_detail +namespace detail { template BOOST_LEAF_CONSTEXPR inline bool check_exception_pack( std::exception const & ex, Ex const * ) noexcept @@ -264,7 +264,7 @@ struct catch_ BOOST_LEAF_CONSTEXPR static bool evaluate(std::exception const & ex) noexcept { - return leaf_detail::check_exception_pack(ex, static_cast(nullptr)...); + return detail::check_exception_pack(ex, static_cast(nullptr)...); } }; diff --git a/include/boost/leaf/result.hpp b/include/boost/leaf/result.hpp index 37d46774..e8577afc 100644 --- a/include/boost/leaf/result.hpp +++ b/include/boost/leaf/result.hpp @@ -16,7 +16,7 @@ namespace boost { namespace leaf { -namespace leaf_detail { class dynamic_allocator; } +namespace detail { class dynamic_allocator; } //////////////////////////////////////// @@ -31,7 +31,7 @@ class bad_result: //////////////////////////////////////// -namespace leaf_detail +namespace detail { template ::value> struct result_value_printer; @@ -65,7 +65,7 @@ namespace leaf_detail //////////////////////////////////////// -namespace leaf_detail +namespace detail { template struct stored @@ -133,7 +133,7 @@ namespace leaf_detail } #if BOOST_LEAF_CFG_CAPTURE - explicit result_discriminant( int err_id, leaf_detail::capture_list const & ) noexcept: + explicit result_discriminant( int err_id, detail::capture_list const & ) noexcept: state_((err_id&~3) | 2) { BOOST_LEAF_ASSERT((err_id&3) == 1); @@ -170,20 +170,20 @@ class BOOST_LEAF_SYMBOL_VISIBLE BOOST_LEAF_ATTRIBUTE_NODISCARD result template friend class result; - friend class leaf_detail::dynamic_allocator; + friend class detail::dynamic_allocator; #if BOOST_LEAF_CFG_CAPTURE - using capture_list = leaf_detail::capture_list; + using capture_list = detail::capture_list; #endif - using result_discriminant = leaf_detail::result_discriminant; - using stored_type = typename leaf_detail::stored::type; - using value_no_ref = typename leaf_detail::stored::value_no_ref; - using value_no_ref_const = typename leaf_detail::stored::value_no_ref_const; - using value_ref = typename leaf_detail::stored::value_ref; - using value_cref = typename leaf_detail::stored::value_cref; - using value_rv_ref = typename leaf_detail::stored::value_rv_ref; - using value_rv_cref = typename leaf_detail::stored::value_rv_cref; + using result_discriminant = detail::result_discriminant; + using stored_type = typename detail::stored::type; + using value_no_ref = typename detail::stored::value_no_ref; + using value_no_ref_const = typename detail::stored::value_no_ref_const; + using value_ref = typename detail::stored::value_ref; + using value_cref = typename detail::stored::value_cref; + using value_rv_ref = typename detail::stored::value_rv_ref; + using value_rv_cref = typename detail::stored::value_rv_cref; union { @@ -298,7 +298,7 @@ class BOOST_LEAF_SYMBOL_VISIBLE BOOST_LEAF_ATTRIBUTE_NODISCARD result protected: #if BOOST_LEAF_CFG_CAPTURE - result( int err_id, leaf_detail::capture_list && cap ) noexcept: + result( int err_id, detail::capture_list && cap ) noexcept: cap_(std::move(cap)), what_(err_id, cap) { @@ -519,12 +519,12 @@ class BOOST_LEAF_SYMBOL_VISIBLE BOOST_LEAF_ATTRIBUTE_NODISCARD result value_no_ref_const * operator->() const noexcept { - return has_value() ? leaf_detail::stored::cptr(stored_) : nullptr; + return has_value() ? detail::stored::cptr(stored_) : nullptr; } value_no_ref * operator->() noexcept { - return has_value() ? leaf_detail::stored::ptr(stored_) : nullptr; + return has_value() ? detail::stored::ptr(stored_) : nullptr; } #ifdef BOOST_LEAF_NO_CXX11_REF_QUALIFIERS @@ -598,7 +598,7 @@ class BOOST_LEAF_SYMBOL_VISIBLE BOOST_LEAF_ATTRIBUTE_NODISCARD result friend std::ostream & operator<<( std::basic_ostream & os, result const & r ) { if( r.what_.kind() == result_discriminant::val ) - leaf_detail::print_result_value(os, r.value()); + detail::print_result_value(os, r.value()); else r.print_error_result(os); return os; @@ -607,26 +607,26 @@ class BOOST_LEAF_SYMBOL_VISIBLE BOOST_LEAF_ATTRIBUTE_NODISCARD result //////////////////////////////////////// -namespace leaf_detail +namespace detail { struct void_ { }; } template <> class BOOST_LEAF_SYMBOL_VISIBLE BOOST_LEAF_ATTRIBUTE_NODISCARD result: - result + result { template friend class result; - friend class leaf_detail::dynamic_allocator; + friend class detail::dynamic_allocator; - using result_discriminant = leaf_detail::result_discriminant; - using void_ = leaf_detail::void_; + using result_discriminant = detail::result_discriminant; + using void_ = detail::void_; using base = result; #if BOOST_LEAF_CFG_CAPTURE - result( int err_id, leaf_detail::capture_list && cap ) noexcept: + result( int err_id, detail::capture_list && cap ) noexcept: base(err_id, std::move(cap)) { } diff --git a/test/boost_exception_test.cpp b/test/boost_exception_test.cpp index 2afcb409..3c48d9bb 100644 --- a/test/boost_exception_test.cpp +++ b/test/boost_exception_test.cpp @@ -38,7 +38,7 @@ int main() { static_assert(std::is_same>().matched)>::value, "handler_argument_traits deduction bug"); - using tr = leaf::leaf_detail::handler_argument_traits>; + using tr = leaf::detail::handler_argument_traits>; static_assert(std::is_same, tr::context_types>::value, "handler_argument_traits deduction bug"); { diff --git a/test/context_deduction_test.cpp b/test/context_deduction_test.cpp index 21963bd6..150d0470 100644 --- a/test/context_deduction_test.cpp +++ b/test/context_deduction_test.cpp @@ -139,7 +139,7 @@ void not_called_on_purpose() test, info<2>, leaf::e_source_location>( expd([]( info<1>, info<2>, leaf::diagnostic_info const & ){ }, []( info<1>, info<2> ){ }) ); #if BOOST_LEAF_CFG_DIAGNOSTICS && BOOST_LEAF_CFG_CAPTURE - test, info<2>, leaf::e_source_location, leaf::leaf_detail::dynamic_allocator>( expd([]( info<1>, info<2>, leaf::diagnostic_details const & ){ }, []( info<1>, info<2> ){ }) ); + test, info<2>, leaf::e_source_location, leaf::detail::dynamic_allocator>( expd([]( info<1>, info<2>, leaf::diagnostic_details const & ){ }, []( info<1>, info<2> ){ }) ); #else test, info<2>, leaf::e_source_location>( expd([]( info<1>, info<2>, leaf::diagnostic_details const & ){ }, []( info<1>, info<2> ){ }) ); #endif diff --git a/test/error_id_test.cpp b/test/error_id_test.cpp index c9782180..6afa8f86 100644 --- a/test/error_id_test.cpp +++ b/test/error_id_test.cpp @@ -25,10 +25,10 @@ std::vector generate_ids() ids.reserve(ids_per_thread); for(int i=0; i!=ids_per_thread-1; ++i) { - int id = leaf::leaf_detail::new_id(); + int id = leaf::detail::new_id(); BOOST_TEST_NE(id&1, 0); - int last = leaf::leaf_detail::current_id(); - BOOST_TEST_EQ(last, leaf::leaf_detail::current_id()); + int last = leaf::detail::current_id(); + BOOST_TEST_EQ(last, leaf::detail::current_id()); BOOST_TEST_NE(last&1, 0); BOOST_TEST_EQ(last, id); ids.push_back(id); diff --git a/test/exception_test.cpp b/test/exception_test.cpp index e1b81fb2..a0fdfebf 100644 --- a/test/exception_test.cpp +++ b/test/exception_test.cpp @@ -204,29 +204,29 @@ int main() } { - int const id = leaf::leaf_detail::current_id(); + int const id = leaf::detail::current_id(); BOOST_TEST_EQ( 21, test( [] { auto load = leaf::on_error(info{42}); throw my_exception(42); } ) ); - BOOST_TEST_NE(id, leaf::leaf_detail::current_id()); + BOOST_TEST_NE(id, leaf::detail::current_id()); } { - int const id = leaf::leaf_detail::current_id(); + int const id = leaf::detail::current_id(); BOOST_TEST_EQ( 21, test( [] { auto load = leaf::on_error(info{42}); throw my_exception(42); } ) ); - BOOST_TEST_NE(id, leaf::leaf_detail::current_id()); + BOOST_TEST_NE(id, leaf::detail::current_id()); } { BOOST_TEST_EQ( 23, test( [] { - int const id = leaf::leaf_detail::current_id(); + int const id = leaf::detail::current_id(); try { leaf::try_catch( @@ -237,7 +237,7 @@ int main() } catch(...) { - BOOST_TEST_EQ(id, leaf::leaf_detail::current_id()); + BOOST_TEST_EQ(id, leaf::detail::current_id()); throw; } } ) ); @@ -246,7 +246,7 @@ int main() { BOOST_TEST_EQ( 23, test( [] { - int const id = leaf::leaf_detail::current_id(); + int const id = leaf::detail::current_id(); try { leaf::try_catch( @@ -257,7 +257,7 @@ int main() } catch(...) { - BOOST_TEST_EQ(id, leaf::leaf_detail::current_id()); + BOOST_TEST_EQ(id, leaf::detail::current_id()); throw; } } ) ); diff --git a/test/function_traits_test.cpp b/test/function_traits_test.cpp index 2cd883c2..447f0c48 100644 --- a/test/function_traits_test.cpp +++ b/test/function_traits_test.cpp @@ -16,7 +16,7 @@ namespace leaf = boost::leaf; template void check_traits( F ) { - using namespace leaf::leaf_detail; + using namespace leaf::detail; using leaf::leaf_detail_mp11::mp_list; static_assert(function_traits::arity==4,"arity"); static_assert(std::is_same,double>::value,"return_type"); @@ -44,6 +44,6 @@ int main() { return 42; } ); - static_assert(leaf::leaf_detail::function_traits::arity==-1, "int arity"); + static_assert(leaf::detail::function_traits::arity==-1, "int arity"); return 0; } diff --git a/test/optional_test.cpp b/test/optional_test.cpp index 2134f271..d2e2ceaa 100644 --- a/test/optional_test.cpp +++ b/test/optional_test.cpp @@ -85,7 +85,7 @@ class throws_on_copy void run_tests() { - using leaf::leaf_detail::optional; + using leaf::detail::optional; { optional x; BOOST_TEST(x.empty()); diff --git a/test/print_test.cpp b/test/print_test.cpp index c867e2ea..17bcbbec 100644 --- a/test/print_test.cpp +++ b/test/print_test.cpp @@ -72,7 +72,7 @@ struct c4 template std::string print(T const & x, char const * prefix, char const * delimiter) { - using namespace leaf::leaf_detail; + using namespace leaf::detail; std::ostringstream s; diagnostic::print(s, prefix, delimiter, x); diagnostic::print(s, prefix, delimiter, x); diff --git a/test/tls_array_test.cpp b/test/tls_array_test.cpp index 21c304e0..a44a32d5 100644 --- a/test/tls_array_test.cpp +++ b/test/tls_array_test.cpp @@ -62,7 +62,7 @@ struct my_error_info { }; -// Mirroring boost::leaf::leaf_detail::optional, to verify correctness of TLS pointers +// Mirroring boost::leaf::detail::optional, to verify correctness of TLS pointers template struct optional {