2
0
mirror of https://github.com/boostorg/leaf.git synced 2026-01-19 04:22:08 +00:00

Sync from upstream.

This commit is contained in:
Rene Rivera
2024-09-14 08:41:48 -05:00
165 changed files with 358 additions and 578 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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:
@@ -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
.vscode/tasks.json vendored
View File

@@ -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": []
},
{
@@ -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": [
@@ -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",
@@ -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": [

View File

@@ -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)
@@ -50,13 +49,13 @@ namespace boost
}
}
//////////////////////////////////////
////////////////////////////////////////
namespace leaf = boost::leaf;
#define USING_RESULT_TYPE "leaf::result<T>"
//////////////////////////////////////
////////////////////////////////////////
enum class e_error_code
{
@@ -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.
@@ -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
@@ -186,7 +185,7 @@ struct benchmark<1, E>
}
};
//////////////////////////////////////
////////////////////////////////////////
template <class Benchmark>
NOINLINE int runner( int failure_rate ) noexcept
@@ -206,7 +205,7 @@ NOINLINE int runner( int failure_rate ) noexcept
} );
}
//////////////////////////////////////
////////////////////////////////////////
std::fstream append_csv()
{
@@ -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();
@@ -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 )
@@ -254,7 +253,7 @@ int benchmark_type( char const * type_name, int iteration_count )
return x;
}
//////////////////////////////////////
////////////////////////////////////////
int main()
{

View File

@@ -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)
@@ -70,7 +69,7 @@ namespace boost
}
}
//////////////////////////////////////
////////////////////////////////////////
#if BENCHMARK_WHAT == 0 // tl::expected
@@ -97,7 +96,7 @@ namespace boost
# error Benchmark what?
#endif
//////////////////////////////////////
////////////////////////////////////////
enum class e_error_code
{
@@ -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.
@@ -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
@@ -227,7 +226,7 @@ struct benchmark<1, E>
}
};
//////////////////////////////////////
////////////////////////////////////////
template <class Benchmark>
NOINLINE int runner( int failure_rate ) noexcept
@@ -238,7 +237,7 @@ NOINLINE int runner( int failure_rate ) noexcept
return handle_error(r.error());
}
//////////////////////////////////////
////////////////////////////////////////
std::fstream append_csv()
{
@@ -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();
@@ -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 )
@@ -286,7 +285,7 @@ int benchmark_type( char const * type_name, int iteration_count )
return x;
}
//////////////////////////////////////
////////////////////////////////////////
int main()
{

View File

@@ -2294,7 +2294,7 @@ namespace boost { namespace leaf {
error_id current_error() noexcept;
//////////////////////////////////////////
////////////////////////////////////////
template <class Ctx>
class context_activator

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)
@@ -150,7 +149,7 @@ int main( int argc, char const * argv[] )
// Parse the command line, return the file name.
char const * parse_command_line( int argc, char const * argv[] )
{
if( argc==2 )
if( argc == 2 )
return argv[1];
else
leaf::throw_exception(bad_command_line);
@@ -176,7 +175,7 @@ std::size_t file_size( FILE & f )
leaf::throw_exception(size_error);
long s = ftell(&f);
if( s==-1L )
if( s == -1L )
leaf::throw_exception(size_error);
if( fseek(&f,0,SEEK_SET) )
@@ -194,6 +193,6 @@ void file_read( FILE & f, void * buf, std::size_t size )
if( ferror(&f) )
leaf::throw_exception(read_error, leaf::e_errno{errno});
if( n!=size )
if( n != size )
leaf::throw_exception(eof_error);
}

View File

@@ -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)
@@ -162,7 +161,7 @@ int main( int argc, char const * argv[] )
// Parse the command line, return the file name.
result<char const *> parse_command_line( int argc, char const * argv[] )
{
if( argc==2 )
if( argc == 2 )
return argv[1];
else
return leaf::new_error(bad_command_line);
@@ -188,7 +187,7 @@ result<std::size_t> file_size( FILE & f )
return leaf::new_error(size_error);
long s = ftell(&f);
if( s==-1L )
if( s == -1L )
return leaf::new_error(size_error);
if( fseek(&f,0,SEEK_SET) )
@@ -206,7 +205,7 @@ result<void> file_read( FILE & f, void * buf, std::size_t size )
if( ferror(&f) )
return leaf::new_error(read_error, leaf::e_errno{errno});
if( n!=size )
if( n != size )
return leaf::new_error(eof_error);
return outcome::success();

View File

@@ -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)
@@ -154,7 +153,7 @@ int main( int argc, char const * argv[] )
// Parse the command line, return the file name.
result<char const *> parse_command_line( int argc, char const * argv[] )
{
if( argc==2 )
if( argc == 2 )
return argv[1];
else
return leaf::new_error(bad_command_line);
@@ -180,7 +179,7 @@ result<std::size_t> file_size( FILE & f )
return leaf::new_error(size_error);
long s = ftell(&f);
if( s==-1L )
if( s == -1L )
return leaf::new_error(size_error);
if( fseek(&f,0,SEEK_SET) )
@@ -198,7 +197,7 @@ result<void> file_read( FILE & f, void * buf, std::size_t size )
if( ferror(&f) )
return leaf::new_error(read_error, leaf::e_errno{errno});
if( n!=size )
if( n != size )
return leaf::new_error(eof_error);
return { };

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -23,28 +23,38 @@ from datetime import date
import subprocess
included = {}
total_line_count = 11
def append(input_file_name, input_file, output_file, regex_includes, include_folder):
total_line_count = 14
def append(input_file_name, input_file, output_file, regex_includes, include_folder, line_directive_prefix, depth):
global total_line_count
inside_copyright = False
line_count = 1
for line in input_file:
line_count += 1
if 'Emil Dotchevski' in line:
inside_copyright = True
if inside_copyright:
if line.startswith('//') :
continue
if not line.strip():
inside_copyright = False
if depth > 0:
output_file.write('%s#line %d "%s"\n' % (line_directive_prefix, line_count, input_file_name))
continue
result = regex_includes.search(line)
if result:
next_input_file_name = result.group("include")
next_input_file_name = result.group('include')
if next_input_file_name in included:
output_file.write("// Expanded at line %d: %s" % (included[next_input_file_name], line))
output_file.write('// %s // Expanded at line %d\n' % (line.strip(), included[next_input_file_name]))
total_line_count += 1
else:
included[next_input_file_name] = total_line_count
print("%s (%d)" % (next_input_file_name, total_line_count))
with open(os.path.join(include_folder, next_input_file_name), "r") as next_input_file:
output_file.write('// >>> %s#line 1 "%s"\n' % (line, next_input_file_name))
print('%s (%d)' % (next_input_file_name, total_line_count))
with open(os.path.join(include_folder, next_input_file_name), 'r') as next_input_file:
output_file.write('// >>> %s' % (line))
total_line_count += 2
append(next_input_file_name, next_input_file, output_file, regex_includes, include_folder)
if not ('include/boost/leaf/detail/all.hpp' in input_file_name):
output_file.write('// <<< %s#line %d "%s"\n' % (line, line_count, input_file_name))
append(next_input_file_name, next_input_file, output_file, regex_includes, include_folder, line_directive_prefix, depth + 1)
if depth > 0:
output_file.write('// <<< %s%s#line %d "%s"\n' % (line, line_directive_prefix, line_count, input_file_name))
total_line_count += 2
else:
output_file.write(line)
@@ -52,41 +62,47 @@ def append(input_file_name, input_file, output_file, regex_includes, include_fol
def _main():
parser = argparse.ArgumentParser(
description="Generates a single include file from a file including multiple C/C++ headers")
parser.add_argument("-i", "--input", action="store", type=str, default="in.cpp",
help="Input file including the headers to be merged")
parser.add_argument("-o", "--output", action="store", type=str, default="out.cpp",
help="Output file. NOTE: It will be overwritten!")
parser.add_argument("-p", "--path", action="store", type=str, default=".",
help="Include path")
parser.add_argument("--hash", action="store", type=str,
help="The git hash to print in the output file, e.g. the output of \"git rev-parse HEAD\"")
parser.add_argument("prefix", action="store", type=str,
help="Non-empty include file prefix (e.g. a/b)")
description='Generates a single include file from a file including multiple C/C++ headers')
parser.add_argument('-i', '--input', action='store', type=str, default='in.cpp',
help='Input file including the headers to be merged')
parser.add_argument('-o', '--output', action='store', type=str, default='out.cpp',
help='Output file. NOTE: It will be overwritten!')
parser.add_argument('-p', '--path', action='store', type=str, default='.',
help='Include path')
parser.add_argument('--hash', action='store', type=str,
help='The git hash to print in the output file, e.g. the output of "git rev-parse HEAD"')
parser.add_argument('prefix', action='store', type=str,
help='Non-empty include file prefix (e.g. a/b)')
parser.add_argument('--linerefs', action='store_true',
help='Output #line references to the original files. By default the line references are written commented out')
args = parser.parse_args()
regex_includes = re.compile(r"""^\s*#[\t\s]*include[\t\s]*("|\<)(?P<include>%s.*)("|\>)""" % args.prefix)
print("Rebuilding %s:" % args.input)
print('Rebuilding %s:' % args.input)
with open(args.output, 'w') as output_file, open(args.input, 'r') as input_file:
output_file.write(
'#ifndef BOOST_LEAF_HPP_INCLUDED\n'
'#define BOOST_LEAF_HPP_INCLUDED\n'
'\n'
'// LEAF single header distribution. Do not edit.\n'
'\n'
'// Generated on ' + date.today().strftime("%m/%d/%Y"))
'// Boost LEAF single header distribution. Do not edit.\n'
'// Generated on ' + date.today().strftime('%b %d, %Y'))
if args.hash:
output_file.write(
' from https://github.com/boostorg/leaf/tree/' + args.hash[0:7])
output_file.write(
'.\n'
'// Latest version of this file: https://raw.githubusercontent.com/boostorg/leaf/gh-pages/leaf.hpp.\n'
'\n'
'// Latest published version of this file: https://raw.githubusercontent.com/boostorg/leaf/gh-pages/leaf.hpp.\n'
'\n'
'// Copyright 2018-2024 Emil Dotchevski and Reverge Studios, Inc.\n'
'// Distributed under the Boost Software License, Version 1.0. (See accompanying\n'
'// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n'
'\n')
append(args.input, input_file, output_file, regex_includes, args.path)
append(args.input, input_file, output_file, regex_includes, args.path, '' if args.linerefs else '// ', 0)
output_file.write(
'\n'
'#endif\n' )
# print("%d" % total_line_count)
'#endif // BOOST_LEAF_HPP_INCLUDED\n' )
# print('%d' % total_line_count)
if __name__ == "__main__":
_main()

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_HPP_INCLUDED
// 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)

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_COMMON_HPP_INCLUDED
// 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)
@@ -112,4 +111,4 @@ namespace windows
} }
#endif
#endif // BOOST_LEAF_COMMON_HPP_INCLUDED

