Skip to content

Commit

Permalink
minor changes in diagnostic_info, plus re-enabled all unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zajo committed Dec 10, 2023
1 parent 31bc165 commit 95fff4a
Show file tree
Hide file tree
Showing 26 changed files with 368 additions and 353 deletions.
10 changes: 5 additions & 5 deletions include/boost/leaf/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@
# error BOOST_LEAF_CFG_CAPTURE must be 0 or 1.
#endif

#if BOOST_LEAF_CFG_DIAGNOSTICS && !BOOST_LEAF_CFG_STD_STRING
# error BOOST_LEAF_CFG_DIAGNOSTICS requires the use of std::string
#endif

#if BOOST_LEAF_CFG_WIN32!=0 && BOOST_LEAF_CFG_WIN32!=1
# error BOOST_LEAF_CFG_WIN32 must be 0 or 1.
#endif
Expand All @@ -114,8 +110,12 @@
# error BOOST_LEAF_CFG_GNUC_STMTEXPR must be 0 or 1.
#endif

#if BOOST_LEAF_CFG_DIAGNOSTICS && !BOOST_LEAF_CFG_STD_STRING
# error BOOST_LEAF_CFG_DIAGNOSTICS requires BOOST_LEAF_CFG_STD_STRING, which has been disabled.
#endif

#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR && !BOOST_LEAF_CFG_STD_STRING
# error BOOST_LEAF_CFG_STD_SYSTEM_ERROR != 0 requires BOOST_LEAF_CFG_STD_STRING != 0
# error BOOST_LEAF_CFG_STD_SYSTEM_ERROR requires BOOST_LEAF_CFG_STD_STRING, which has been disabled.
#endif

////////////////////////////////////////
Expand Down
4 changes: 0 additions & 4 deletions include/boost/leaf/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ namespace boost { namespace leaf {

class error_info;
class diagnostic_info;
#if BOOST_LEAF_CFG_DIAGNOSTICS
class verbose_diagnostic_info;
#endif

template <class>
struct is_predicate: std::false_type
Expand Down Expand Up @@ -60,9 +58,7 @@ namespace leaf_detail
static_assert(!is_predicate<error_type>::value, "Handlers must take predicate arguments by value");
static_assert(!std::is_same<E, error_info>::value, "Handlers must take leaf::error_info arguments by const &");
static_assert(!std::is_same<E, diagnostic_info>::value, "Handlers must take leaf::diagnostic_info arguments by const &");
#if BOOST_LEAF_CFG_DIAGNOSTICS
static_assert(!std::is_same<E, verbose_diagnostic_info>::value, "Handlers must take leaf::verbose_diagnostic_info arguments by const &");
#endif
};

template <class Pred>
Expand Down
17 changes: 11 additions & 6 deletions include/boost/leaf/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ namespace leaf_detail
template <class CharT, class Traits>
void print( std::basic_ostream<CharT, Traits> & os, int err_id_to_print ) const
{
#if BOOST_LEAF_CFG_DIAGNOSTICS
if( !diagnostic<E>::is_invisible )
if( int k = this->key() )
{
Expand All @@ -201,12 +200,7 @@ namespace leaf_detail
else
os << '[' << k << "] ";
diagnostic<E>::print(os, value(k));
(os << '\n').flush();
}
#else
(void) os;
(void) err_id_to_print;
#endif
}

using impl::load;
Expand Down Expand Up @@ -400,6 +394,17 @@ namespace leaf_detail
using capture_list::print;
};

template <>
struct diagnostic<dynamic_allocator, false, false, false>
{
static constexpr bool is_invisible = true;

template <class CharT, class Traits>
BOOST_LEAF_CONSTEXPR static void print( std::basic_ostream<CharT, Traits> &, dynamic_allocator const & )
{
}
};

template <>
inline void slot<dynamic_allocator>::deactivate() const noexcept
{
Expand Down
Loading

0 comments on commit 95fff4a

Please sign in to comment.