From e16e0cf417463ec992846078099d317495c2bc5e Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Tue, 28 Jun 2022 19:05:23 -0700 Subject: [PATCH] Explicit tests for the BOOST_LEAF_CFG_CAPTURE=0 configurations --- .github/workflows/ci.yml | 4 ++-- example/capture_in_exception.cpp | 1 + example/capture_in_result.cpp | 1 + include/boost/leaf/handle_errors.hpp | 2 ++ test/Jamfile.v2 | 10 +++++++--- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0d6acd..96b2dd1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -136,7 +136,7 @@ jobs: - name: Run tests run: | cd ../boost-root - ./b2 -j3 libs/leaf/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} link=shared,static variant=debug,release,leaf_debug_leaf_hpp,leaf_release_leaf_hpp,leaf_debug_diag0,leaf_release_diag0,leaf_debug_embedded,leaf_release_embedded + ./b2 -j3 libs/leaf/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} link=shared,static variant=debug,release,leaf_debug_capture0,leaf_release_capture0,leaf_debug_diag0,leaf_release_diag0,leaf_debug_embedded,leaf_release_embedded,leaf_debug_leaf_hpp,leaf_release_leaf_hpp windows: strategy: @@ -185,4 +185,4 @@ jobs: shell: cmd run: | cd ../boost-root - b2 -j3 libs/leaf/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release,leaf_debug_leaf_hpp,leaf_release_leaf_hpp,leaf_debug_diag0,leaf_release_diag0,leaf_debug_embedded,leaf_release_embedded + b2 -j3 libs/leaf/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release,leaf_debug_capture0,leaf_release_capture0,leaf_debug_diag0,leaf_release_diag0,leaf_debug_embedded,leaf_release_embedded,leaf_debug_leaf_hpp,leaf_release_leaf_hpp diff --git a/example/capture_in_exception.cpp b/example/capture_in_exception.cpp index 3652ce7..f9facd3 100644 --- a/example/capture_in_exception.cpp +++ b/example/capture_in_exception.cpp @@ -14,6 +14,7 @@ #include #include #include +#include namespace leaf = boost::leaf; diff --git a/example/capture_in_result.cpp b/example/capture_in_result.cpp index 94ced74..04ed197 100644 --- a/example/capture_in_result.cpp +++ b/example/capture_in_result.cpp @@ -14,6 +14,7 @@ #include #include #include +#include namespace leaf = boost::leaf; diff --git a/include/boost/leaf/handle_errors.hpp b/include/boost/leaf/handle_errors.hpp index c3c4e68..4410fc7 100644 --- a/include/boost/leaf/handle_errors.hpp +++ b/include/boost/leaf/handle_errors.hpp @@ -763,6 +763,7 @@ namespace leaf_detail { return std::forward(try_block)(); } +#if BOOST_LEAF_CFG_CAPTURE catch( capturing_exception const & cap ) { try @@ -792,6 +793,7 @@ namespace leaf_detail } ); } } +#endif catch( std::exception & ex ) { ctx.deactivate(); diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index bc872ad..9896c4e 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -5,6 +5,9 @@ import testing ; +variant leaf_debug_capture0 : debug : BOOST_LEAF_CFG_CAPTURE=0 ; +variant leaf_release_capture0 : release : BOOST_LEAF_CFG_CAPTURE=0 ; + variant leaf_debug_diag0 : debug : BOOST_LEAF_CFG_DIAGNOSTICS=0 ; variant leaf_release_diag0 : release : BOOST_LEAF_CFG_DIAGNOSTICS=0 ; @@ -17,6 +20,7 @@ variant leaf_release_leaf_hpp : release : BOOST_LEAF_TEST_SINGLE_HEADER project : default-build 11 + multi : requirements BOOST_LEAF_BOOST_AVAILABLE single:BOOST_LEAF_NO_THREADS @@ -136,14 +140,14 @@ compile-fail _compile-fail-result_3.cpp ; compile-fail _compile-fail-result_4.cpp ; compile-fail _compile-fail-verbose_diagnostic_info.cpp ; -exe capture_in_exception : ../example/capture_in_exception.cpp : single:no off:no ; -exe capture_in_result : ../example/capture_in_result.cpp : single:no off:no ; +exe capture_in_exception : ../example/capture_in_exception.cpp : single:no off:no leaf_debug_capture0:no leaf_release_capture0:no ; +exe capture_in_result : ../example/capture_in_result.cpp : single:no leaf_debug_capture0:no leaf_release_capture0:no leaf_debug_embedded:no leaf_release_embedded:no ; exe error_log : ../example/error_log.cpp : off:no ; exe error_trace : ../example/error_trace.cpp : off:no ; exe exception_to_result : ../example/exception_to_result.cpp : off:no ; # exe lua_callback_result : ../example/lua_callback_result.cpp : off:no ; # exe lua_callback_eh : ../example/lua_callback_eh.cpp : off:no ; exe print_file_eh : ../example/print_file/print_file_eh.cpp : off:no ; -# exe print_file_outcome_result : ../example/print_file/print_file_outcome_result.cpp : off:no ; +# exe print_file_outcome_result : ../example/print_file/print_file_outcome_result.cpp : off:no 11:no ; exe print_file_result : ../example/print_file/print_file_result.cpp : off:no ; exe print_half : ../example/print_half.cpp : off:no ;