View File

@@ -2,15 +2,31 @@
#define BOOST_LEAF_CONFIG_HPP_INCLUDED
// 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)
// The following is based in part on Boost Config.
#ifdef BOOST_LEAF_TLS_FREERTOS
# ifndef BOOST_LEAF_EMBEDDED
# define BOOST_LEAF_EMBEDDED
# endif
#endif
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Martin Wille 2003.
// (C) Copyright Guillaume Melquiond 2003.
#ifdef BOOST_LEAF_EMBEDDED
# ifndef BOOST_LEAF_CFG_DIAGNOSTICS
# define BOOST_LEAF_CFG_DIAGNOSTICS 0
# endif
# ifndef BOOST_LEAF_CFG_STD_SYSTEM_ERROR
# define BOOST_LEAF_CFG_STD_SYSTEM_ERROR 0
# endif
# ifndef BOOST_LEAF_CFG_STD_STRING
# define BOOST_LEAF_CFG_STD_STRING 0
# endif
# ifndef BOOST_LEAF_CFG_CAPTURE
# define BOOST_LEAF_CFG_CAPTURE 0
# endif
#endif
////////////////////////////////////////
#ifndef BOOST_LEAF_ASSERT
# include <cassert>
@@ -19,38 +35,6 @@
////////////////////////////////////////
#ifdef BOOST_LEAF_TLS_FREERTOS
# ifndef BOOST_LEAF_EMBEDDED
# define BOOST_LEAF_EMBEDDED
# endif
#endif
////////////////////////////////////////
#ifdef BOOST_LEAF_EMBEDDED
# ifndef BOOST_LEAF_CFG_DIAGNOSTICS
# define BOOST_LEAF_CFG_DIAGNOSTICS 0
# endif
# ifndef BOOST_LEAF_CFG_STD_SYSTEM_ERROR
# define BOOST_LEAF_CFG_STD_SYSTEM_ERROR 0
# endif
# ifndef BOOST_LEAF_CFG_STD_STRING
# define BOOST_LEAF_CFG_STD_STRING 0
# endif
# ifndef BOOST_LEAF_CFG_CAPTURE
# define BOOST_LEAF_CFG_CAPTURE 0
# endif
#endif
////////////////////////////////////////
#ifndef BOOST_LEAF_CFG_DIAGNOSTICS
# define BOOST_LEAF_CFG_DIAGNOSTICS 1
#endif
@@ -87,27 +71,27 @@
# define BOOST_LEAF_CFG_DIAGNOSTICS_DELIMITER "\n "
#endif
#if BOOST_LEAF_CFG_DIAGNOSTICS!=0 && BOOST_LEAF_CFG_DIAGNOSTICS!=1
#if BOOST_LEAF_CFG_DIAGNOSTICS != 0 && BOOST_LEAF_CFG_DIAGNOSTICS != 1
# error BOOST_LEAF_CFG_DIAGNOSTICS must be 0 or 1.
#endif
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR!=0 && BOOST_LEAF_CFG_STD_SYSTEM_ERROR!=1
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR != 0 && BOOST_LEAF_CFG_STD_SYSTEM_ERROR != 1
# error BOOST_LEAF_CFG_STD_SYSTEM_ERROR must be 0 or 1.
#endif
#if BOOST_LEAF_CFG_STD_STRING!=0 && BOOST_LEAF_CFG_STD_STRING!=1
#if BOOST_LEAF_CFG_STD_STRING != 0 && BOOST_LEAF_CFG_STD_STRING != 1
# error BOOST_LEAF_CFG_STD_STRING must be 0 or 1.
#endif
#if BOOST_LEAF_CFG_CAPTURE!=0 && BOOST_LEAF_CFG_CAPTURE!=1
#if BOOST_LEAF_CFG_CAPTURE != 0 && BOOST_LEAF_CFG_CAPTURE != 1
# error BOOST_LEAF_CFG_CAPTURE must be 0 or 1.
#endif
#if BOOST_LEAF_CFG_WIN32!=0 && BOOST_LEAF_CFG_WIN32!=1
#if BOOST_LEAF_CFG_WIN32 != 0 && BOOST_LEAF_CFG_WIN32 != 1
# error BOOST_LEAF_CFG_WIN32 must be 0 or 1.
#endif
#if BOOST_LEAF_CFG_GNUC_STMTEXPR!=0 && BOOST_LEAF_CFG_GNUC_STMTEXPR!=1
#if BOOST_LEAF_CFG_GNUC_STMTEXPR != 0 && BOOST_LEAF_CFG_GNUC_STMTEXPR != 1
# error BOOST_LEAF_CFG_GNUC_STMTEXPR must be 0 or 1.
#endif
@@ -131,78 +115,40 @@
////////////////////////////////////////
// Configure BOOST_LEAF_NO_EXCEPTIONS, unless already #defined
#ifndef BOOST_LEAF_NO_EXCEPTIONS
// The following is based in part on Boost Config.
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Martin Wille 2003.
// (C) Copyright Guillaume Melquiond 2003.
# if defined(__clang__) && !defined(__ibmxl__)
// Clang C++ emulates GCC, so it has to appear early.
# if !__has_feature(cxx_exceptions)
# define BOOST_LEAF_NO_EXCEPTIONS
# endif
# elif defined(__DMC__)
// Digital Mars C++
# if !defined(_CPPUNWIND)
# define BOOST_LEAF_NO_EXCEPTIONS
# endif
# elif defined(__GNUC__) && !defined(__ibmxl__)
// GNU C++:
# if !defined(__EXCEPTIONS)
# define BOOST_LEAF_NO_EXCEPTIONS
# endif
# elif defined(__KCC)
// Kai C++
# if !defined(_EXCEPTIONS)
# define BOOST_LEAF_NO_EXCEPTIONS
# endif
# elif defined(__CODEGEARC__)
// CodeGear - must be checked for before Borland
# if !defined(_CPPUNWIND) && !defined(__EXCEPTIONS)
# define BOOST_LEAF_NO_EXCEPTIONS
# endif
# elif defined(__BORLANDC__)
// Borland
# if !defined(_CPPUNWIND) && !defined(__EXCEPTIONS)
# define BOOST_LEAF_NO_EXCEPTIONS
# endif
# elif defined(__MWERKS__)
// Metrowerks CodeWarrior
# if !__option(exceptions)
# define BOOST_LEAF_NO_EXCEPTIONS
# endif
# elif defined(__IBMCPP__) && defined(__COMPILER_VER__) && defined(__MVS__)
// IBM z/OS XL C/C++
# if !defined(_CPPUNWIND) && !defined(__EXCEPTIONS)
# define BOOST_LEAF_NO_EXCEPTIONS
# endif
# elif defined(__ibmxl__)
// IBM XL C/C++ for Linux (Little Endian)
# if !__has_feature(cxx_exceptions)
# define BOOST_LEAF_NO_EXCEPTIONS
# endif
# elif defined(_MSC_VER)
// Microsoft Visual C++
//
// Must remain the last #elif since some other vendors (Metrowerks, for
// example) also #define _MSC_VER
# if !_CPPUNWIND
# define BOOST_LEAF_NO_EXCEPTIONS
# endif
@@ -286,6 +232,4 @@
// Configure TLS access
#include <boost/leaf/config/tls.hpp>
////////////////////////////////////////
#endif
#endif // BOOST_LEAF_CONFIG_HPP_INCLUDED

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_CONFIG_TLS_HPP_INCLUDED
// 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)
@@ -30,4 +29,4 @@
# include <boost/leaf/config/tls_cpp11.hpp>
#endif
#endif
#endif // BOOST_LEAF_CONFIG_TLS_HPP_INCLUDED

