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

Removed tabs

This commit is contained in:
Emil Dotchevski
2022-01-19 23:32:44 -08:00
parent 799431ede9
commit ae9aae2a59
12 changed files with 444 additions and 444 deletions

34
.vscode/launch.json vendored
View File

@@ -1,19 +1,19 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bld/debug/lua_callback_eh",
"args": [ ],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false,
"MIMode": "lldb"
}
]
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bld/debug/lua_callback_eh",
"args": [ ],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"externalConsole": false,
"MIMode": "lldb"
}
]
}

212
.vscode/tasks.json vendored
View File

@@ -1,108 +1,108 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Configure Meson build directories",
"type": "shell",
"command": "cd ${workspaceRoot} && meson -D leaf_boost_examples=true -D leaf_lua_examples=true -D leaf_suppress_warnings=false bld/debug && meson -D leaf_boost_examples=true -D leaf_lua_examples=true -D leaf_suppress_warnings=false -D leaf_hpp=true bld/debug_leaf_hpp && meson -D leaf_boost_examples=true -D leaf_lua_examples=true -D leaf_suppress_warnings=false bld/release --buildtype release && meson -D leaf_boost_examples=true -D leaf_lua_examples=true -D leaf_suppress_warnings=false -D leaf_hpp=true bld/release_leaf_hpp --buildtype release && meson -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 Boost)",
"type": "shell",
"command": "cd ${workspaceRoot} && meson -D leaf_lua_examples=true -D leaf_suppress_warnings=false bld/debug && meson -D leaf_lua_examples=true -D leaf_suppress_warnings=false -D leaf_hpp=true bld/debug_leaf_hpp && meson -D leaf_lua_examples=true -D leaf_suppress_warnings=false bld/release --buildtype release && meson -D leaf_lua_examples=true -D leaf_suppress_warnings=false -D leaf_hpp=true bld/release_leaf_hpp --buildtype release",
"problemMatcher": []
},
{
"label": "Generate leaf.hpp",
"type": "shell",
"command": "cd ${workspaceRoot} && python gen/generate_single_header.py -i include/boost/leaf/detail/all.hpp -p ${workspaceRoot}/include -o ${workspaceRoot}/test/leaf.hpp boost/leaf",
"problemMatcher": []
},
{
"group": {
"kind": "build",
"isDefault": true
},
"label": "Build all unit tests and examples (debug)",
"type": "shell",
"command": "cd ${workspaceRoot}/bld/debug && ninja",
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
"relative",
"${workspaceRoot}/bld/debug"
]
}
},
{
"group": "test",
"label": "Run all unit tests (debug)",
"type": "shell",
"dependsOn": [
"Generate leaf.hpp"
],
"command": "cd ${workspaceRoot}/bld/debug_leaf_hpp && ninja && meson test && cd ${workspaceRoot}/bld/debug && ninja && meson test",
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
"relative",
"${workspaceRoot}/bld/debug"
]
}
},
{
"group": "test",
"label": "Run all unit tests (release)",
"type": "shell",
"dependsOn": [
"Generate leaf.hpp"
],
"command": "cd ${workspaceRoot}/bld/release && ninja && meson test && cd ${workspaceRoot}/bld/release_leaf_hpp && ninja && meson test",
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
"relative",
"${workspaceRoot}/bld/release"
]
}
},
{
"group": "test",
"label": "Run all unit tests (b2, all configurations)",
"type": "shell",
"dependsOn": [
"Generate leaf.hpp"
],
"command": "../../b2 test link=shared,static variant=debug,release,leaf_debug_diag0,leaf_release_diag0,leaf_debug_embedded,leaf_release_embedded,leaf_debug_leaf_hpp,leaf_release_leaf_hpp exception-handling=on,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=off rtti=off",
"windows": {
"command": "..\\..\\b2 test variant=debug,release,leaf_debug_diag0,leaf_release_diag0,leaf_debug_embedded,leaf_release_embedded,leaf_debug_leaf_hpp,leaf_release_leaf_hpp exception-handling=on,off && ..\\..\\b2 test variant=debug,release,leaf_debug_diag0,leaf_release_diag0,leaf_debug_leaf_hpp,leaf_release_leaf_hpp exception-handling=off rtti=off",
},
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
"relative",
"${workspaceRoot}/bld/release"
]
}
},
{
"group": {
"kind": "test",
"isDefault": true
},
"label": "Test current editor file",
"type": "shell",
"command": "cd ${workspaceRoot}/bld/debug && { ninja && meson test ${fileBasenameNoExtension} || cat ./meson-logs/testlog.txt }",
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
"relative",
"${workspaceRoot}/bld/debug"
]
}
}
]
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Configure Meson build directories",
"type": "shell",
"command": "cd ${workspaceRoot} && meson -D leaf_boost_examples=true -D leaf_lua_examples=true -D leaf_suppress_warnings=false bld/debug && meson -D leaf_boost_examples=true -D leaf_lua_examples=true -D leaf_suppress_warnings=false -D leaf_hpp=true bld/debug_leaf_hpp && meson -D leaf_boost_examples=true -D leaf_lua_examples=true -D leaf_suppress_warnings=false bld/release --buildtype release && meson -D leaf_boost_examples=true -D leaf_lua_examples=true -D leaf_suppress_warnings=false -D leaf_hpp=true bld/release_leaf_hpp --buildtype release && meson -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 Boost)",
"type": "shell",
"command": "cd ${workspaceRoot} && meson -D leaf_lua_examples=true -D leaf_suppress_warnings=false bld/debug && meson -D leaf_lua_examples=true -D leaf_suppress_warnings=false -D leaf_hpp=true bld/debug_leaf_hpp && meson -D leaf_lua_examples=true -D leaf_suppress_warnings=false bld/release --buildtype release && meson -D leaf_lua_examples=true -D leaf_suppress_warnings=false -D leaf_hpp=true bld/release_leaf_hpp --buildtype release",
"problemMatcher": []
},
{
"label": "Generate leaf.hpp",
"type": "shell",
"command": "cd ${workspaceRoot} && python gen/generate_single_header.py -i include/boost/leaf/detail/all.hpp -p ${workspaceRoot}/include -o ${workspaceRoot}/test/leaf.hpp boost/leaf",
"problemMatcher": []
},
{
"group": {
"kind": "build",
"isDefault": true
},
"label": "Build all unit tests and examples (debug)",
"type": "shell",
"command": "cd ${workspaceRoot}/bld/debug && ninja",
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
"relative",
"${workspaceRoot}/bld/debug"
]
}
},
{
"group": "test",
"label": "Run all unit tests (debug)",
"type": "shell",
"dependsOn": [
"Generate leaf.hpp"
],
"command": "cd ${workspaceRoot}/bld/debug_leaf_hpp && ninja && meson test && cd ${workspaceRoot}/bld/debug && ninja && meson test",
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
"relative",
"${workspaceRoot}/bld/debug"
]
}
},
{
"group": "test",
"label": "Run all unit tests (release)",
"type": "shell",
"dependsOn": [
"Generate leaf.hpp"
],
"command": "cd ${workspaceRoot}/bld/release && ninja && meson test && cd ${workspaceRoot}/bld/release_leaf_hpp && ninja && meson test",
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
"relative",
"${workspaceRoot}/bld/release"
]
}
},
{
"group": "test",
"label": "Run all unit tests (b2, all configurations)",
"type": "shell",
"dependsOn": [
"Generate leaf.hpp"
],
"command": "../../b2 test link=shared,static variant=debug,release,leaf_debug_diag0,leaf_release_diag0,leaf_debug_embedded,leaf_release_embedded,leaf_debug_leaf_hpp,leaf_release_leaf_hpp exception-handling=on,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=off rtti=off",
"windows": {
"command": "..\\..\\b2 test variant=debug,release,leaf_debug_diag0,leaf_release_diag0,leaf_debug_embedded,leaf_release_embedded,leaf_debug_leaf_hpp,leaf_release_leaf_hpp exception-handling=on,off && ..\\..\\b2 test variant=debug,release,leaf_debug_diag0,leaf_release_diag0,leaf_debug_leaf_hpp,leaf_release_leaf_hpp exception-handling=off rtti=off",
},
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
"relative",
"${workspaceRoot}/bld/release"
]
}
},
{
"group": {
"kind": "test",
"isDefault": true
},
"label": "Test current editor file",
"type": "shell",
"command": "cd ${workspaceRoot}/bld/debug && { ninja && meson test ${fileBasenameNoExtension} || cat ./meson-logs/testlog.txt }",
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
"relative",
"${workspaceRoot}/bld/debug"
]
}
}
]
}

