Skip to content

Commit

Permalink
Sync from upstream.
Browse files Browse the repository at this point in the history
  • Loading branch information
grafikrobot committed Sep 14, 2024
2 parents 8fa2dcf + 5991052 commit b591cbd
Show file tree
Hide file tree
Showing 165 changed files with 343 additions and 563 deletions.
2 changes: 1 addition & 1 deletion .drone/drone.bat
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ python gen/generate_single_header.py -i include/boost/leaf/detail/all.hpp -p inc
echo "Testing"
if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
..\..\b2 -j3 test toolset=%TOOLSET% %CXXSTD% %ADDRMD% embed-manifest-via=linker 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
..\..\b2 -j3 test toolset=%TOOLSET% %CXXSTD% %ADDRMD% embed-manifest-via=linker 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_single_header,leaf_release_single_header
2 changes: 1 addition & 1 deletion .drone/drone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ python gen/generate_single_header.py -i include/boost/leaf/detail/all.hpp -p inc

echo "Testing"
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
../../b2 -j3 test $LINKFLAGS toolset=$TOOLSET cxxstd=$CXXSTD ${ADDRMD:+address-model=$ADDRMD} ${UBSAN:+undefined-sanitizer=norecover debug-symbols=on} ${ASAN:+address-sanitizer=norecover debug-symbols=on} ${LINKFLAGS:+linkflags=$LINKFLAGS} 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
../../b2 -j3 test $LINKFLAGS toolset=$TOOLSET cxxstd=$CXXSTD ${ADDRMD:+address-model=$ADDRMD} ${UBSAN:+undefined-sanitizer=norecover debug-symbols=on} ${ASAN:+address-sanitizer=norecover debug-symbols=on} ${LINKFLAGS:+linkflags=$LINKFLAGS} 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_single_header,leaf_release_single_header
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ jobs:
- name: Run tests
run: |
cd ../boost-root
./b2 -j3 libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} ${ADDRMD:+address-model=$ADDRMD} 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
./b2 -j3 libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} ${ADDRMD:+address-model=$ADDRMD} 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_single_header,leaf_release_single_header
windows:
strategy:
Expand Down Expand Up @@ -289,4 +289,4 @@ jobs:
shell: cmd
run: |
cd ../boost-root
b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} ${{matrix.embedmanifest}} 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
b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} ${{matrix.embedmanifest}} variant=debug,release,leaf_debug_capture0,leaf_release_capture0,leaf_debug_diag0,leaf_release_diag0,leaf_debug_embedded,leaf_release_embedded,leaf_debug_single_header,leaf_release_single_header
35 changes: 19 additions & 16 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,39 @@
"version": "2.0.0",
"tasks": [
{
"label": "Configure Meson build directories",
"label": "Setup Meson build directories",
"type": "shell",
"command": "cd ${workspaceRoot} && meson setup -D leaf_boost_examples=true -D leaf_lua_examples=true _bld/debug && meson setup -D leaf_boost_examples=true -D leaf_lua_examples=true -D leaf_hpp=true _bld/debug_leaf_hpp && meson setup -D leaf_boost_examples=true -D leaf_lua_examples=true _bld/release --buildtype release && meson setup -D leaf_boost_examples=true -D leaf_lua_examples=true -D leaf_hpp=true _bld/release_leaf_hpp --buildtype release && meson setup -D leaf_diagnostics=0 -D cpp_eh=none -D b_ndebug=true -D b_lto=true -D leaf_enable_benchmarks=true _bld/benchmark --buildtype release",
"command": "cd ${workspaceRoot} && meson setup -D leaf_boost_examples=true -D leaf_lua_examples=true _bld/debug && meson setup -D leaf_boost_examples=false -D single_header=true _bld/debug_single_header && meson setup -D leaf_boost_examples=true -D leaf_lua_examples=true _bld/release --buildtype release && meson setup -D single_header=true _bld/release_single_header --buildtype release && meson setup -D leaf_diagnostics=0 -D cpp_eh=none -D b_ndebug=true -D b_lto=true -D leaf_enable_benchmarks=true _bld/benchmark --buildtype release",
"problemMatcher": []
},
{
"label": "Configure Meson build directories (no diagnostics)",
"label": "Setup Meson build directories (no diagnostics)",
"type": "shell",
"command": "cd ${workspaceRoot} && meson setup -D leaf_diagnostics=0 -D leaf_boost_examples=true -D leaf_lua_examples=true _bld/debug && meson setup -D leaf_diagnostics=0 -D leaf_boost_examples=true -D leaf_lua_examples=true -D leaf_hpp=true _bld/debug_leaf_hpp && meson setup -D leaf_diagnostics=0 -D leaf_boost_examples=true -D leaf_lua_examples=true _bld/release --buildtype release && meson setup -D leaf_diagnostics=0 -D leaf_boost_examples=true -D leaf_lua_examples=true -D leaf_hpp=true _bld/release_leaf_hpp --buildtype release",
"command": "cd ${workspaceRoot} && meson setup -D leaf_diagnostics=0 -D leaf_boost_examples=true -D leaf_lua_examples=true _bld/debug && meson setup -D leaf_diagnostics=0 -D leaf_boost_examples=true -D single_header=true _bld/debug_single_header && meson setup -D leaf_diagnostics=0 -D leaf_boost_examples=true -D leaf_lua_examples=true _bld/release --buildtype release && meson setup -D leaf_diagnostics=0 -D leaf_boost_examples=true -D single_header=true _bld/release_single_header --buildtype release",
"problemMatcher": []
},
{
"label": "Configure Meson build directories (no capture)",
"label": "Setup Meson build directories (no capture)",
"type": "shell",
"command": "cd ${workspaceRoot} && meson setup -D leaf_capture=0 -D leaf_boost_examples=true -D leaf_lua_examples=true _bld/debug && meson setup -D leaf_capture=0 -D leaf_boost_examples=true -D leaf_lua_examples=true -D leaf_hpp=true _bld/debug_leaf_hpp && meson setup -D leaf_capture=0 -D leaf_boost_examples=true -D leaf_lua_examples=true _bld/release --buildtype release && meson setup -D leaf_capture=0 -D leaf_boost_examples=true -D leaf_lua_examples=true -D leaf_hpp=true _bld/release_leaf_hpp --buildtype release",
"command": "cd ${workspaceRoot} && meson setup -D leaf_capture=0 -D leaf_boost_examples=true -D leaf_lua_examples=true _bld/debug && meson setup -D leaf_capture=0 -D leaf_boost_examples=true -D single_header=true _bld/debug_single_header && meson setup -D leaf_capture=0 -D leaf_boost_examples=true -D leaf_lua_examples=true _bld/release --buildtype release && meson setup -D leaf_capture=0 -D leaf_boost_examples=true -D single_header=true _bld/release_single_header --buildtype release",
"problemMatcher": []
},
{
"label": "Configure Meson build directories (no Boost)",
"label": "Setup Meson build directories (no Boost)",
"type": "shell",
"command": "cd ${workspaceRoot} && meson setup -D leaf_lua_examples=true _bld/debug && meson setup -D leaf_lua_examples=true -D leaf_hpp=true _bld/debug_leaf_hpp && meson setup -D leaf_lua_examples=true _bld/release --buildtype release && meson setup -D leaf_lua_examples=true -D leaf_hpp=true _bld/release_leaf_hpp --buildtype release",
"command": "cd ${workspaceRoot} && meson setup -D leaf_lua_examples=true _bld/debug && meson setup -D single_header=true _bld/debug_single_header && meson setup -D leaf_lua_examples=true _bld/release --buildtype release && meson setup -D single_header=true _bld/release_single_header --buildtype release",
"problemMatcher": []
},
{
"label": "Configure Meson build directories (test embedded)",
"label": "Setup Meson build directories (test embedded)",
"type": "shell",
"command": "cd ${workspaceRoot} && meson setup -D leaf_embedded=true -D leaf_diagnostics=0 _bld/debug && meson setup -D leaf_embedded=true -D leaf_diagnostics=0 -D leaf_hpp=true _bld/debug_leaf_hpp && meson setup -D leaf_embedded=true -D leaf_diagnostics=0 _bld/release --buildtype release && meson setup -D leaf_embedded=true -D leaf_diagnostics=0 -D leaf_hpp=true _bld/release_leaf_hpp --buildtype release",
"command": "cd ${workspaceRoot} && meson setup -D leaf_embedded=true -D leaf_diagnostics=0 _bld/debug && meson setup -D leaf_embedded=true -D leaf_diagnostics=0 -D single_header=true _bld/debug_single_header && meson setup -D leaf_embedded=true -D leaf_diagnostics=0 _bld/release --buildtype release && meson setup -D leaf_embedded=true -D leaf_diagnostics=0 -D single_header=true _bld/release_single_header --buildtype release",
"problemMatcher": []
},
{
"label": "Configure Meson build directories (test embedded, no exceptions)",
"label": "Setup Meson build directories (test embedded, no exceptions)",
"type": "shell",
"command": "cd ${workspaceRoot} && meson setup -D cpp_eh=none -D leaf_embedded=true -D leaf_diagnostics=0 _bld/debug && meson setup -D cpp_eh=none -D leaf_embedded=true -D leaf_diagnostics=0 -D leaf_hpp=true _bld/debug_leaf_hpp && meson setup -D cpp_eh=none -D leaf_embedded=true -D leaf_diagnostics=0 _bld/release --buildtype release && meson setup -D cpp_eh=none -D leaf_embedded=true -D leaf_diagnostics=0 -D leaf_hpp=true _bld/release_leaf_hpp --buildtype release",
"command": "cd ${workspaceRoot} && meson setup -D cpp_eh=none -D leaf_embedded=true -D leaf_diagnostics=0 _bld/debug && meson setup -D cpp_eh=none -D leaf_embedded=true -D leaf_diagnostics=0 -D single_header=true _bld/debug_single_header && meson setup -D cpp_eh=none -D leaf_embedded=true -D leaf_diagnostics=0 _bld/release --buildtype release && meson setup -D cpp_eh=none -D leaf_embedded=true -D leaf_diagnostics=0 -D single_header=true _bld/release_single_header --buildtype release",
"problemMatcher": []
},
{
Expand Down Expand Up @@ -84,7 +84,7 @@
"dependsOn": [
"Generate leaf.hpp"
],
"command": "cd ${workspaceRoot}/_bld/release && ninja && meson test && cd ${workspaceRoot}/_bld/release_leaf_hpp && ninja && meson test",
"command": "cd ${workspaceRoot}/_bld/release && ninja && meson test && cd ${workspaceRoot}/_bld/release_single_header && ninja && meson test",
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
Expand All @@ -97,9 +97,9 @@
"group": "test",
"label": "Run all unit tests (b2, all configurations)",
"type": "shell",
"command": "../../b2 test link=shared,static variant=debug,release,leaf_debug_diag0,leaf_release_diag0,leaf_debug_leaf_hpp,leaf_release_leaf_hpp,leaf_debug_embedded,leaf_release_embedded exception-handling=off rtti=off cxxstd=11,14,1z,17 && ../../b2 test link=shared,static variant=debug,release,leaf_debug_diag0,leaf_release_diag0,leaf_debug_leaf_hpp,leaf_release_leaf_hpp exception-handling=on,off cxxstd=11,14,1z,17",
"command": "../../b2 test link=shared,static variant=debug,release,leaf_debug_diag0,leaf_release_diag0,leaf_debug_single_header,leaf_release_single_header,leaf_debug_embedded,leaf_release_embedded exception-handling=off rtti=off cxxstd=11,14,1z,17 && ../../b2 test link=shared,static variant=debug,release,leaf_debug_diag0,leaf_release_diag0,leaf_debug_single_header,leaf_release_single_header exception-handling=on,off cxxstd=11,14,1z,17",
"windows": {
"command": "..\\..\\b2 test link=shared,static variant=debug,release,leaf_debug_diag0,leaf_release_diag0,leaf_debug_leaf_hpp,leaf_release_leaf_hpp,leaf_debug_embedded,leaf_release_embedded exception-handling=off rtti=off cxxstd=14,17,latest && ..\\..\\b2 test link=shared,static variant=debug,release,leaf_debug_diag0,leaf_release_diag0,leaf_debug_leaf_hpp,leaf_release_leaf_hpp exception-handling=on,off cxxstd=14,17,latest",
"command": "..\\..\\b2 test link=shared,static variant=debug,release,leaf_debug_diag0,leaf_release_diag0,leaf_debug_single_header,leaf_release_single_header,leaf_debug_embedded,leaf_release_embedded exception-handling=off rtti=off cxxstd=14,17,latest && ..\\..\\b2 test link=shared,static variant=debug,release,leaf_debug_diag0,leaf_release_diag0,leaf_debug_single_header,leaf_release_single_header exception-handling=on,off cxxstd=14,17,latest",
},
"problemMatcher": {
"base": "$gcc",
Expand All @@ -116,7 +116,10 @@
},
"label": "Test current editor file",
"type": "shell",
"command": "cd ${workspaceRoot}/_bld/debug && ninja && meson test ${fileBasenameNoExtension} || cat ./meson-logs/testlog.txt",
"command": "cd ${workspaceRoot}/_bld/debug && ninja && {meson test ${fileBasenameNoExtension} || cat ./meson-logs/testlog.txt}",
"windows": {
"command": "cd ${workspaceRoot}/_bld/debug && ninja && (meson test ${fileBasenameNoExtension} || cat ./meson-logs/testlog.txt)",
},
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
Expand Down
19 changes: 9 additions & 10 deletions benchmark/deep_stack_leaf.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Copyright 2018-2024 Emil Dotchevski and Reverge Studios, Inc.

// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Expand Down Expand Up @@ -50,13 +49,13 @@ namespace boost
}
}