View File

@@ -2,11 +2,11 @@
#define BOOST_LEAF_CONFIG_TLS_ARRAY_HPP_INCLUDED
// Copyright 2018-2024 Emil Dotchevski and Reverge Studios, Inc.
// Copyright (c) 2022 Khalil Estell
// 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)
// Copyright (c) 2022 Khalil Estell
// LEAF requires thread local storage support for pointers and for uin32_t values.
// This header implements thread local storage for pointers and for unsigned int
@@ -139,20 +139,8 @@ namespace tls
static_assert(sizeof(std::intptr_t) >= sizeof(unsigned), "Incompatible tls_array implementation");
write_ptr<Tag>((Tag *) (void *) (std::intptr_t) x);
}
template <class Tag>
void uint_increment() noexcept
{
write_uint<Tag>(read_uint<Tag>() + 1);
}
template <class Tag>
void uint_decrement() noexcept
{
write_uint<Tag>(read_uint<Tag>() - 1);
}
}
} }
#endif
#endif // BOOST_LEAF_CONFIG_TLS_ARRAY_HPP_INCLUDED

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_CONFIG_TLS_CPP11_HPP_INCLUDED
// 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)
@@ -66,20 +65,8 @@ namespace tls
{
tagged_uint<Tag>::x = x;
}
template <class Tag>
void uint_increment() noexcept
{
++tagged_uint<Tag>::x;
}
template <class Tag>
void uint_decrement() noexcept
{
--tagged_uint<Tag>::x;
}
}
} }
#endif
#endif // BOOST_LEAF_CONFIG_TLS_CPP11_HPP_INCLUDED