View File

@@ -123,7 +123,7 @@ Which on clang 9 outputs:
```x86asm
val():
mov eax, 42
ret
ret
main:
mov eax, 42
ret
@@ -212,10 +212,10 @@ We get:
```x86asm
g(): # @g()
mov rax, rdi
mov dword ptr [rdi], 43
mov dword ptr [rdi + 16], 3
ret
mov rax, rdi
mov dword ptr [rdi], 43
mov dword ptr [rdi + 16], 3
ret
```
With a less trivial definition of `f`:

View File

@@ -4,9 +4,9 @@
<script>
function switch_style()
{
var i, tag;
for( i=0, tag=document.getElementsByTagName("link"); i<tag.length; i++ )
if( tag[i].rel.indexOf("stylesheet")!=-1 && tag[i].href.includes("zajo-") )
tag[i].disabled = !tag[i].disabled;
var i, tag;
for( i=0, tag=document.getElementsByTagName("link"); i<tag.length; i++ )
if( tag[i].rel.indexOf("stylesheet")!=-1 && tag[i].href.includes("zajo-") )
tag[i].disabled = !tag[i].disabled;
}
</script>

View File

@@ -2276,11 +2276,11 @@ namespace boost { namespace leaf {
BOOST_LEAF_ASSIGN(auto v, r)
#define BOOST_LEAF_CHECK(r)\
auto && <<temp>> = r;\
if( <<temp>> )\
;\
else\
return <<temp>>.error()
auto && <<temp>> = r;\
if( <<temp>> )\
;\
else\
return <<temp>>.error()
#define BOOST_LEAF_NEW_ERROR <<inject e_source_location voodoo>> ::boost::leaf::new_error
----

View File

@@ -1,18 +1,18 @@
"""
Copyright 2018-2022 Emil Dotchevski and Reverge Studios, Inc.
Copyright (c) Sorin Fetche
Copyright 2018-2022 Emil Dotchevski and Reverge Studios, Inc.
Copyright (c) Sorin Fetche
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)
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)
This program generates a single header file from a file including multiple C/C++ headers.
This program generates a single header file from a file including multiple C/C++ headers.
Usage:
Usage:
python3 generate_single_header.py --help
python3 generate_single_header.py --help
e.g. python3 generate_single_header.py -i include/boost/leaf/detail/all.hpp -p include -o test/leaf.hpp boost/leaf
e.g. python3 generate_single_header.py -i include/boost/leaf/detail/all.hpp -p include -o test/leaf.hpp boost/leaf
"""
@@ -26,67 +26,67 @@ included = {}
total_line_count = 11
def append(input_file_name, input_file, output_file, regex_includes, include_folder):
global total_line_count
line_count = 1
for line in input_file:
line_count += 1
result = regex_includes.search(line)
if result:
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))
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))
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))
total_line_count += 2
else:
output_file.write(line)
total_line_count += 1
global total_line_count
line_count = 1
for line in input_file:
line_count += 1
result = regex_includes.search(line)
if result:
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))
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))
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))
total_line_count += 2
else:
output_file.write(line)
total_line_count += 1
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)")
args = parser.parse_args()
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)")
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)
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"))
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')
append(args.input, input_file, output_file, regex_includes, args.path)
output_file.write(
'\n'
'#endif\n' )
# print("%d" % total_line_count)
regex_includes = re.compile(r"""^\s*#[\t\s]*include[\t\s]*("|\<)(?P<include>%s.*)("|\>)""" % args.prefix)
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"))
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')
append(args.input, input_file, output_file, regex_includes, args.path)
output_file.write(
'\n'
'#endif\n' )
# print("%d" % total_line_count)
if __name__ == "__main__":
_main()
_main()

View File

@@ -15,17 +15,17 @@
////////////////////////////////////////
#ifdef BOOST_LEAF_DIAGNOSTICS
# warning BOOST_LEAF_DIAGNOSTICS has been renamed to BOOST_LEAF_CFG_DIAGNOSTICS.
# define BOOST_LEAF_CFG_DIAGNOSTICS BOOST_LEAF_DIAGNOSTICS
# warning BOOST_LEAF_DIAGNOSTICS has been renamed to BOOST_LEAF_CFG_DIAGNOSTICS.
# define BOOST_LEAF_CFG_DIAGNOSTICS BOOST_LEAF_DIAGNOSTICS
#endif
////////////////////////////////////////
#ifdef BOOST_LEAF_TLS_FREERTOS
# ifndef BOOST_LEAF_EMBEDDED
# define BOOST_LEAF_EMBEDDED
# endif
# ifndef BOOST_LEAF_EMBEDDED
# define BOOST_LEAF_EMBEDDED
# endif
#endif
@@ -33,21 +33,21 @@
#ifdef BOOST_LEAF_EMBEDDED
# ifndef BOOST_LEAF_CFG_DIAGNOSTICS
# define BOOST_LEAF_CFG_DIAGNOSTICS 0
# endif
# 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_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_STD_STRING
# define BOOST_LEAF_CFG_STD_STRING 0
# endif
# ifndef BOOST_LEAF_CFG_CAPTURE
# define BOOST_LEAF_CFG_CAPTURE 0
# endif
# ifndef BOOST_LEAF_CFG_CAPTURE
# define BOOST_LEAF_CFG_CAPTURE 0
# endif
#endif
@@ -58,11 +58,11 @@
#endif
#ifndef BOOST_LEAF_CFG_STD_SYSTEM_ERROR
# define BOOST_LEAF_CFG_STD_SYSTEM_ERROR 1
# define BOOST_LEAF_CFG_STD_SYSTEM_ERROR 1
#endif
#ifndef BOOST_LEAF_CFG_STD_STRING
# define BOOST_LEAF_CFG_STD_STRING 1
# define BOOST_LEAF_CFG_STD_STRING 1
#endif
#ifndef BOOST_LEAF_CFG_CAPTURE
@@ -70,7 +70,7 @@
#endif
#ifndef BOOST_LEAF_CFG_WIN32
# define BOOST_LEAF_CFG_WIN32 0
# define BOOST_LEAF_CFG_WIN32 0
#endif
#if BOOST_LEAF_CFG_DIAGNOSTICS!=0 && BOOST_LEAF_CFG_DIAGNOSTICS!=1
@@ -90,7 +90,7 @@
#endif
#if BOOST_LEAF_CFG_DIAGNOSTICS && !BOOST_LEAF_CFG_STD_STRING
# error BOOST_LEAF_CFG_DIAGNOSTICS requires the use of std::string
# error BOOST_LEAF_CFG_DIAGNOSTICS requires the use of std::string
#endif
#if BOOST_LEAF_CFG_WIN32!=0 && BOOST_LEAF_CFG_WIN32!=1
@@ -252,9 +252,9 @@
////////////////////////////////////////
#ifdef __GNUC__
# define BOOST_LEAF_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
# define BOOST_LEAF_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
#else
# define BOOST_LEAF_SYMBOL_VISIBLE
# define BOOST_LEAF_SYMBOL_VISIBLE
#endif
////////////////////////////////////////

View File

@@ -11,7 +11,7 @@
#endif
#if defined BOOST_LEAF_TLS_ARRAY
# include <boost/leaf/config/tls_array.hpp>
# include <boost/leaf/config/tls_array.hpp>
#elif defined(BOOST_LEAF_NO_THREADS)
# include <boost/leaf/config/tls_globals.hpp>
#else

View File

@@ -16,79 +16,79 @@ option_enable_benchmarks = get_option('leaf_enable_benchmarks')
option_embedded = get_option('leaf_embedded')
if not option_enable_examples
if option_boost
error('The option leaf_boost_examples requires leaf_enable_examples. Aborting.')
endif
if option_lua
error('The option leaf_lua_examples requires leaf_enable_examples. Aborting.')
endif
if option_boost
error('The option leaf_boost_examples requires leaf_enable_examples. Aborting.')
endif
if option_lua
error('The option leaf_lua_examples requires leaf_enable_examples. Aborting.')
endif
endif
compiler = meson.get_compiler('cpp')
compiler_id = compiler.get_id()
if not meson.is_subproject()
if option_boost
add_global_arguments(
'-DBOOST_LEAF_BOOST_AVAILABLE',
language:'cpp' )
endif
if compiler_id=='clang'
if get_option('buildtype')!='debug'
add_global_arguments(
'-Wno-unused-variable',
language:'cpp' )
endif
add_global_arguments(
'-fdiagnostics-absolute-paths',
'-Wno-dangling-else',
'-Wno-non-virtual-dtor',
'-Wno-delete-non-abstract-non-virtual-dtor',
language:'cpp' )
elif compiler_id=='gcc'
if get_option('buildtype')!='debug'
add_global_arguments(
'-Wno-unused-variable',
language:'cpp' )
endif
add_global_arguments(
'-Wno-dangling-else',
'-Wno-non-virtual-dtor',
'-Wno-misleading-indentation',
language:'cpp' )
elif host_machine.system()=='emscripten'
add_global_arguments(
'-s', 'WASM=1',
'-s', 'USE_PTHREADS=1',
'-s', 'EXIT_RUNTIME=1',
'-s', 'PROXY_TO_PTHREAD=1',
'-s', 'DISABLE_EXCEPTION_CATCHING=0',
language:'cpp' )
add_global_link_arguments(
'-s', 'EXPORT_ALL=1',
'-s', 'WASM=1',
'-s', 'USE_PTHREADS=1',
'-s', 'EXIT_RUNTIME=1',
'-s', 'PROXY_TO_PTHREAD=1',
'-s', 'DISABLE_EXCEPTION_CATCHING=0',
'-s', 'INITIAL_MEMORY=268435456',
language:'cpp' )
endif
if option_boost
add_global_arguments(
'-DBOOST_LEAF_BOOST_AVAILABLE',
language:'cpp' )
endif
if compiler_id=='clang'
if get_option('buildtype')!='debug'
add_global_arguments(
'-Wno-unused-variable',
language:'cpp' )
endif
add_global_arguments(
'-fdiagnostics-absolute-paths',
'-Wno-dangling-else',
'-Wno-non-virtual-dtor',
'-Wno-delete-non-abstract-non-virtual-dtor',
language:'cpp' )
elif compiler_id=='gcc'
if get_option('buildtype')!='debug'
add_global_arguments(
'-Wno-unused-variable',
language:'cpp' )
endif
add_global_arguments(
'-Wno-dangling-else',
'-Wno-non-virtual-dtor',
'-Wno-misleading-indentation',
language:'cpp' )
elif host_machine.system()=='emscripten'
add_global_arguments(
'-s', 'WASM=1',
'-s', 'USE_PTHREADS=1',
'-s', 'EXIT_RUNTIME=1',
'-s', 'PROXY_TO_PTHREAD=1',
'-s', 'DISABLE_EXCEPTION_CATCHING=0',
language:'cpp' )
add_global_link_arguments(
'-s', 'EXPORT_ALL=1',
'-s', 'WASM=1',
'-s', 'USE_PTHREADS=1',
'-s', 'EXIT_RUNTIME=1',
'-s', 'PROXY_TO_PTHREAD=1',
'-s', 'DISABLE_EXCEPTION_CATCHING=0',
'-s', 'INITIAL_MEMORY=268435456',
language:'cpp' )
endif
endif
dep_boost = [ ]
if option_boost # Requires that LEAF resides under boost_root/libs/leaf.
dep_boost = declare_dependency(include_directories: '../..')
dep_boost = declare_dependency(include_directories: '../..')
endif
dep_lua = [ ]
if option_lua
dep_lua = subproject('lua').get_variable('all')
dep_lua = subproject('lua').get_variable('all')
endif
defines = [ '-DBOOST_LEAF_CFG_DIAGNOSTICS=' + option_diagnostics.to_string() ]
if option_embedded
defines += '-DBOOST_LEAF_EMBEDDED'
defines += '-DBOOST_LEAF_EMBEDDED'
endif
dep_thread = dependency('threads')
@@ -99,104 +99,104 @@ leaf = declare_dependency( include_directories: 'include', compile_args: defines
if option_enable_unit_tests
tests = [
'accumulate_basic_test',
'accumulate_nested_error_exception_test',
'accumulate_nested_error_result_test',
'accumulate_nested_new_error_exception_test',
'accumulate_nested_new_error_result_test',
'accumulate_nested_success_exception_test',
'accumulate_nested_success_result_test',
'BOOST_LEAF_AUTO_test',
'BOOST_LEAF_ASSIGN_test',
'capture_exception_async_test',
'capture_exception_result_async_test',
'capture_exception_state_test',
'capture_exception_unload_test',
'capture_result_async_test',
'capture_result_state_test',
'context_activator_test',
'context_deduction_test',
'capture_result_unload_test',
'ctx_handle_all_test',
'ctx_handle_some_test',
'ctx_remote_handle_all_test',
'ctx_remote_handle_some_test',
'defer_basic_test',
'defer_nested_error_exception_test',
'defer_nested_error_result_test',
'defer_nested_new_error_exception_test',
'defer_nested_new_error_result_test',
'defer_nested_success_exception_test',
'defer_nested_success_result_test',
'diagnostic_info_test',
'e_errno_test',
'e_LastError_test',
'error_code_test',
'error_id_test',
'exception_test',
'exception_to_result_test',
'function_traits_test',
'handle_all_other_result_test',
'handle_all_test',
'handle_basic_test',
'handle_some_other_result_test',
'handle_some_test',
'match_test',
'match_member_test',
'match_value_test',
'multiple_errors_test',
'optional_test',
'preload_basic_test',
'preload_exception_test',
'preload_nested_error_exception_test',
'preload_nested_error_result_test',
'preload_nested_new_error_exception_test',
'preload_nested_new_error_result_test',
'preload_nested_success_exception_test',
'preload_nested_success_result_test',
'print_test',
'result_bad_result_test',
'result_implicit_conversion_test',
'result_load_test',
'result_ref_test',
'result_state_test',
'tls_array_test',
'try_catch_error_id_test',
'try_catch_system_error_test',
'try_catch_test',
'try_exception_and_result_test',
]
if option_boost and option_exceptions
tests += [
'boost_exception_test'
]
endif
tests = [
'accumulate_basic_test',
'accumulate_nested_error_exception_test',
'accumulate_nested_error_result_test',
'accumulate_nested_new_error_exception_test',
'accumulate_nested_new_error_result_test',
'accumulate_nested_success_exception_test',
'accumulate_nested_success_result_test',
'BOOST_LEAF_AUTO_test',
'BOOST_LEAF_ASSIGN_test',
'capture_exception_async_test',
'capture_exception_result_async_test',
'capture_exception_state_test',
'capture_exception_unload_test',
'capture_result_async_test',
'capture_result_state_test',
'context_activator_test',
'context_deduction_test',
'capture_result_unload_test',
'ctx_handle_all_test',
'ctx_handle_some_test',
'ctx_remote_handle_all_test',
'ctx_remote_handle_some_test',
'defer_basic_test',
'defer_nested_error_exception_test',
'defer_nested_error_result_test',
'defer_nested_new_error_exception_test',
'defer_nested_new_error_result_test',
'defer_nested_success_exception_test',
'defer_nested_success_result_test',
'diagnostic_info_test',
'e_errno_test',
'e_LastError_test',
'error_code_test',
'error_id_test',
'exception_test',
'exception_to_result_test',
'function_traits_test',
'handle_all_other_result_test',
'handle_all_test',
'handle_basic_test',
'handle_some_other_result_test',
'handle_some_test',
'match_test',
'match_member_test',
'match_value_test',
'multiple_errors_test',
'optional_test',
'preload_basic_test',
'preload_exception_test',
'preload_nested_error_exception_test',
'preload_nested_error_result_test',
'preload_nested_new_error_exception_test',
'preload_nested_new_error_result_test',
'preload_nested_success_exception_test',
'preload_nested_success_result_test',
'print_test',
'result_bad_result_test',
'result_implicit_conversion_test',
'result_load_test',
'result_ref_test',
'result_state_test',
'tls_array_test',
'try_catch_error_id_test',
'try_catch_system_error_test',
'try_catch_test',
'try_exception_and_result_test',
]
if option_boost and option_exceptions
tests += [
'boost_exception_test'
]
endif
dep_test_single_header = []
if option_leaf_hpp
dep_test_single_header = declare_dependency(compile_args: ['-DBOOST_LEAF_TEST_SINGLE_HEADER'])
endif
dep_test_single_header = []
if option_leaf_hpp
dep_test_single_header = declare_dependency(compile_args: ['-DBOOST_LEAF_TEST_SINGLE_HEADER'])
endif
foreach t : tests
test(t, executable(t, 'test/'+t+'.cpp', dependencies: [leaf, dep_thread, dep_boost, dep_test_single_header]) )
endforeach
foreach t : tests
test(t, executable(t, 'test/'+t+'.cpp', dependencies: [leaf, dep_thread, dep_boost, dep_test_single_header]) )
endforeach
header_tests = [
'_hpp_capture_test',
'_hpp_common_test',
'_hpp_context_test',
'_hpp_error_test',
'_hpp_exception_test',
'_hpp_handle_errors_test',
'_hpp_leaf_test',
'_hpp_on_error_test',
'_hpp_pred_test',
'_hpp_result_test',
]
foreach t : header_tests
test(t, executable(t, 'test/'+t+'.cpp', dependencies: [leaf, dep_thread, dep_boost]) )
endforeach
header_tests = [
'_hpp_capture_test',
'_hpp_common_test',
'_hpp_context_test',
'_hpp_error_test',
'_hpp_exception_test',
'_hpp_handle_errors_test',
'_hpp_leaf_test',
'_hpp_on_error_test',
'_hpp_pred_test',
'_hpp_result_test',
]
foreach t : header_tests
test(t, executable(t, 'test/'+t+'.cpp', dependencies: [leaf, dep_thread, dep_boost]) )
endforeach
endif
@@ -204,23 +204,23 @@ endif
if option_enable_examples
print_file_examples = [
'print_file_result'
]
if option_exceptions
print_file_examples += [
'print_file_eh'
]
endif
if option_boost
print_file_examples += [
'print_file_outcome_result'
]
endif
print_file_examples = [
'print_file_result'
]
if option_exceptions
print_file_examples += [
'print_file_eh'
]
endif
if option_boost
print_file_examples += [
'print_file_outcome_result'
]
endif
foreach e : print_file_examples
executable(e, 'example/print_file/'+e+'.cpp', dependencies: [leaf, dep_thread, dep_boost] )
endforeach
foreach e : print_file_examples
executable(e, 'example/print_file/'+e+'.cpp', dependencies: [leaf, dep_thread, dep_boost] )
endforeach
endif
@@ -228,37 +228,37 @@ endif
if option_enable_examples
examples = [
'capture_in_result',
'error_log',
'error_trace',
'print_half'
]
if option_exceptions
examples += [
'capture_in_exception',
'exception_to_result'
]
if option_lua
examples += [
'lua_callback_eh'
]
endif
if option_boost
examples += [
# 'asio_beast_leaf_rpc' #FIXME
]
endif
endif
if option_lua
examples += [
'lua_callback_result'
]
endif
examples = [
'capture_in_result',
'error_log',
'error_trace',
'print_half'
]
if option_exceptions
examples += [
'capture_in_exception',
'exception_to_result'
]
if option_lua
examples += [
'lua_callback_eh'
]
endif
if option_boost
examples += [
# 'asio_beast_leaf_rpc' #FIXME
]
endif
endif
if option_lua
examples += [
'lua_callback_result'
]
endif
foreach e : examples
executable(e, 'example/'+e+'.cpp', dependencies: [leaf, dep_thread, dep_boost, dep_lua] )
endforeach
foreach e : examples
executable(e, 'example/'+e+'.cpp', dependencies: [leaf, dep_thread, dep_boost, dep_lua] )
endforeach
endif
@@ -266,20 +266,20 @@ endif
if option_enable_benchmarks
if get_option('optimization')=='0'
error('The option leaf_enable_benchmarks requires optimizations to be enabled. Aborting.')
endif
if get_option('optimization')=='0'
error('The option leaf_enable_benchmarks requires optimizations to be enabled. Aborting.')
endif
if option_exceptions
error('The option leaf_enable_benchmarks requires the built-in option cpp_eh set to none. Aborting.')
endif
if option_exceptions
error('The option leaf_enable_benchmarks requires the built-in option cpp_eh set to none. Aborting.')
endif
dep_tl_expected = subproject('tl_expected').get_variable('headers')
executable('deep_stack_tl', 'benchmark/deep_stack_other.cpp', override_options: ['cpp_std=c++17'], cpp_args: '-DBENCHMARK_WHAT=0', dependencies: [dep_tl_expected] )
executable('deep_stack_leaf', 'benchmark/deep_stack_leaf.cpp', dependencies: [leaf], override_options: ['cpp_std=c++17'], cpp_args: '-DBOOST_LEAF_CFG_DIAGNOSTICS=0')
if option_boost
executable('deep_stack_result', 'benchmark/deep_stack_other.cpp', dependencies: [dep_boost], override_options: ['cpp_std=c++17'], cpp_args: '-DBENCHMARK_WHAT=1' )
executable('deep_stack_outcome', 'benchmark/deep_stack_other.cpp', dependencies: [dep_boost], override_options: ['cpp_std=c++17'], cpp_args: '-DBENCHMARK_WHAT=2' )
endif
dep_tl_expected = subproject('tl_expected').get_variable('headers')
executable('deep_stack_tl', 'benchmark/deep_stack_other.cpp', override_options: ['cpp_std=c++17'], cpp_args: '-DBENCHMARK_WHAT=0', dependencies: [dep_tl_expected] )
executable('deep_stack_leaf', 'benchmark/deep_stack_leaf.cpp', dependencies: [leaf], override_options: ['cpp_std=c++17'], cpp_args: '-DBOOST_LEAF_CFG_DIAGNOSTICS=0')
if option_boost
executable('deep_stack_result', 'benchmark/deep_stack_other.cpp', dependencies: [dep_boost], override_options: ['cpp_std=c++17'], cpp_args: '-DBENCHMARK_WHAT=1' )
executable('deep_stack_outcome', 'benchmark/deep_stack_other.cpp', dependencies: [dep_boost], override_options: ['cpp_std=c++17'], cpp_args: '-DBENCHMARK_WHAT=2' )
endif
endif

View File

@@ -23,8 +23,8 @@ project
<toolset>gcc:<cxxflags>"-Wno-delete-non-virtual-dtor -Wno-parentheses"
<toolset>clang:<cxxflags>"-Wno-dangling-else"
<toolset>darwin:<cxxflags>"-Wno-unused-variable -Wno-delete-non-virtual-dtor -Wno-non-virtual-dtor -Wno-dangling-else"
<toolset>msvc:<cxxflags>"-wd 4267 -wd 4996 -wd 4244"
<include>../../..
<toolset>msvc:<cxxflags>"-wd 4267 -wd 4996 -wd 4244"
<include>../../..
;
compile _hpp_capture_test.cpp ;

View File

@@ -12,16 +12,16 @@ namespace leaf = boost::leaf;
leaf::result<void> BOOST_SYMBOL_VISIBLE hidden_result()
{
auto load = leaf::on_error( my_info<1>{1}, my_info<3>{3} );
return leaf::new_error( my_info<2>{2} );
auto load = leaf::on_error( my_info<1>{1}, my_info<3>{3} );
return leaf::new_error( my_info<2>{2} );
}
#ifndef BOOST_NO_EXCEPTIONS
void BOOST_SYMBOL_VISIBLE hidden_throw()
{
auto load = leaf::on_error( my_info<1>{1}, my_info<3>{3} );
throw leaf::exception( my_info<2>{2} );
auto load = leaf::on_error( my_info<1>{1}, my_info<3>{3} );
throw leaf::exception( my_info<2>{2} );
}
#endif

View File

@@ -12,7 +12,7 @@
template <int Tag>
struct BOOST_SYMBOL_VISIBLE my_info
{
int value;
int value;
template <class CharT, class Traits>
friend std::basic_ostream<CharT, Traits> & operator<<( std::basic_ostream<CharT, Traits> & os, my_info const & x )