//////////////////////////////////////
////////////////////////////////////////

namespace leaf = boost::leaf;

#define USING_RESULT_TYPE "leaf::result<T>"

//////////////////////////////////////
////////////////////////////////////////

enum class e_error_code
{
Expand Down Expand Up @@ -136,7 +135,7 @@ inline int handle_error( e_heavy_payload const & e ) noexcept
return std::accumulate(e.value.begin(), e.value.end(), 0);
}

//////////////////////////////////////
////////////////////////////////////////

// This is used to change the "success" type at each level.
// Generally, functions return values of different types.
Expand All @@ -158,7 +157,7 @@ struct select_result_type<N, E, false>
template <int N, class E>
using select_result_t = typename select_result_type<N, E>::type;

//////////////////////////////////////
////////////////////////////////////////

template <int N, class E>
struct benchmark
Expand Down Expand Up @@ -186,7 +185,7 @@ struct benchmark<1, E>
}
};

//////////////////////////////////////
////////////////////////////////////////

template <class Benchmark>
NOINLINE int runner( int failure_rate ) noexcept
Expand All @@ -206,7 +205,7 @@ NOINLINE int runner( int failure_rate ) noexcept
} );
}

//////////////////////////////////////
////////////////////////////////////////

std::fstream append_csv()
{
Expand All @@ -228,7 +227,7 @@ int print_elapsed_time( int iteration_count, F && f )
{
auto start = std::chrono::steady_clock::now();
int val = 0;
for( int i = 0; i!=iteration_count; ++i )
for( int i=0; i!=iteration_count; ++i )
val += std::forward<F>(f)();
auto stop = std::chrono::steady_clock::now();
int elapsed = std::chrono::duration_cast<std::chrono::microseconds>(stop-start).count();
Expand All @@ -237,7 +236,7 @@ int print_elapsed_time( int iteration_count, F && f )
return val;
}

//////////////////////////////////////
////////////////////////////////////////

template <int Depth, class E>
int benchmark_type( char const * type_name, int iteration_count )
Expand All @@ -254,7 +253,7 @@ int benchmark_type( char const * type_name, int iteration_count )
return x;
}