View File

@@ -2,11 +2,11 @@
#define BOOST_LEAF_CONFIG_TLS_FREERTOS_HPP_INCLUDED
// Copyright 2018-2024 Emil Dotchevski and Reverge Studios, Inc.
// Copyright (c) 2022 Khalil Estell
// 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)
// Copyright (c) 2022 Khalil Estell
// LEAF requires thread local storage support for pointers and for uin32_t values.
// This header implements "thread local" storage via FreeTOS functions
@@ -44,4 +44,4 @@ namespace tls
} }
#endif
#endif // BOOST_LEAF_CONFIG_TLS_FREERTOS_HPP_INCLUDED

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_CONFIG_TLS_GLOBALS_HPP_INCLUDED
// 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)
@@ -65,20 +64,8 @@ namespace tls
{
tagged_uint<Tag>::x = x;
}
template <class Tag>
void uint_increment() noexcept
{
++tagged_uint<Tag>::x;
}
template <class Tag>
void uint_decrement() noexcept
{
--tagged_uint<Tag>::x;
}
}
} }
#endif
#endif // BOOST_LEAF_CONFIG_TLS_GLOBALS_HPP_INCLUDED

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_CONTEXT_HPP_INCLUDED
// 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)
@@ -230,7 +229,7 @@ namespace detail
}
}
////////////////////////////////////////////
////////////////////////////////////////
namespace detail
{
@@ -265,7 +264,7 @@ namespace detail
using deduce_e_tuple = typename deduce_e_tuple_impl<typename deduce_e_type_list<leaf_detail_mp11::mp_list<E...>>::type>::type;
}
////////////////////////////////////////////
////////////////////////////////////////
template <class... E>
class context
@@ -445,7 +444,7 @@ namespace detail
template <class... H>
using context_type_from_handlers = typename detail::context_type_from_handlers_impl<H...>::type;
////////////////////////////////////////////
////////////////////////////////////////
template <class... H>
BOOST_LEAF_CONSTEXPR inline context_type_from_handlers<H...> make_context() noexcept
@@ -461,4 +460,4 @@ BOOST_LEAF_CONSTEXPR inline context_type_from_handlers<H...> make_context( H &&
} }
#endif
#endif // BOOST_LEAF_CONTEXT_HPP_INCLUDED

View File

@@ -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)

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_DETAIL_CAPTURE_LIST_HPP_INCLUDED
// 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)
@@ -122,4 +121,4 @@ namespace detail
#endif
#endif
#endif // BOOST_LEAF_DETAIL_CAPTURE_LIST_HPP_INCLUDED

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_DETAIL_DEMANGLE_HPP_INCLUDED
// 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)
@@ -242,4 +241,4 @@ namespace detail
} }
#endif
#endif // BOOST_LEAF_DETAIL_DEMANGLE_HPP_INCLUDED

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_DETAIL_FUNCTION_TRAITS_HPP_INCLUDED
// 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)
@@ -97,4 +96,4 @@ namespace detail
} }
#endif
#endif // BOOST_LEAF_DETAIL_FUNCTION_TRAITS_HPP_INCLUDED

View File

@@ -300,4 +300,4 @@ template<template<class...> class F, class... T> using mp_valid = typename detai
} } }
#endif
#endif // BOOST_LEAF_DETAIL_MP11_HPP_INCLUDED

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_DETAIL_OPTIONAL_HPP_INCLUDED
// 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)
@@ -90,7 +89,7 @@ namespace detail
BOOST_LEAF_CONSTEXPR bool empty() const noexcept
{
return key_==0;
return key_ == 0;
}
BOOST_LEAF_CONSTEXPR int key() const noexcept
@@ -147,13 +146,13 @@ namespace detail
BOOST_LEAF_CONSTEXPR T const * has_value(int key) const noexcept
{
BOOST_LEAF_ASSERT(key);
return key_==key ? &value_ : nullptr;
return key_ == key ? &value_ : nullptr;
}
BOOST_LEAF_CONSTEXPR T * has_value(int key) noexcept
{
BOOST_LEAF_ASSERT(key);
return key_==key ? &value_ : nullptr;
return key_ == key ? &value_ : nullptr;
}
BOOST_LEAF_CONSTEXPR T const & value(int key) const & noexcept
@@ -199,4 +198,4 @@ namespace detail
} }
#endif
#endif // BOOST_LEAF_DETAIL_OPTIONAL_HPP_INCLUDED

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_DETAIL_PRINT_HPP_INCLUDED
// 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)
@@ -160,4 +159,4 @@ namespace detail
} }
#endif
#endif // BOOST_LEAF_DETAIL_PRINT_HPP_INCLUDED

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_DIAGNOSTICS_HPP_INCLUDED
// 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)
@@ -291,4 +290,4 @@ using verbose_diagnostic_info = diagnostic_details;
} }
#endif
#endif // BOOST_LEAF_DIAGNOSTICS_HPP_INCLUDED

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_ERROR_HPP_INCLUDED
// 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)
@@ -125,7 +124,7 @@ namespace detail
optional<E>(std::move(x)),
prev_(nullptr)
{
BOOST_LEAF_ASSERT(x.prev_==nullptr);
BOOST_LEAF_ASSERT(x.prev_ == nullptr);
}
~slot() noexcept
@@ -413,7 +412,7 @@ namespace detail
inline void slot<E>::unload( int err_id ) noexcept(!BOOST_LEAF_CFG_CAPTURE)
{
BOOST_LEAF_ASSERT(err_id);
if( this->key()!=err_id )
if( this->key() != err_id )
return;
if( impl * p = tls::read_ptr<slot<E>>() )
{
@@ -432,7 +431,7 @@ namespace detail
using T = typename std::decay<E>::type;
static_assert(!std::is_pointer<E>::value, "Error objects of pointer types are not allowed");
static_assert(!std::is_same<T, error_id>::value, "Error objects of type error_id are not allowed");
BOOST_LEAF_ASSERT((err_id&3)==1);
BOOST_LEAF_ASSERT((err_id&3) == 1);
if( slot<T> * p = tls::read_ptr<slot<T>>() )
{
if( !OnError || !p->has_value(err_id) )
@@ -452,7 +451,7 @@ namespace detail
using T = typename std::decay<E>::type;
static_assert(!std::is_pointer<E>::value, "Error objects of pointer types are not allowed");
static_assert(!std::is_same<T, error_id>::value, "Error objects of type error_id are not allowed");
BOOST_LEAF_ASSERT((err_id&3)==1);
BOOST_LEAF_ASSERT((err_id&3) == 1);
if( slot<T> * p = tls::read_ptr<slot<T>>() )
{
if( !OnError || !p->has_value(err_id) )
@@ -468,10 +467,10 @@ namespace detail
template <bool OnError, class F>
BOOST_LEAF_CONSTEXPR inline int load_slot_accumulate( int err_id, F && f ) noexcept(OnError)
{
static_assert(function_traits<F>::arity==1, "Lambdas passed to accumulate must take a single e-type argument by reference");
static_assert(function_traits<F>::arity == 1, "Lambdas passed to accumulate must take a single e-type argument by reference");
using E = typename std::decay<fn_arg_type<F,0>>::type;
static_assert(!std::is_pointer<E>::value, "Error objects of pointer types are not allowed");
BOOST_LEAF_ASSERT((err_id&3)==1);
BOOST_LEAF_ASSERT((err_id&3) == 1);
if( auto sl = tls::read_ptr<slot<E>>() )
{
if( auto v = sl->has_value(err_id) )
@@ -494,7 +493,7 @@ namespace detail
template <class T, int Arity = function_traits<T>::arity>
struct load_item
{
static_assert(Arity==0 || Arity==1, "If a functions is passed to new_error or load, it must take zero or one argument");
static_assert(Arity == 0 || Arity == 1, "If a functions is passed to new_error or load, it must take zero or one argument");
};
template <class E>
@@ -539,7 +538,7 @@ namespace detail
BOOST_LEAF_CONSTEXPR static unsigned generate_next_id() noexcept
{
auto id = (counter+=4);
BOOST_LEAF_ASSERT((id&3)==1);
BOOST_LEAF_ASSERT((id&3) == 1);
return id;
}
};
@@ -550,7 +549,7 @@ namespace detail
inline int current_id() noexcept
{
unsigned id = tls::read_uint<tls_tag_id_factory_current_id>();
BOOST_LEAF_ASSERT(id==0 || (id&3)==1);
BOOST_LEAF_ASSERT(id == 0 || (id&3) == 1);
return int(id);
}
@@ -606,7 +605,7 @@ namespace detail
std::error_category const & cat = get_error_category<>::cat;
if( &ec.category() == &cat )
{
BOOST_LEAF_ASSERT((err_id&3)==1);
BOOST_LEAF_ASSERT((err_id&3) == 1);
return (err_id&~3)|1;
}
else
@@ -624,7 +623,7 @@ namespace detail
inline bool is_error_id( std::error_code const & ec ) noexcept
{
bool res = (&ec.category() == &detail::get_error_category<>::cat);
BOOST_LEAF_ASSERT(!res || !ec.value() || ((ec.value()&3)==1));
BOOST_LEAF_ASSERT(!res || !ec.value() || ((ec.value()&3) == 1));
return res;
}
@@ -646,7 +645,7 @@ class BOOST_LEAF_SYMBOL_VISIBLE error_id
BOOST_LEAF_CONSTEXPR explicit error_id( int value ) noexcept:
value_(value)
{
BOOST_LEAF_ASSERT(value_==0 || ((value_&3)==1));
BOOST_LEAF_ASSERT(value_ == 0 || ((value_&3) == 1));
}
public:
@@ -660,7 +659,7 @@ public:
error_id( std::error_code const & ec ) noexcept:
value_(detail::import_error_code(ec))
{
BOOST_LEAF_ASSERT(!value_ || ((value_&3)==1));
BOOST_LEAF_ASSERT(!value_ || ((value_&3) == 1));
}
template <class Enum>
@@ -704,7 +703,7 @@ public:
BOOST_LEAF_CONSTEXPR int value() const noexcept
{
BOOST_LEAF_ASSERT(value_==0 || ((value_&3)==1));
BOOST_LEAF_ASSERT(value_ == 0 || ((value_&3) == 1));
return value_;
}
@@ -748,7 +747,7 @@ namespace detail
{
BOOST_LEAF_CONSTEXPR inline error_id make_error_id( int err_id ) noexcept
{
BOOST_LEAF_ASSERT(err_id==0 || (err_id&3)==1);
BOOST_LEAF_ASSERT(err_id == 0 || (err_id&3) == 1);
return error_id((err_id&~3)|1);
}
}
@@ -769,7 +768,7 @@ inline error_id current_error() noexcept
return detail::make_error_id(detail::current_id());
}
////////////////////////////////////////////
////////////////////////////////////////
template <class R>
struct is_result_type: std::false_type
@@ -783,4 +782,4 @@ struct is_result_type<R const>: is_result_type<R>
} }
#endif
#endif // BOOST_LEAF_ERROR_HPP_INCLUDED

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_EXCEPTION_HPP_INCLUDED
// 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)
@@ -284,4 +283,4 @@ exception_to_result( F && f ) noexcept
} }
#endif
#endif // BOOST_LEAF_EXCEPTION_HPP_INCLUDED

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_HANDLE_ERRORS_HPP_INCLUDED
// 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)
@@ -880,4 +879,4 @@ namespace detail
} }
#endif
#endif // BOOST_LEAF_HANDLE_ERRORS_HPP_INCLUDED

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_ON_ERROR_HPP_INCLUDED
// 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)
@@ -67,7 +66,7 @@ public:
}
};
////////////////////////////////////////////
////////////////////////////////////////
namespace detail
{
@@ -76,7 +75,7 @@ namespace detail
{
BOOST_LEAF_CONSTEXPR static void trigger( Tup & tup, int err_id ) noexcept
{
BOOST_LEAF_ASSERT((err_id&3)==1);
BOOST_LEAF_ASSERT((err_id&3) == 1);
tuple_for_each_preload<I-1,Tup>::trigger(tup,err_id);
std::get<I-1>(tup).trigger(err_id);
}
@@ -230,4 +229,4 @@ on_error( Item && ... i )
} }
#endif
#endif // BOOST_LEAF_ON_ERROR_HPP_INCLUDED

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_PRED_HPP_INCLUDED
// 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)
@@ -151,7 +150,7 @@ namespace detail
template <class Enum>
struct match_value_enum_type<condition<Enum, Enum>>
{
static_assert(sizeof(Enum)==0, "leaf::condition<Enum> should be used with leaf::match<>, not with leaf::match_value<>");
static_assert(sizeof(Enum) == 0, "leaf::condition<Enum> should be used with leaf::match<>, not with leaf::match_value<>");
};
#endif
}
@@ -241,13 +240,13 @@ namespace detail
template <class Ex>
BOOST_LEAF_CONSTEXPR inline bool check_exception_pack( std::exception const & ex, Ex const * ) noexcept
{
return dynamic_cast<Ex const *>(&ex)!=nullptr;
return dynamic_cast<Ex const *>(&ex) != nullptr;
}
template <class Ex, class... ExRest>
BOOST_LEAF_CONSTEXPR inline bool check_exception_pack( std::exception const & ex, Ex const *, ExRest const * ... ex_rest ) noexcept
{
return dynamic_cast<Ex const *>(&ex)!=nullptr || check_exception_pack(ex, ex_rest...);
return dynamic_cast<Ex const *>(&ex) != nullptr || check_exception_pack(ex, ex_rest...);
}
BOOST_LEAF_CONSTEXPR inline bool check_exception_pack( std::exception const & ) noexcept
@@ -294,4 +293,4 @@ struct is_predicate<catch_<Ex...>>: std::true_type
} }
#endif
#endif // BOOST_LEAF_PRED_HPP_INCLUDED

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_RESULT_HPP_INCLUDED
// 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)
@@ -129,7 +128,7 @@ namespace detail
state_(id.value())
{
BOOST_LEAF_ASSERT(state_ == 0 || (state_&3) == 1);
BOOST_LEAF_ASSERT(kind()==err_id_zero || kind()==err_id);
BOOST_LEAF_ASSERT(kind() == err_id_zero || kind() == err_id);
}
#if BOOST_LEAF_CFG_CAPTURE
@@ -146,7 +145,7 @@ namespace detail
state_(val)
{
BOOST_LEAF_ASSERT((state_&3) == 3);
BOOST_LEAF_ASSERT(kind()==val);
BOOST_LEAF_ASSERT(kind() == val);
}
kind_t kind() const noexcept
@@ -156,7 +155,7 @@ namespace detail
error_id get_error_id() const noexcept
{
BOOST_LEAF_ASSERT(kind()==err_id_zero || kind()==err_id || kind()==err_id_capture_list);
BOOST_LEAF_ASSERT(kind() == err_id_zero || kind() == err_id || kind() == err_id_capture_list);
return make_error_id(int((state_&~3)|1));
}
};
@@ -725,4 +724,4 @@ struct is_result_type<result<T>>: std::true_type
} }
#endif
#endif // BOOST_LEAF_RESULT_HPP_INCLUDED

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_TO_VARIANT_HPP_INCLUDED
// 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)
@@ -47,4 +46,4 @@ to_variant( TryBlock && try_block )
#endif
#endif
#endif // BOOST_LEAF_TO_VARIANT_HPP_INCLUDED