//////////////////////////////////////
////////////////////////////////////////

int main()
{
Expand Down
19 changes: 9 additions & 10 deletions benchmark/deep_stack_other.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Copyright 2018-2024 Emil Dotchevski and Reverge Studios, Inc.

// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Expand Down Expand Up @@ -70,7 +69,7 @@ namespace boost
}
}

//////////////////////////////////////
////////////////////////////////////////

#if BENCHMARK_WHAT == 0 // tl::expected

Expand All @@ -97,7 +96,7 @@ namespace boost
# error Benchmark what?
#endif

//////////////////////////////////////
////////////////////////////////////////

enum class e_error_code
{
Expand Down Expand Up @@ -177,7 +176,7 @@ inline int handle_error( e_heavy_payload const & e ) noexcept
return std::accumulate(e.value.begin(), e.value.end(), 0);
}

//////////////////////////////////////
////////////////////////////////////////

// This is used to change the "success" type at each level.
// Generally, functions return values of different types.
Expand All @@ -199,7 +198,7 @@ struct select_result_type<N, E, false>
template <int N, class E>
using select_result_t = typename select_result_type<N, E>::type;

//////////////////////////////////////
////////////////////////////////////////

template <int N, class E>
struct benchmark
Expand Down Expand Up @@ -227,7 +226,7 @@ struct benchmark<1, E>
}
};