View File

@@ -5,7 +5,7 @@
project('leaf', 'cpp', default_options : ['cpp_std=c++17', 'b_pch=false'], license : 'boost')
option_leaf_hpp = get_option('leaf_hpp')
option_single_header = get_option('single_header')
option_boost = get_option('leaf_boost_examples')
option_lua = get_option('leaf_lua_examples')
option_diagnostics = get_option('leaf_diagnostics')
@@ -202,7 +202,7 @@ if option_enable_unit_tests
endif
dep_test_single_header = []
if option_leaf_hpp
if option_single_header
dep_test_single_header = declare_dependency(compile_args: ['-DBOOST_LEAF_TEST_SINGLE_HEADER'])
endif

View File

@@ -1,4 +1,4 @@
option('leaf_hpp',type:'boolean',value:false,description:'Unit tests #include <boost/leaf.hpp> instead of individual headers')
option('single_header',type:'boolean',value:false,description:'Unit tests #include "leaf.hpp" instead of individual headers')
option('leaf_boost_examples',type:'boolean',value:false,description:'Builds the Boost examples and Boost Outcome benchmark')
option('leaf_lua_examples',type:'boolean',value:false,description:'Enable or disable downloading of Lua and building the Lua examples')
option('leaf_diagnostics',type:'integer',value:1,description:'BOOST_LEAF_CFG_DIAGNOSTICS value')

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -14,8 +14,8 @@ variant leaf_release_diag0 : release : <define>BOOST_LEAF_CFG_DIAGNOSTICS=0 ;
variant leaf_debug_embedded : debug : <define>BOOST_LEAF_EMBEDDED <rtti>off <exception-handling>off ;
variant leaf_release_embedded : release : <define>BOOST_LEAF_EMBEDDED <rtti>off <exception-handling>off ;
variant leaf_debug_leaf_hpp : debug : <define>BOOST_LEAF_TEST_SINGLE_HEADER ;
variant leaf_release_leaf_hpp : release : <define>BOOST_LEAF_TEST_SINGLE_HEADER ;
variant leaf_debug_single_header : debug : <define>BOOST_LEAF_TEST_SINGLE_HEADER ;
variant leaf_release_single_header : release : <define>BOOST_LEAF_TEST_SINGLE_HEADER ;
project
: default-build

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_TEST_EC_HPP_INCLUDED
// 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)
@@ -43,7 +42,7 @@ inline std::error_code make_error_code( errc_a code )
template <int> struct e_errc_a { std::error_code value; };
///////////////////////////////////
////////////////////////////////////////
enum class errc_b { b0 = 20, b1, b2, b3 };
@@ -80,7 +79,7 @@ inline std::error_code make_error_code( errc_b code )
template <int> struct e_errc_b { std::error_code value; };
///////////////////////////////////
////////////////////////////////////////
enum class cond_x { x00 = 30, x11, x22, x33 };
@@ -115,13 +114,13 @@ inline std::error_category const & cat_cond_x()
switch( cond_x(cond) )
{
case cond_x::x00:
return code==make_error_code(errc_a::a0) || code==make_error_code(errc_b::b0);
return code == make_error_code(errc_a::a0) || code == make_error_code(errc_b::b0);
case cond_x::x11:
return code==make_error_code(errc_a::a1) || code==make_error_code(errc_b::b1);
return code == make_error_code(errc_a::a1) || code == make_error_code(errc_b::b1);
case cond_x::x22:
return code==make_error_code(errc_a::a2) || code==make_error_code(errc_b::b2);
return code == make_error_code(errc_a::a2) || code == make_error_code(errc_b::b2);
case cond_x::x33:
return code==make_error_code(errc_a::a3) || code==make_error_code(errc_b::b3);
return code == make_error_code(errc_a::a3) || code == make_error_code(errc_b::b3);
default:
return false;
}
@@ -138,7 +137,7 @@ inline std::error_condition make_error_condition( cond_x cond )
template <int> struct e_cond_x { cond_x value; };
///////////////////////////////////
////////////////////////////////////////
enum class cond_y { y03 = 40, y12, y21, y30 };
@@ -173,13 +172,13 @@ inline std::error_category const & cat_cond_y()
switch( cond_y(cond) )
{
case cond_y::y03:
return code==make_error_code(errc_a::a0) || code==make_error_code(errc_b::b0);
return code == make_error_code(errc_a::a0) || code == make_error_code(errc_b::b0);
case cond_y::y12:
return code==make_error_code(errc_a::a1) || code==make_error_code(errc_b::b1);
return code == make_error_code(errc_a::a1) || code == make_error_code(errc_b::b1);
case cond_y::y21:
return code==make_error_code(errc_a::a2) || code==make_error_code(errc_b::b2);
return code == make_error_code(errc_a::a2) || code == make_error_code(errc_b::b2);
case cond_y::y30:
return code==make_error_code(errc_a::a3) || code==make_error_code(errc_b::b3);
return code == make_error_code(errc_a::a3) || code == make_error_code(errc_b::b3);
default:
return false;
}

View File

@@ -2,7 +2,6 @@
#define BOOST_LEAF_TEST_RES_HPP_INCLUDED
// 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)
@@ -41,16 +40,16 @@ public:
}
explicit operator bool() const noexcept
{
return which_==variant::value;
return which_ == variant::value;
}
T const & value() const
{
BOOST_LEAF_ASSERT(which_==variant::value);
BOOST_LEAF_ASSERT(which_ == variant::value);
return value_;
}
E const & error() const
{
BOOST_LEAF_ASSERT(which_==variant::error);
BOOST_LEAF_ASSERT(which_ == variant::error);
return error_;
}
};
@@ -84,15 +83,15 @@ public:
}
explicit operator bool() const noexcept
{
return which_==variant::value;
return which_ == variant::value;
}
void value() const
{
BOOST_LEAF_ASSERT(which_==variant::value);
BOOST_LEAF_ASSERT(which_ == variant::value);
}
E const & error() const
{
BOOST_LEAF_ASSERT(which_==variant::error);
BOOST_LEAF_ASSERT(which_ == variant::error);
return error_;
}
};

View File

@@ -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)

View File

@@ -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)
@@ -47,7 +46,7 @@ struct fut_info
template <class F>
std::vector<fut_info> launch_tasks( int task_count, F f )
{
BOOST_LEAF_ASSERT(task_count>0);
BOOST_LEAF_ASSERT(task_count > 0);
std::vector<fut_info> fut;
std::generate_n( std::back_inserter(fut), task_count,
[=]

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)
@@ -33,7 +32,7 @@ int main()
auto error_handlers = std::make_tuple(
[]( info<1> x )
{
BOOST_TEST(x.value==1);
BOOST_TEST_EQ(x.value, 1);
return 1;
},
[]

View File

@@ -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)

View File

@@ -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)
@@ -41,7 +40,7 @@ int main()
r1.error(),
[]( info<1> x )
{
BOOST_TEST(x.value==1);
BOOST_TEST_EQ(x.value, 1);
return 1;
},
[]( leaf::diagnostic_details const & info )

View File

@@ -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)
@@ -40,7 +39,7 @@ int main()
r1.error(),
[]( info<1> x ) -> leaf::result<int>
{
BOOST_TEST(x.value==1);
BOOST_TEST_EQ(x.value, 1);
return 1;
},
[&r1]

View File

@@ -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)
@@ -34,7 +33,7 @@ int main()
auto handlers = std::make_tuple(
[]( info<1> x )
{
BOOST_TEST(x.value==1);
BOOST_TEST_EQ(x.value, 1);
return 1;
},
[]( leaf::diagnostic_details const & info )

View File

@@ -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)
@@ -33,7 +32,7 @@ int main()
auto handle_error = std::make_tuple(
[]( info<1> x )
{
BOOST_TEST(x.value==1);
BOOST_TEST_EQ(x.value, 1);
return 1;
},
[]( leaf::error_info const & ei )

View File

@@ -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)
@@ -479,7 +478,7 @@ int main()
BOOST_ERROR("Bad error dispatch");
} );
///////////////////////////////////
////////////////////////////////////////
#ifndef BOOST_LEAF_NO_EXCEPTIONS

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

Some files were not shown because too many files have changed in this diff Show More