//////////////////////////////////////
////////////////////////////////////////

template <class Benchmark>
NOINLINE int runner( int failure_rate ) noexcept
Expand All @@ -238,7 +237,7 @@ NOINLINE int runner( int failure_rate ) noexcept
return handle_error(r.error());
}

//////////////////////////////////////
////////////////////////////////////////

std::fstream append_csv()
{
Expand All @@ -260,7 +259,7 @@ int print_elapsed_time( int iteration_count, F && f )
{
auto start = std::chrono::steady_clock::now();
int val = 0;
for( int i = 0; i!=iteration_count; ++i )
for( int i=0; i!=iteration_count; ++i )
val += std::forward<F>(f)();
auto stop = std::chrono::steady_clock::now();
int elapsed = std::chrono::duration_cast<std::chrono::microseconds>(stop-start).count();
Expand All @@ -269,7 +268,7 @@ int print_elapsed_time( int iteration_count, F && f )
return val;
}

//////////////////////////////////////
////////////////////////////////////////

template <int Depth, class E>
int benchmark_type( char const * type_name, int iteration_count )
Expand All @@ -286,7 +285,7 @@ int benchmark_type( char const * type_name, int iteration_count )
return x;
}

//////////////////////////////////////
////////////////////////////////////////

int main()
{
Expand Down
2 changes: 1 addition & 1 deletion doc/leaf.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2294,7 +2294,7 @@ namespace boost { namespace leaf {
error_id current_error() noexcept;
//////////////////////////////////////////
////////////////////////////////////////
template <class Ctx>
class context_activator
Expand Down
1 change: 0 additions & 1 deletion example/error_log.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Copyright 2018-2024 Emil Dotchevski and Reverge Studios, Inc.

// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Expand Down
1 change: 0 additions & 1 deletion example/error_trace.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Copyright 2018-2024 Emil Dotchevski and Reverge Studios, Inc.

// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Expand Down
1 change: 0 additions & 1 deletion example/exception_to_result.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Copyright 2018-2024 Emil Dotchevski and Reverge Studios, Inc.

// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Expand Down
1 change: 0 additions & 1 deletion example/lua_callback_eh.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Copyright 2018-2024 Emil Dotchevski and Reverge Studios, Inc.

// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Expand Down
Loading

0 comments on commit b591cbd

Please sign in to comment.