From 69476967aeaa245c452a3b3b92b9ba3c571bb958 Mon Sep 17 00:00:00 2001 From: Glen Fraser Date: Fri, 18 Jun 2021 16:40:38 +0200 Subject: [PATCH 01/63] Reimplement pair_conversion() helper - resolves issue #563. --- .../dispatchkit/type_conversions.hpp | 18 ++++++++++++++++ unittests/compiled_tests.cpp | 21 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/include/chaiscript/dispatchkit/type_conversions.hpp b/include/chaiscript/dispatchkit/type_conversions.hpp index e47afbf7..3f89e66b 100644 --- a/include/chaiscript/dispatchkit/type_conversions.hpp +++ b/include/chaiscript/dispatchkit/type_conversions.hpp @@ -534,6 +534,24 @@ namespace chaiscript { return chaiscript::make_shared>( user_type>(), user_type(), func); } + + template + Type_Conversion pair_conversion() { + auto func = [](const Boxed_Value &t_bv) -> Boxed_Value { + const std::pair &from_pair + = detail::Cast_Helper &>::cast(t_bv, nullptr); + + auto pair = std::make_pair( + detail::Cast_Helper::cast(from_pair.first, nullptr), + detail::Cast_Helper::cast(from_pair.second, nullptr) + ); + + return Boxed_Value(std::move(pair)); + }; + + return chaiscript::make_shared>( + user_type>(), user_type>(), func); + } } // namespace chaiscript #endif diff --git a/unittests/compiled_tests.cpp b/unittests/compiled_tests.cpp index f8873df8..29f49875 100644 --- a/unittests/compiled_tests.cpp +++ b/unittests/compiled_tests.cpp @@ -866,6 +866,27 @@ TEST_CASE("Map conversions") { CHECK(c == 42); } +TEST_CASE("Pair conversions") { + chaiscript::ChaiScript_Basic chai(create_chaiscript_stdlib(), create_chaiscript_parser()); + chai.add(chaiscript::pair_conversion()); + chai.add(chaiscript::pair_conversion()); + + { + const auto p = chai.eval>(R"cs( + Pair("chai", "script"); + )cs"); + CHECK(p.first == std::string{ "chai" }); + CHECK(p.second == "script"); + } + { + const auto p = chai.eval>(R"cs( + Pair(5, 3.14); + )cs"); + CHECK(p.first == 5); + CHECK(p.second == Approx(3.14)); + } +} + TEST_CASE("Parse floats with non-posix locale") { #ifdef CHAISCRIPT_MSVC std::setlocale(LC_ALL, "en-ZA"); From 7cd229cf26c179925b6c389078286de267756019 Mon Sep 17 00:00:00 2001 From: Stephen Berry Date: Wed, 28 Jul 2021 09:04:38 -0500 Subject: [PATCH 02/63] Added virtual destructor for ChaiScript_Basic ChaiScript inherits from ChaiScript_Basic, so this is good practice. I also need to be able to inherit from ChaiScript and dynamic cast, which is impossible without this destructor. --- include/chaiscript/language/chaiscript_engine.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/chaiscript/language/chaiscript_engine.hpp b/include/chaiscript/language/chaiscript_engine.hpp index 9950ec50..d3b245ce 100644 --- a/include/chaiscript/language/chaiscript_engine.hpp +++ b/include/chaiscript/language/chaiscript_engine.hpp @@ -236,6 +236,10 @@ namespace chaiscript { } public: + + /// \brief Virtual destructor for ChaiScript + virtual ~ChaiScript_Basic() = default; + /// \brief Constructor for ChaiScript /// \param[in] t_lib Standard library to apply to this ChaiScript instance /// \param[in] t_modulepaths Vector of paths to search when attempting to load a binary module From 0870cb5a3a1ad21573c318acaf476014a998433f Mon Sep 17 00:00:00 2001 From: FellowTraveler Date: Sun, 18 Jun 2023 06:42:51 -0500 Subject: [PATCH 03/63] Add C++20 support ChaiScript now successfully builds on my Mac with C++20, and passes 100% of the unit tests. --- CMakeLists.txt | 4 +- .../chaiscript/language/chaiscript_common.hpp | 197 +++++++++--------- unittests/compiled_tests.cpp | 2 +- unittests/static_chaiscript.cpp | 8 +- 4 files changed, 111 insertions(+), 100 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7eef73e3..878749ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.12) cmake_policy(SET CMP0054 NEW) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) # required since cmake 3.4 at least for libc++ @@ -167,7 +167,7 @@ if(MSVC) else() add_definitions(-Wall -Wextra -Wconversion -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wcast-qual -Wunused -Woverloaded-virtual -Wno-noexcept-type -Wpedantic -Werror=return-type) - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") add_definitions(-Weverything -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-documentation -Wno-switch-enum -Wno-weak-vtables -Wno-missing-prototypes -Wno-padded -Wno-missing-noreturn -Wno-exit-time-destructors -Wno-documentation-unknown-command -Wno-unused-template -Wno-undef -Wno-double-promotion) else() add_definitions(-Wnoexcept) diff --git a/include/chaiscript/language/chaiscript_common.hpp b/include/chaiscript/language/chaiscript_common.hpp index f4d51a19..3b020c84 100644 --- a/include/chaiscript/language/chaiscript_common.hpp +++ b/include/chaiscript/language/chaiscript_common.hpp @@ -26,6 +26,10 @@ namespace chaiscript { struct AST_Node; + struct AST_Node_Trace; + namespace exception { + struct eval_error; + } } // namespace chaiscript namespace chaiscript { @@ -166,11 +170,104 @@ namespace chaiscript { std::shared_ptr filename; }; + /// \brief Struct that doubles as both a parser ast_node and an AST node. + struct AST_Node { + public: + const AST_Node_Type identifier; + const std::string text; + Parse_Location location; + + const std::string &filename() const noexcept { return *location.filename; } + + const File_Position &start() const noexcept { return location.start; } + + const File_Position &end() const noexcept { return location.end; } + + std::string pretty_print() const { + std::ostringstream oss; + + oss << text; + + for (auto &elem : get_children()) { + oss << elem.get().pretty_print() << ' '; + } + + return oss.str(); + } + + virtual std::vector> get_children() const = 0; + virtual Boxed_Value eval(const chaiscript::detail::Dispatch_State &t_e) const = 0; + + /// Prints the contents of an AST node, including its children, recursively + std::string to_string(const std::string &t_prepend = "") const { + std::ostringstream oss; + + oss << t_prepend << "(" << ast_node_type_to_string(this->identifier) << ") " << this->text << " : " << this->location.start.line + << ", " << this->location.start.column << '\n'; + + for (auto &elem : get_children()) { + oss << elem.get().to_string(t_prepend + " "); + } + return oss.str(); + } + + static inline bool get_bool_condition(const Boxed_Value &t_bv, const chaiscript::detail::Dispatch_State &t_ss); + + virtual ~AST_Node() noexcept = default; + AST_Node(AST_Node &&) = default; + AST_Node &operator=(AST_Node &&) = delete; + AST_Node(const AST_Node &) = delete; + AST_Node &operator=(const AST_Node &) = delete; + + protected: + AST_Node(std::string t_ast_node_text, AST_Node_Type t_id, Parse_Location t_loc) + : identifier(t_id) + , text(std::move(t_ast_node_text)) + , location(std::move(t_loc)) { + } + }; + /// \brief Typedef for pointers to AST_Node objects. Used in building of the AST_Node tree using AST_NodePtr = std::unique_ptr; using AST_NodePtr_Const = std::unique_ptr; - struct AST_Node_Trace; + struct AST_Node_Trace { + const AST_Node_Type identifier; + const std::string text; + Parse_Location location; + + const std::string &filename() const noexcept { return *location.filename; } + + const File_Position &start() const noexcept { return location.start; } + + const File_Position &end() const noexcept { return location.end; } + + std::string pretty_print() const { + std::ostringstream oss; + + oss << text; + + for (const auto &elem : children) { + oss << elem.pretty_print() << ' '; + } + + return oss.str(); + } + + std::vector get_children(const AST_Node &node) { + const auto node_children = node.get_children(); + return std::vector(node_children.begin(), node_children.end()); + } + + AST_Node_Trace(const AST_Node &node) + : identifier(node.identifier) + , text(node.text) + , location(node.location) + , children(get_children(node)) { + } + + std::vector children; + }; /// \brief Classes which may be thrown during error cases when ChaiScript is executing. namespace exception { @@ -495,106 +592,14 @@ namespace chaiscript { } // namespace exception - /// \brief Struct that doubles as both a parser ast_node and an AST node. - struct AST_Node { - public: - const AST_Node_Type identifier; - const std::string text; - Parse_Location location; - - const std::string &filename() const noexcept { return *location.filename; } - - const File_Position &start() const noexcept { return location.start; } - - const File_Position &end() const noexcept { return location.end; } - - std::string pretty_print() const { - std::ostringstream oss; - - oss << text; - - for (auto &elem : get_children()) { - oss << elem.get().pretty_print() << ' '; - } - - return oss.str(); - } - - virtual std::vector> get_children() const = 0; - virtual Boxed_Value eval(const chaiscript::detail::Dispatch_State &t_e) const = 0; - - /// Prints the contents of an AST node, including its children, recursively - std::string to_string(const std::string &t_prepend = "") const { - std::ostringstream oss; - - oss << t_prepend << "(" << ast_node_type_to_string(this->identifier) << ") " << this->text << " : " << this->location.start.line - << ", " << this->location.start.column << '\n'; - - for (auto &elem : get_children()) { - oss << elem.get().to_string(t_prepend + " "); - } - return oss.str(); - } - - static bool get_bool_condition(const Boxed_Value &t_bv, const chaiscript::detail::Dispatch_State &t_ss) { + //static + bool AST_Node::get_bool_condition(const Boxed_Value &t_bv, const chaiscript::detail::Dispatch_State &t_ss) { try { return t_ss->boxed_cast(t_bv); } catch (const exception::bad_boxed_cast &) { throw exception::eval_error("Condition not boolean"); } - } - - virtual ~AST_Node() noexcept = default; - AST_Node(AST_Node &&) = default; - AST_Node &operator=(AST_Node &&) = delete; - AST_Node(const AST_Node &) = delete; - AST_Node &operator=(const AST_Node &) = delete; - - protected: - AST_Node(std::string t_ast_node_text, AST_Node_Type t_id, Parse_Location t_loc) - : identifier(t_id) - , text(std::move(t_ast_node_text)) - , location(std::move(t_loc)) { - } - }; - - struct AST_Node_Trace { - const AST_Node_Type identifier; - const std::string text; - Parse_Location location; - - const std::string &filename() const noexcept { return *location.filename; } - - const File_Position &start() const noexcept { return location.start; } - - const File_Position &end() const noexcept { return location.end; } - - std::string pretty_print() const { - std::ostringstream oss; - - oss << text; - - for (const auto &elem : children) { - oss << elem.pretty_print() << ' '; - } - - return oss.str(); - } - - std::vector get_children(const AST_Node &node) { - const auto node_children = node.get_children(); - return std::vector(node_children.begin(), node_children.end()); - } - - AST_Node_Trace(const AST_Node &node) - : identifier(node.identifier) - , text(node.text) - , location(node.location) - , children(get_children(node)) { - } - - std::vector children; - }; + } namespace parser { class ChaiScript_Parser_Base { diff --git a/unittests/compiled_tests.cpp b/unittests/compiled_tests.cpp index f8873df8..1462c203 100644 --- a/unittests/compiled_tests.cpp +++ b/unittests/compiled_tests.cpp @@ -1032,7 +1032,7 @@ TEST_CASE("Use unique_ptr") { chaiscript::ChaiScript_Basic chai(create_chaiscript_stdlib(), create_chaiscript_parser()); chai.add(chaiscript::fun([](int &i) { ++i; }), "inci"); - chai.add(chaiscript::fun([](int i) { ++i; }), "copyi"); + chai.add(chaiscript::fun([]([[maybe_unused]] int i) { ++i; }), "copyi"); chai.add(chaiscript::fun([](int *i) { ++(*i); }), "derefi"); chai.add(chaiscript::fun([](const std::unique_ptr &i) { ++(*i); }), "constrefuniqptri"); chai.add(chaiscript::fun([](std::unique_ptr &i) { ++(*i); }), "refuniqptri"); diff --git a/unittests/static_chaiscript.cpp b/unittests/static_chaiscript.cpp index 7819d9eb..61aa3ac7 100644 --- a/unittests/static_chaiscript.cpp +++ b/unittests/static_chaiscript.cpp @@ -6,8 +6,14 @@ /// ChaiScript as a static is unsupported with thread support enabled /// +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wexit-time-destructors" +#pragma clang diagnostic ignored "-Wglobal-constructors" +#endif + #include -static chaiscript::ChaiScript chai; +static chaiscript::ChaiScript chai{}; int main() {} From 866ef314a8a43d31c36f7ec110b57bd6aa2d180e Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Sun, 8 Oct 2023 17:18:49 -0400 Subject: [PATCH 04/63] Add /build to .gitignore (#614) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9e6e4429..3e48530b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /buckaroo/ .buckconfig.local BUCKAROO_DEPS +/build From dbd2050eb2bea3bbd199b26d8620a19280b38959 Mon Sep 17 00:00:00 2001 From: ar <34866740+wholivesinapineappleunderthesea@users.noreply.github.com> Date: Mon, 27 Nov 2023 21:18:34 -0500 Subject: [PATCH 05/63] Fix spelling mistakes in cheatsheet.md --- cheatsheet.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cheatsheet.md b/cheatsheet.md index 1daf298f..5835c36b 100644 --- a/cheatsheet.md +++ b/cheatsheet.md @@ -48,7 +48,7 @@ chai.add(chaiscript::fun(&function_with_ove ```cpp chai.add(chaiscript::fun(static_cast(&function_with_overloads)), "function_name"); ``` -This overload technique is also used when exposing base member using derived type +This overload technique is also used when exposing base members using derived type ```cpp struct Base @@ -90,7 +90,7 @@ chai.add(chaiscript::user_type(), "MyClass"); ## Adding Type Conversions -User defined type conversions are possible, defined in either script or in C++. +User-defined type conversions are possible, defined in either script or in C++. @@ -111,7 +111,7 @@ Invoking a C++ type conversion possible with `static_cast` chai.add(chaiscript::type_conversion()); ``` -Calling a user defined type conversion that takes a lambda +Calling a user-defined type conversion that takes a lambda ```cpp chai.add(chaiscript::type_conversion([](const TestBaseType &t_bt) { /* return converted thing */ })); @@ -183,7 +183,7 @@ print(math.pi) // prints 3.14159 ``` # Using STL -ChaiScript recognize many types from STL, but you have to add specific instantiation yourself. +ChaiScript recognizes many types from STL, but you have to add specific instantiation yourself. ```cpp typedef std::vector> data_list; @@ -286,7 +286,7 @@ try { } catch (float) { } catch (const std::string &) { } catch (const std::exception &e) { - // This is the one what will be called in the specific throw() above + // This is the one that will be called in the specific throw() above } ``` @@ -388,9 +388,9 @@ switch (myvalue) { } ``` -## Built in Types +## Built-in Types -There are a number of build-in types that are part of ChaiScript. +There are a number of built-in types that are part of ChaiScript. ### Vectors and Maps @@ -427,7 +427,7 @@ on your platform. ## Functions Note that any type of ChaiScript function can be passed freely to C++ and automatically -converted into an `std::function` object. +converted into a `std::function` object. ### General @@ -580,7 +580,7 @@ If both a 2 parameter and a 3 parameter signature match, the 3 parameter functio * `__FUNC__` Name of current function -# Built In Functions +# Built-in Functions ## Evaluation From 681104b68fb85e041bf43336877bd9a4f96488a0 Mon Sep 17 00:00:00 2001 From: Clemens Terasa Date: Wed, 19 Feb 2025 19:13:18 +0100 Subject: [PATCH 06/63] dispatchkit: boxed_value: Fix noexcept warning for Data ctor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using gcc 13.3.0 I get many warnings like the following: ``` In file included from .../include/c++/13.3.0/bits/stl_iterator.h:85, from .../include/c++/13.3.0/bits/stl_algobase.h:67, from .../include/c++/13.3.0/bits/stl_tree.h:63, from .../include/c++/13.3.0/map:62, from .../ChaiScript/static_libs/../include/chaiscript/chaiscript_stdlib.hpp:10, from .../ChaiScript/static_libs/chaiscript_stdlib.cpp:1: .../include/c++/13.3.0/bits/stl_construct.h: In instantiation of ‘constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = chaiscript::Boxed_Value::Data; _Args = {chaiscript::Type_Info, chaiscript::detail::Any, bool, std::nullptr_t, bool&}; decltype (::new(void*(0)) _Tp) = chaiscript::Boxed_Value::Data*]’: .../include/c++/13.3.0/bits/stl_construct.h:115:21: required from ‘constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp = chaiscript::Boxed_Value::Data; _Args = {chaiscript::Type_Info, chaiscript::detail::Any, bool, std::nullptr_t, bool&}]’ .../include/c++/13.3.0/bits/alloc_traits.h:661:19: required from ‘static constexpr void std::allocator_traits >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = chaiscript::Boxed_Value::Data; _Args = {chaiscript::Type_Info, chaiscript::detail::Any, bool, std::nullptr_t, bool&}; allocator_type = std::allocator]’ .../include/c++/13.3.0/bits/shared_ptr_base.h:604:39: required from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {chaiscript::Type_Info, chaiscript::detail::Any, bool, std::nullptr_t, bool&}; _Tp = chaiscript::Boxed_Value::Data; _Alloc = std::allocator; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ .../include/c++/13.3.0/bits/shared_ptr_base.h:971:16: required from ‘std::__shared_count<_Lp>::__shared_count(_Tp*&, std::_Sp_alloc_shared_tag<_Alloc>, _Args&& ...) [with _Tp = chaiscript::Boxed_Value::Data; _Alloc = std::allocator; _Args = {chaiscript::Type_Info, chaiscript::detail::Any, bool, std::nullptr_t, bool&}; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ .../include/c++/13.3.0/bits/shared_ptr_base.h:1712:14: required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator; _Args = {chaiscript::Type_Info, chaiscript::detail::Any, bool, std::nullptr_t, bool&}; _Tp = chaiscript::Boxed_Value::Data; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ .../include/c++/13.3.0/bits/shared_ptr.h:464:59: required from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator; _Args = {chaiscript::Type_Info, chaiscript::detail::Any, bool, std::nullptr_t, bool&}; _Tp = chaiscript::Boxed_Value::Data]’ .../include/c++/13.3.0/bits/shared_ptr.h:1009:14: required from ‘std::shared_ptr > std::make_shared(_Args&& ...) [with _Tp = chaiscript::Boxed_Value::Data; _Args = {chaiscript::Type_Info, chaiscript::detail::Any, bool, std::nullptr_t, bool&}; _NonArray<_Tp> = chaiscript::Boxed_Value::Data]’ .../ChaiScript/static_libs/../include/chaiscript/language/../dispatchkit/boxed_value.hpp:74:38: required from here .../include/c++/13.3.0/bits/stl_construct.h:95:14: warning: noexcept-expression evaluates to ‘false’ because of a call to ‘chaiscript::Boxed_Value::Data::Data(const chaiscript::Type_Info&, chaiscript::detail::Any, bool, const void*, bool)’ [-Wnoexcept] 95 | noexcept(noexcept(::new((void*)0) _Tp(std::declval<_Args>()...))) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from .../ChaiScript/static_libs/../include/chaiscript/language/chaiscript_common.hpp:21, from .../ChaiScript/static_libs/../include/chaiscript/chaiscript_stdlib.hpp:17: .../ChaiScript/static_libs/../include/chaiscript/language/../dispatchkit/boxed_value.hpp:34:7: note: but ‘chaiscript::Boxed_Value::Data::Data(const chaiscript::Type_Info&, chaiscript::detail::Any, bool, const void*, bool)’ does not throw; perhaps it should be declared ‘noexcept’ 34 | Data(const Type_Info &ti, chaiscript::detail::Any to, bool is_ref, const void *t_void_ptr, bool t_return_value) | ^~~~ / ``` Fix this by adding a noexcept like the warning suggests. --- include/chaiscript/dispatchkit/boxed_value.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/chaiscript/dispatchkit/boxed_value.hpp b/include/chaiscript/dispatchkit/boxed_value.hpp index 06941b2f..930f8766 100644 --- a/include/chaiscript/dispatchkit/boxed_value.hpp +++ b/include/chaiscript/dispatchkit/boxed_value.hpp @@ -31,7 +31,7 @@ namespace chaiscript { /// structure which holds the internal state of a Boxed_Value /// \todo Get rid of Any and merge it with this, reducing an allocation in the process struct Data { - Data(const Type_Info &ti, chaiscript::detail::Any to, bool is_ref, const void *t_void_ptr, bool t_return_value) + Data(const Type_Info &ti, chaiscript::detail::Any to, bool is_ref, const void *t_void_ptr, bool t_return_value) noexcept : m_type_info(ti) , m_obj(std::move(to)) , m_data_ptr(ti.is_const() ? nullptr : const_cast(t_void_ptr)) From 43dc35c3dfb82dd95b55300270c102ad45e8fbce Mon Sep 17 00:00:00 2001 From: Clemens Terasa Date: Wed, 19 Feb 2025 19:33:28 +0100 Subject: [PATCH 07/63] test_module: Fix noexcept warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With gcc 13.3.0 an `-Wnoexcept` I warnings like the following: ``` In file included from .../include/c++/13.3.0/bits/char_traits.h:57, from .../include/c++/13.3.0/string_view:40, from .../ChaiScript/include/chaiscript/chaiscript_defines.hpp:23, from .../ChaiScript/include/chaiscript/chaiscript_basic.hpp:10, from .../ChaiScript/src/test_module.cpp:2: .../include/c++/13.3.0/bits/stl_construct.h: In instantiation of ‘constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = Type2; _Args = {Type2}; decltype (::new(void*(0)) _Tp) = Type2*]’: .../include/c++/13.3.0/bits/stl_construct.h:115:21: required from ‘constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp = Type2; _Args = {Type2}]’ .../include/c++/13.3.0/bits/alloc_traits.h:661:19: required from ‘static constexpr void std::allocator_traits >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = Type2; _Args = {Type2}; allocator_type = std::allocator]’ .../include/c++/13.3.0/bits/shared_ptr_base.h:604:39: required from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {Type2}; _Tp = Type2; _Alloc = std::allocator; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ .../include/c++/13.3.0/bits/shared_ptr_base.h:971:16: required from ‘std::__shared_count<_Lp>::__shared_count(_Tp*&, std::_Sp_alloc_shared_tag<_Alloc>, _Args&& ...) [with _Tp = Type2; _Alloc = std::allocator; _Args = {Type2}; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ .../include/c++/13.3.0/bits/shared_ptr_base.h:1712:14: required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator; _Args = {Type2}; _Tp = Type2; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ .../include/c++/13.3.0/bits/shared_ptr.h:464:59: required from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator; _Args = {Type2}; _Tp = Type2]’ .../include/c++/13.3.0/bits/shared_ptr.h:1009:14: required from ‘std::shared_ptr > std::make_shared(_Args&& ...) [with _Tp = Type2; _Args = {Type2}; _NonArray<_Tp> = Type2]’ .../ChaiScript/include/chaiscript/dispatchkit/boxed_value.hpp:121:37: required from ‘static auto chaiscript::Boxed_Value::Object_Data::get(T, bool) [with T = Type2]’ .../ChaiScript/include/chaiscript/dispatchkit/boxed_value.hpp:133:34: required from ‘chaiscript::Boxed_Value::Boxed_Value(T&&, bool) [with T = Type2; = void]’ .../ChaiScript/include/chaiscript/dispatchkit/type_conversions.hpp:480:26: required from ‘chaiscript::Type_Conversion chaiscript::type_conversion(const Callable&) [with From = TestBaseType; To = Type2; Callable = create_chaiscript_module_test_module()::; Type_Conversion = std::shared_ptr]’ .../ChaiScript/src/test_module.cpp:194:58: required from here .../include/c++/13.3.0/bits/stl_construct.h:95:14: warning: noexcept-expression evaluates to ‘false’ because of a call to ‘Type2::Type2(Type2&&)’ [-Wnoexcept] 95 | noexcept(noexcept(::new((void*)0) _Tp(std::declval<_Args>()...))) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .../ChaiScript/src/test_module.cpp:60:7: note: but ‘Type2::Type2(Type2&&)’ does not throw; perhaps it should be declared ‘noexcept’ 60 | class Type2 { | ^~~~~ ``` Fix this by introducing `noexcept` like proposed in the warning. --- src/test_module.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test_module.cpp b/src/test_module.cpp index 6568b9b2..5da2d389 100644 --- a/src/test_module.cpp +++ b/src/test_module.cpp @@ -5,30 +5,30 @@ class TestBaseType { public: - TestBaseType() + TestBaseType() noexcept : val(10) , const_val(15) , mdarray{} { } - TestBaseType(int) + TestBaseType(int) noexcept : val(10) , const_val(15) , mdarray{} { } - TestBaseType(int *) + TestBaseType(int *) noexcept : val(10) , const_val(15) , mdarray{} { } - TestBaseType(const TestBaseType &other) + TestBaseType(const TestBaseType &other) noexcept : val(other.val) , const_val(other.const_val) , const_val_ptr(&const_val) , func_member(other.func_member) { } - TestBaseType(TestBaseType &&other) + TestBaseType(TestBaseType &&other) noexcept : val(other.val) , const_val(other.const_val) , const_val_ptr(&const_val) @@ -59,7 +59,7 @@ class TestBaseType { class Type2 { public: - Type2(TestBaseType t_bt) + Type2(TestBaseType t_bt) noexcept : m_bt(std::move(t_bt)) , m_str("Hello World") { } From b44b987d4b930c513754f7e81380b6da8a72c550 Mon Sep 17 00:00:00 2001 From: Clemens Terasa Date: Wed, 19 Feb 2025 19:46:29 +0100 Subject: [PATCH 08/63] chaiscript_eval: Fix warning by replacing lambda with ternary operator expression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using GCC 13.3.0 I get warnings like the following: ``` In file included from .../ChaiScript/static_libs/../include/chaiscript/language/chaiscript_optimizer.hpp:10, from .../ChaiScript/static_libs/../include/chaiscript/language/chaiscript_parser.hpp:26, from .../ChaiScript/static_libs/chaiscript_parser.cpp:1: .../ChaiScript/static_libs/../include/chaiscript/language/chaiscript_eval.hpp: In instantiation of ‘chaiscript::Boxed_Value chaiscript::eval::Global_Decl_AST_Node::eval_internal(const chaiscript::detail::Dispatch_State&) const [with T = chaiscript::eval::Tracer]’: .../ChaiScript/static_libs/../include/chaiscript/language/chaiscript_eval.hpp:503:19: required from here .../ChaiScript/static_libs/../include/chaiscript/language/chaiscript_eval.hpp:504:28: warning: possibly dangling reference to a temporary [-Wdangling-reference] 504 | const std::string &idname = [&]() -> const std::string & { | ^~~~~~ .../ChaiScript/static_libs/../include/chaiscript/language/chaiscript_eval.hpp:510:10: note: the temporary was destroyed at the end of the full expression ‘chaiscript::eval::Global_Decl_AST_Node >::eval_internal(const chaiscript::detail::Dispatch_State&) const::{((const chaiscript::eval::Global_Decl_AST_Node >*)this)}.chaiscript::eval::Global_Decl_AST_Node >::eval_internal(const chaiscript::detail::Dispatch_State&) const::()’ 504 | const std::string &idname = [&]() -> const std::string & { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 505 | if (this->children[0]->identifier == AST_Node_Type::Reference) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 506 | return this->children[0]->children[0]->text; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | } else { | ~~~~~~~~ 508 | return this->children[0]->text; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 509 | } | ~ 510 | }(); | ~^~ ``` Fix this by replacing the lambda with a simple ternary operator expression. --- include/chaiscript/language/chaiscript_eval.hpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/include/chaiscript/language/chaiscript_eval.hpp b/include/chaiscript/language/chaiscript_eval.hpp index 4997d667..cd171b36 100644 --- a/include/chaiscript/language/chaiscript_eval.hpp +++ b/include/chaiscript/language/chaiscript_eval.hpp @@ -501,13 +501,7 @@ namespace chaiscript { } Boxed_Value eval_internal(const chaiscript::detail::Dispatch_State &t_ss) const override { - const std::string &idname = [&]() -> const std::string & { - if (this->children[0]->identifier == AST_Node_Type::Reference) { - return this->children[0]->children[0]->text; - } else { - return this->children[0]->text; - } - }(); + const std::string &idname = (this->children[0]->identifier == AST_Node_Type::Reference) ? this->children[0]->children[0]->text : this->children[0]->text; return t_ss->add_global_no_throw(Boxed_Value(), idname); } From 2951ce4a7a14e7aa07d53c19d56bea33bd7b8128 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Mon, 28 Jul 2025 09:33:41 -0400 Subject: [PATCH 09/63] Update catch.hpp to v2.13.9 Fixes #619 --- unittests/catch.hpp | 25664 +++++++++++++++++++++--------------------- 1 file changed, 12780 insertions(+), 12884 deletions(-) diff --git a/unittests/catch.hpp b/unittests/catch.hpp index 2e78ece8..07efa655 100644 --- a/unittests/catch.hpp +++ b/unittests/catch.hpp @@ -1,9 +1,9 @@ /* - * Catch v2.13.6 - * Generated: 2021-04-16 18:23:38.044268 + * Catch v2.13.9 + * Generated: 2022-04-12 22:37:23.260201 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly - * Copyright (c) 2021 Two Blue Cubes Ltd. All rights reserved. + * Copyright (c) 2022 Two Blue Cubes Ltd. All rights reserved. * * 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) @@ -12,54 +12,55 @@ #define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED // start catch.hpp + #define CATCH_VERSION_MAJOR 2 #define CATCH_VERSION_MINOR 13 -#define CATCH_VERSION_PATCH 6 +#define CATCH_VERSION_PATCH 9 #ifdef __clang__ -#pragma clang system_header +# pragma clang system_header #elif defined __GNUC__ -#pragma GCC system_header +# pragma GCC system_header #endif // start catch_suppress_warnings.h #ifdef __clang__ -#ifdef __ICC // icpc defines the __clang__ macro -#pragma warning(push) -#pragma warning(disable : 161 1682) -#else // __ICC -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#pragma clang diagnostic ignored "-Wswitch-enum" -#pragma clang diagnostic ignored "-Wcovered-switch-default" -#endif +# ifdef __ICC // icpc defines the __clang__ macro +# pragma warning(push) +# pragma warning(disable: 161 1682) +# else // __ICC +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +# pragma clang diagnostic ignored "-Wswitch-enum" +# pragma clang diagnostic ignored "-Wcovered-switch-default" +# endif #elif defined __GNUC__ -// Because REQUIREs trigger GCC's -Wparentheses, and because still -// supported version of g++ have only buggy support for _Pragmas, -// Wparentheses have to be suppressed globally. -#pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wpadded" + // Because REQUIREs trigger GCC's -Wparentheses, and because still + // supported version of g++ have only buggy support for _Pragmas, + // Wparentheses have to be suppressed globally. +# pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details + +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-variable" +# pragma GCC diagnostic ignored "-Wpadded" #endif // end catch_suppress_warnings.h #if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) -#define CATCH_IMPL -#define CATCH_CONFIG_ALL_PARTS +# define CATCH_IMPL +# define CATCH_CONFIG_ALL_PARTS #endif // In the impl file, we want to have access to all parts of the headers // Can also be used to sanely support PCHs #if defined(CATCH_CONFIG_ALL_PARTS) -#define CATCH_CONFIG_EXTERNAL_INTERFACES -#if defined(CATCH_CONFIG_DISABLE_MATCHERS) -#undef CATCH_CONFIG_DISABLE_MATCHERS -#endif -#if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) -#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER -#endif +# define CATCH_CONFIG_EXTERNAL_INTERFACES +# if defined(CATCH_CONFIG_DISABLE_MATCHERS) +# undef CATCH_CONFIG_DISABLE_MATCHERS +# endif +# if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) +# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER +# endif #endif #if !defined(CATCH_CONFIG_IMPL_ONLY) @@ -68,33 +69,34 @@ // See e.g.: // https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html #ifdef __APPLE__ -#include -#if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1) -#define CATCH_PLATFORM_MAC -#elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1) -#define CATCH_PLATFORM_IPHONE -#endif +# include +# if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || \ + (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1) +# define CATCH_PLATFORM_MAC +# elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1) +# define CATCH_PLATFORM_IPHONE +# endif #elif defined(linux) || defined(__linux) || defined(__linux__) -#define CATCH_PLATFORM_LINUX +# define CATCH_PLATFORM_LINUX #elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) -#define CATCH_PLATFORM_WINDOWS +# define CATCH_PLATFORM_WINDOWS #endif // end catch_platform.h #ifdef CATCH_IMPL -#ifndef CLARA_CONFIG_MAIN -#define CLARA_CONFIG_MAIN_NOT_DEFINED -#define CLARA_CONFIG_MAIN -#endif +# ifndef CLARA_CONFIG_MAIN +# define CLARA_CONFIG_MAIN_NOT_DEFINED +# define CLARA_CONFIG_MAIN +# endif #endif // start catch_user_interfaces.h namespace Catch { - unsigned int rngSeed(); + unsigned int rngSeed(); } // end catch_user_interfaces.h @@ -123,30 +125,30 @@ namespace Catch { #ifdef __cplusplus -#if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) -#define CATCH_CPP14_OR_GREATER -#endif +# if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) +# define CATCH_CPP14_OR_GREATER +# endif -#if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) -#define CATCH_CPP17_OR_GREATER -#endif +# if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) +# define CATCH_CPP17_OR_GREATER +# endif #endif // Only GCC compiler should be used in this block, so other compilers trying to // mask themselves as GCC should be ignored. #if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__) -#define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma("GCC diagnostic push") -#define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma("GCC diagnostic pop") +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" ) -#define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) #endif #if defined(__clang__) -#define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma("clang diagnostic push") -#define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma("clang diagnostic pop") +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic push" ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic pop" ) // As of this writing, IBM XL's implementation of __builtin_constant_p has a bug // which results in calls to destructors being emitted for each temporary, @@ -159,58 +161,62 @@ namespace Catch { // ``` // // Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented. -#if !defined(__ibmxl__) && !defined(__CUDACC__) -#define CATCH_INTERNAL_IGNORE_BUT_WARN(...) \ - (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */ -#endif +# if !defined(__ibmxl__) && !defined(__CUDACC__) +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */ +# endif -#define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - _Pragma("clang diagnostic ignored \"-Wexit-time-destructors\"") _Pragma("clang diagnostic ignored \"-Wglobal-constructors\"") +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ + _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") -#define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS _Pragma("clang diagnostic ignored \"-Wparentheses\"") +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) -#define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS _Pragma("clang diagnostic ignored \"-Wunused-variable\"") +# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" ) -#define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS _Pragma("clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"") +# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" ) -#define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS _Pragma("clang diagnostic ignored \"-Wunused-template\"") +# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wunused-template\"" ) #endif // __clang__ //////////////////////////////////////////////////////////////////////////////// // Assume that non-Windows platforms support posix signals by default #if !defined(CATCH_PLATFORM_WINDOWS) -#define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS + #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS #endif //////////////////////////////////////////////////////////////////////////////// // We know some environments not to support full POSIX signals #if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) -#define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS + #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS #endif #ifdef __OS400__ -#define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS -#define CATCH_CONFIG_COLOUR_NONE +# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +# define CATCH_CONFIG_COLOUR_NONE #endif //////////////////////////////////////////////////////////////////////////////// // Android somehow still does not support std::to_string #if defined(__ANDROID__) -#define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING -#define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE +# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING +# define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE #endif //////////////////////////////////////////////////////////////////////////////// // Not all Windows environments support SEH properly #if defined(__MINGW32__) -#define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH +# define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH #endif //////////////////////////////////////////////////////////////////////////////// // PS4 #if defined(__ORBIS__) -#define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE +# define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE #endif //////////////////////////////////////////////////////////////////////////////// @@ -219,63 +225,66 @@ namespace Catch { // Required for some versions of Cygwin to declare gettimeofday // see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin -#define _BSD_SOURCE +# define _BSD_SOURCE // some versions of cygwin (most) do not support std::to_string. Use the libstd check. // https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813 -#if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) +# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ + && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) -#define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING +# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING -#endif +# endif #endif // __CYGWIN__ //////////////////////////////////////////////////////////////////////////////// // Visual C++ #if defined(_MSC_VER) -#define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma(warning(push)) -#define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma(warning(pop)) - // Universal Windows platform does not support SEH // Or console colours (or console at all...) -#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) -#define CATCH_CONFIG_COLOUR_NONE -#else -#define CATCH_INTERNAL_CONFIG_WINDOWS_SEH -#endif +# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) +# define CATCH_CONFIG_COLOUR_NONE +# else +# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH +# endif + +# if !defined(__clang__) // Handle Clang masquerading for msvc // MSVC traditional preprocessor needs some workaround for __VA_ARGS__ // _MSVC_TRADITIONAL == 0 means new conformant preprocessor // _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor -#if !defined(__clang__) // Handle Clang masquerading for msvc -#if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) -#define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#endif // MSVC_TRADITIONAL -#endif // __clang__ +# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) +# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +# endif // MSVC_TRADITIONAL + +// Only do this if we're not using clang on Windows, which uses `diagnostic push` & `diagnostic pop` +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) ) +# endif // __clang__ #endif // _MSC_VER #if defined(_REENTRANT) || defined(_MSC_VER) // Enable async processing, as -pthread is specified or no additional linking is required -#define CATCH_INTERNAL_CONFIG_USE_ASYNC +# define CATCH_INTERNAL_CONFIG_USE_ASYNC #endif // _MSC_VER //////////////////////////////////////////////////////////////////////////////// // Check if we are compiled with -fno-exceptions or equivalent #if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND) -#define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED +# define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED #endif //////////////////////////////////////////////////////////////////////////////// // DJGPP #ifdef __DJGPP__ -#define CATCH_INTERNAL_CONFIG_NO_WCHAR +# define CATCH_INTERNAL_CONFIG_NO_WCHAR #endif // __DJGPP__ //////////////////////////////////////////////////////////////////////////////// // Embarcadero C++Build #if defined(__BORLANDC__) -#define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN + #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN #endif //////////////////////////////////////////////////////////////////////////////// @@ -285,8 +294,8 @@ namespace Catch { // handled by it. // Otherwise all supported compilers support COUNTER macro, // but user still might want to turn it off -#if (!defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L) -#define CATCH_INTERNAL_CONFIG_COUNTER +#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L ) + #define CATCH_INTERNAL_CONFIG_COUNTER #endif //////////////////////////////////////////////////////////////////////////////// @@ -295,9 +304,9 @@ namespace Catch { // This means that it is detected as Windows, but does not provide // the same set of capabilities as real Windows does. #if defined(UNDER_RTSS) || defined(RTX64_BUILD) -#define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH -#define CATCH_INTERNAL_CONFIG_NO_ASYNC -#define CATCH_CONFIG_COLOUR_NONE + #define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH + #define CATCH_INTERNAL_CONFIG_NO_ASYNC + #define CATCH_CONFIG_COLOUR_NONE #endif #if !defined(_GLIBCXX_USE_C99_MATH_TR1) @@ -306,147 +315,139 @@ namespace Catch { // Various stdlib support checks that require __has_include #if defined(__has_include) -// Check if string_view is available and usable -#if __has_include() && defined(CATCH_CPP17_OR_GREATER) -#define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW -#endif - -// Check if optional is available and usable -#if __has_include() && defined(CATCH_CPP17_OR_GREATER) -#define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL -#endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) - -// Check if byte is available and usable -#if __has_include() && defined(CATCH_CPP17_OR_GREATER) -#include -#if __cpp_lib_byte > 0 -#define CATCH_INTERNAL_CONFIG_CPP17_BYTE -#endif -#endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) - -// Check if variant is available and usable -#if __has_include() && defined(CATCH_CPP17_OR_GREATER) -#if defined(__clang__) && (__clang_major__ < 8) -// work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 -// fix should be in clang 8, workaround in libstdc++ 8.2 -#include -#if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) -#define CATCH_CONFIG_NO_CPP17_VARIANT -#else -#define CATCH_INTERNAL_CONFIG_CPP17_VARIANT -#endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) -#else -#define CATCH_INTERNAL_CONFIG_CPP17_VARIANT -#endif // defined(__clang__) && (__clang_major__ < 8) -#endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) + // Check if string_view is available and usable + #if __has_include() && defined(CATCH_CPP17_OR_GREATER) + # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW + #endif + + // Check if optional is available and usable + # if __has_include() && defined(CATCH_CPP17_OR_GREATER) + # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL + # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) + + // Check if byte is available and usable + # if __has_include() && defined(CATCH_CPP17_OR_GREATER) + # include + # if defined(__cpp_lib_byte) && (__cpp_lib_byte > 0) + # define CATCH_INTERNAL_CONFIG_CPP17_BYTE + # endif + # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) + + // Check if variant is available and usable + # if __has_include() && defined(CATCH_CPP17_OR_GREATER) + # if defined(__clang__) && (__clang_major__ < 8) + // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 + // fix should be in clang 8, workaround in libstdc++ 8.2 + # include + # if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) + # define CATCH_CONFIG_NO_CPP17_VARIANT + # else + # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT + # endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) + # else + # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT + # endif // defined(__clang__) && (__clang_major__ < 8) + # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) #endif // defined(__has_include) #if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) -#define CATCH_CONFIG_COUNTER +# define CATCH_CONFIG_COUNTER #endif -#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) \ - && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH) -#define CATCH_CONFIG_WINDOWS_SEH +#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH) +# define CATCH_CONFIG_WINDOWS_SEH #endif // This is set by default, because we assume that unix compilers are posix-signal-compatible by default. -#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) \ - && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) -#define CATCH_CONFIG_POSIX_SIGNALS +#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) +# define CATCH_CONFIG_POSIX_SIGNALS #endif // This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions. #if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR) -#define CATCH_CONFIG_WCHAR +# define CATCH_CONFIG_WCHAR #endif -#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) \ - && !defined(CATCH_CONFIG_CPP11_TO_STRING) -#define CATCH_CONFIG_CPP11_TO_STRING +#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) +# define CATCH_CONFIG_CPP11_TO_STRING #endif #if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL) -#define CATCH_CONFIG_CPP17_OPTIONAL +# define CATCH_CONFIG_CPP17_OPTIONAL #endif -#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) \ - && !defined(CATCH_CONFIG_CPP17_STRING_VIEW) -#define CATCH_CONFIG_CPP17_STRING_VIEW +#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW) +# define CATCH_CONFIG_CPP17_STRING_VIEW #endif #if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT) -#define CATCH_CONFIG_CPP17_VARIANT +# define CATCH_CONFIG_CPP17_VARIANT #endif #if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE) -#define CATCH_CONFIG_CPP17_BYTE +# define CATCH_CONFIG_CPP17_BYTE #endif #if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) -#define CATCH_INTERNAL_CONFIG_NEW_CAPTURE +# define CATCH_INTERNAL_CONFIG_NEW_CAPTURE #endif -#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) \ - && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE) -#define CATCH_CONFIG_NEW_CAPTURE +#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE) +# define CATCH_CONFIG_NEW_CAPTURE #endif #if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -#define CATCH_CONFIG_DISABLE_EXCEPTIONS +# define CATCH_CONFIG_DISABLE_EXCEPTIONS #endif #if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN) -#define CATCH_CONFIG_POLYFILL_ISNAN +# define CATCH_CONFIG_POLYFILL_ISNAN #endif -#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) \ - && !defined(CATCH_CONFIG_USE_ASYNC) -#define CATCH_CONFIG_USE_ASYNC +#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC) +# define CATCH_CONFIG_USE_ASYNC #endif -#if defined(CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_NO_ANDROID_LOGWRITE) \ - && !defined(CATCH_CONFIG_ANDROID_LOGWRITE) -#define CATCH_CONFIG_ANDROID_LOGWRITE +#if defined(CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_NO_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_ANDROID_LOGWRITE) +# define CATCH_CONFIG_ANDROID_LOGWRITE #endif -#if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) \ - && !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) -#define CATCH_CONFIG_GLOBAL_NEXTAFTER +#if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) +# define CATCH_CONFIG_GLOBAL_NEXTAFTER #endif // Even if we do not think the compiler has that warning, we still have // to provide a macro that can be used by the code. #if !defined(CATCH_INTERNAL_START_WARNINGS_SUPPRESSION) -#define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION #endif #if !defined(CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION) -#define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION #endif #if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) -#define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) -#define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS) -#define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS +# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS) -#define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS +# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS #endif // The goal of this macro is to avoid evaluation of the arguments, but // still have the compiler warn on problems inside... #if !defined(CATCH_INTERNAL_IGNORE_BUT_WARN) -#define CATCH_INTERNAL_IGNORE_BUT_WARN(...) +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) #endif #if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10) -#undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS #elif defined(__clang__) && (__clang_major__ < 5) -#undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS) -#define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS #endif #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) @@ -459,105 +460,103 @@ namespace Catch { #define CATCH_CATCH_ANON(type) catch (type) #endif -#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) \ - && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) +#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) #define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR #endif // end catch_compiler_capabilities.h -#define INTERNAL_CATCH_UNIQUE_NAME_LINE2(name, line) name##line -#define INTERNAL_CATCH_UNIQUE_NAME_LINE(name, line) INTERNAL_CATCH_UNIQUE_NAME_LINE2(name, line) +#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line +#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) #ifdef CATCH_CONFIG_COUNTER -#define INTERNAL_CATCH_UNIQUE_NAME(name) INTERNAL_CATCH_UNIQUE_NAME_LINE(name, __COUNTER__) +# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ ) #else -#define INTERNAL_CATCH_UNIQUE_NAME(name) INTERNAL_CATCH_UNIQUE_NAME_LINE(name, __LINE__) +# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) #endif -#include #include #include +#include // We need a dummy global operator<< so we can bring it into Catch namespace later -struct Catch_global_namespace_dummy { -}; -std::ostream &operator<<(std::ostream &, Catch_global_namespace_dummy); +struct Catch_global_namespace_dummy {}; +std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); namespace Catch { - struct CaseSensitive { - enum Choice { - Yes, - No + + struct CaseSensitive { enum Choice { + Yes, + No + }; }; + + class NonCopyable { + NonCopyable( NonCopyable const& ) = delete; + NonCopyable( NonCopyable && ) = delete; + NonCopyable& operator = ( NonCopyable const& ) = delete; + NonCopyable& operator = ( NonCopyable && ) = delete; + + protected: + NonCopyable(); + virtual ~NonCopyable(); }; - }; - - class NonCopyable { - NonCopyable(NonCopyable const &) = delete; - NonCopyable(NonCopyable &&) = delete; - NonCopyable &operator=(NonCopyable const &) = delete; - NonCopyable &operator=(NonCopyable &&) = delete; - - protected: - NonCopyable(); - virtual ~NonCopyable(); - }; - - struct SourceLineInfo { - SourceLineInfo() = delete; - SourceLineInfo(char const *_file, std::size_t _line) noexcept - : file(_file) - , line(_line) { - } - - SourceLineInfo(SourceLineInfo const &other) = default; - SourceLineInfo &operator=(SourceLineInfo const &) = default; - SourceLineInfo(SourceLineInfo &&) noexcept = default; - SourceLineInfo &operator=(SourceLineInfo &&) noexcept = default; - - bool empty() const noexcept { return file[0] == '\0'; } - bool operator==(SourceLineInfo const &other) const noexcept; - bool operator<(SourceLineInfo const &other) const noexcept; - - char const *file; - std::size_t line; - }; - - std::ostream &operator<<(std::ostream &os, SourceLineInfo const &info); - - // Bring in operator<< from global namespace into Catch namespace - // This is necessary because the overload of operator<< above makes - // lookup stop at namespace Catch - using ::operator<<; - - // Use this in variadic streaming macros to allow - // >> +StreamEndStop - // as well as - // >> stuff +StreamEndStop - struct StreamEndStop { - std::string operator+() const; - }; - template - T const &operator+(T const &value, StreamEndStop) { - return value; - } -} // namespace Catch -#define CATCH_INTERNAL_LINEINFO ::Catch::SourceLineInfo(__FILE__, static_cast(__LINE__)) + struct SourceLineInfo { + + SourceLineInfo() = delete; + SourceLineInfo( char const* _file, std::size_t _line ) noexcept + : file( _file ), + line( _line ) + {} + + SourceLineInfo( SourceLineInfo const& other ) = default; + SourceLineInfo& operator = ( SourceLineInfo const& ) = default; + SourceLineInfo( SourceLineInfo&& ) noexcept = default; + SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default; + + bool empty() const noexcept { return file[0] == '\0'; } + bool operator == ( SourceLineInfo const& other ) const noexcept; + bool operator < ( SourceLineInfo const& other ) const noexcept; + + char const* file; + std::size_t line; + }; + + std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); + + // Bring in operator<< from global namespace into Catch namespace + // This is necessary because the overload of operator<< above makes + // lookup stop at namespace Catch + using ::operator<<; + + // Use this in variadic streaming macros to allow + // >> +StreamEndStop + // as well as + // >> stuff +StreamEndStop + struct StreamEndStop { + std::string operator+() const; + }; + template + T const& operator + ( T const& value, StreamEndStop ) { + return value; + } +} + +#define CATCH_INTERNAL_LINEINFO \ + ::Catch::SourceLineInfo( __FILE__, static_cast( __LINE__ ) ) // end catch_common.h namespace Catch { - struct RegistrarForTagAliases { - RegistrarForTagAliases(char const *alias, char const *tag, SourceLineInfo const &lineInfo); - }; + + struct RegistrarForTagAliases { + RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); + }; } // end namespace Catch -#define CATCH_REGISTER_TAG_ALIAS(alias, spec) \ - CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - namespace { \ - Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME(AutoRegisterTagAlias)(alias, spec, CATCH_INTERNAL_LINEINFO); \ - } \ - CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION // end catch_tag_alias_autoregistrar.h // start catch_test_registry.h @@ -567,117 +566,130 @@ namespace Catch { #include namespace Catch { - class TestSpec; - struct ITestInvoker { - virtual void invoke() const = 0; - virtual ~ITestInvoker(); - }; + class TestSpec; - class TestCase; - struct IConfig; + struct ITestInvoker { + virtual void invoke () const = 0; + virtual ~ITestInvoker(); + }; - struct ITestCaseRegistry { - virtual ~ITestCaseRegistry(); - virtual std::vector const &getAllTests() const = 0; - virtual std::vector const &getAllTestsSorted(IConfig const &config) const = 0; - }; + class TestCase; + struct IConfig; - bool isThrowSafe(TestCase const &testCase, IConfig const &config); - bool matchTest(TestCase const &testCase, TestSpec const &testSpec, IConfig const &config); - std::vector filterTests(std::vector const &testCases, TestSpec const &testSpec, IConfig const &config); - std::vector const &getAllTestCasesSorted(IConfig const &config); + struct ITestCaseRegistry { + virtual ~ITestCaseRegistry(); + virtual std::vector const& getAllTests() const = 0; + virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0; + }; -} // namespace Catch + bool isThrowSafe( TestCase const& testCase, IConfig const& config ); + bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); + std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); + std::vector const& getAllTestCasesSorted( IConfig const& config ); + +} // end catch_interfaces_testcase.h // start catch_stringref.h -#include #include -#include #include +#include +#include namespace Catch { - /// A non-owning string class (similar to the forthcoming std::string_view) - /// Note that, because a StringRef may be a substring of another string, - /// it may not be null terminated. - class StringRef { - public: - using size_type = std::size_t; - using const_iterator = const char *; - private: - static constexpr char const *const s_empty = ""; + /// A non-owning string class (similar to the forthcoming std::string_view) + /// Note that, because a StringRef may be a substring of another string, + /// it may not be null terminated. + class StringRef { + public: + using size_type = std::size_t; + using const_iterator = const char*; + + private: + static constexpr char const* const s_empty = ""; - char const *m_start = s_empty; - size_type m_size = 0; + char const* m_start = s_empty; + size_type m_size = 0; - public: // construction - constexpr StringRef() noexcept = default; + public: // construction + constexpr StringRef() noexcept = default; - StringRef(char const *rawChars) noexcept; + StringRef( char const* rawChars ) noexcept; - constexpr StringRef(char const *rawChars, size_type size) noexcept - : m_start(rawChars) - , m_size(size) { - } + constexpr StringRef( char const* rawChars, size_type size ) noexcept + : m_start( rawChars ), + m_size( size ) + {} - StringRef(std::string const &stdString) noexcept - : m_start(stdString.c_str()) - , m_size(stdString.size()) { - } + StringRef( std::string const& stdString ) noexcept + : m_start( stdString.c_str() ), + m_size( stdString.size() ) + {} - explicit operator std::string() const { return std::string(m_start, m_size); } + explicit operator std::string() const { + return std::string(m_start, m_size); + } - public: // operators - auto operator==(StringRef const &other) const noexcept -> bool; - auto operator!=(StringRef const &other) const noexcept -> bool { return !(*this == other); } + public: // operators + auto operator == ( StringRef const& other ) const noexcept -> bool; + auto operator != (StringRef const& other) const noexcept -> bool { + return !(*this == other); + } - auto operator[](size_type index) const noexcept -> char { - assert(index < m_size); - return m_start[index]; - } + auto operator[] ( size_type index ) const noexcept -> char { + assert(index < m_size); + return m_start[index]; + } - public: // named queries - constexpr auto empty() const noexcept -> bool { return m_size == 0; } - constexpr auto size() const noexcept -> size_type { return m_size; } + public: // named queries + constexpr auto empty() const noexcept -> bool { + return m_size == 0; + } + constexpr auto size() const noexcept -> size_type { + return m_size; + } - // Returns the current start pointer. If the StringRef is not - // null-terminated, throws std::domain_exception - auto c_str() const -> char const *; + // Returns the current start pointer. If the StringRef is not + // null-terminated, throws std::domain_exception + auto c_str() const -> char const*; - public: // substrings and searches - // Returns a substring of [start, start + length). - // If start + length > size(), then the substring is [start, size()). - // If start > size(), then the substring is empty. - auto substr(size_type start, size_type length) const noexcept -> StringRef; + public: // substrings and searches + // Returns a substring of [start, start + length). + // If start + length > size(), then the substring is [start, size()). + // If start > size(), then the substring is empty. + auto substr( size_type start, size_type length ) const noexcept -> StringRef; - // Returns the current start pointer. May not be null-terminated. - auto data() const noexcept -> char const *; + // Returns the current start pointer. May not be null-terminated. + auto data() const noexcept -> char const*; - constexpr auto isNullTerminated() const noexcept -> bool { return m_start[m_size] == '\0'; } + constexpr auto isNullTerminated() const noexcept -> bool { + return m_start[m_size] == '\0'; + } - public: // iterators - constexpr const_iterator begin() const { return m_start; } - constexpr const_iterator end() const { return m_start + m_size; } - }; + public: // iterators + constexpr const_iterator begin() const { return m_start; } + constexpr const_iterator end() const { return m_start + m_size; } + }; - auto operator+=(std::string &lhs, StringRef const &sr) -> std::string &; - auto operator<<(std::ostream &os, StringRef const &sr) -> std::ostream &; + auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&; + auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&; - constexpr auto operator"" _sr(char const *rawChars, std::size_t size) noexcept -> StringRef { - return StringRef(rawChars, size); - } + constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { + return StringRef( rawChars, size ); + } } // namespace Catch -constexpr auto operator"" _catch_sr(char const *rawChars, std::size_t size) noexcept -> Catch::StringRef { - return Catch::StringRef(rawChars, size); +constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { + return Catch::StringRef( rawChars, size ); } // end catch_stringref.h // start catch_preprocessor.hpp + #define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__ #define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__))) #define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__))) @@ -689,9 +701,9 @@ constexpr auto operator"" _catch_sr(char const *rawChars, std::size_t size) noex #define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__ // MSVC needs more evaluations #define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__))) -#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__)) +#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__)) #else -#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__) +#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__) #endif #define CATCH_REC_END(...) @@ -704,21 +716,16 @@ constexpr auto operator"" _catch_sr(char const *rawChars, std::size_t size) noex #define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2 #define CATCH_REC_GET_END(...) CATCH_REC_GET_END1 #define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT -#define CATCH_REC_NEXT1(test, next) \ - CATCH_DEFER(CATCH_REC_NEXT0) \ - (test, next, 0) -#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next) - -#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1))(f, peek, __VA_ARGS__) -#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST0))(f, peek, __VA_ARGS__) -#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1))(f, peek, __VA_ARGS__) - -#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) \ - , f(userdata, x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD))(f, userdata, peek, __VA_ARGS__) -#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) \ - , f(userdata, x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD))(f, userdata, peek, __VA_ARGS__) -#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) \ - f(userdata, x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD))(f, userdata, peek, __VA_ARGS__) +#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0) +#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next) + +#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) + +#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) // Applies the function macro `f` to each of the remaining parameters, inserts commas between the results, // and passes userdata as the first parameter to each invocation, @@ -728,7 +735,7 @@ constexpr auto operator"" _catch_sr(char const *rawChars, std::size_t size) noex #define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) #define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param) -#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO##__VA_ARGS__ +#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__ #define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__ #define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF #define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__) @@ -751,1066 +758,585 @@ constexpr auto operator"" _catch_sr(char const *rawChars, std::size_t size) noex #define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper()) #define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)) #else -#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) \ - INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper())) -#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) \ - INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))) +#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper())) +#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))) #endif -#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...) CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST, __VA_ARGS__) +#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...)\ + CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,__VA_ARGS__) #define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0) #define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1) #define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2) -#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) \ - INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3) -#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) \ - INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4) -#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) \ - INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5) -#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) \ - INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6) -#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) \ - INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7) -#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) \ - INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8) -#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ - INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9) -#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ - INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) +#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3) +#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4) +#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5) +#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6) +#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7) +#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8) +#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9) +#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) #define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N -#define INTERNAL_CATCH_TYPE_GEN \ - template \ - struct TypeList { \ - }; \ - template \ - constexpr auto get_wrapper() noexcept->TypeList { \ - return {}; \ - } \ - template class...> \ - struct TemplateTypeList { \ - }; \ - template class... Cs> \ - constexpr auto get_wrapper() noexcept->TemplateTypeList { \ - return {}; \ - } \ - template \ - struct append; \ - template \ - struct rewrap; \ - template class, typename...> \ - struct create; \ - template class, typename> \ - struct convert; \ - \ - template \ - struct append { \ - using type = T; \ - }; \ - template class L1, typename... E1, template class L2, typename... E2, typename... Rest> \ - struct append, L2, Rest...> { \ - using type = typename append, Rest...>::type; \ - }; \ - template class L1, typename... E1, typename... Rest> \ - struct append, TypeList, Rest...> { \ - using type = L1; \ - }; \ - \ - template class Container, template class List, typename... elems> \ - struct rewrap, List> { \ - using type = TypeList>; \ - }; \ - template class Container, template class List, class... Elems, typename... Elements> \ - struct rewrap, List, Elements...> { \ - using type = typename append>, typename rewrap, Elements...>::type>::type; \ - }; \ - \ - template class Final, template class... Containers, typename... Types> \ - struct create, TypeList> { \ - using type = typename append, typename rewrap, Types...>::type...>::type; \ - }; \ - template class Final, template class List, typename... Ts> \ - struct convert> { \ - using type = typename append, TypeList...>::type; \ - }; - -#define INTERNAL_CATCH_NTTP_1(signature, ...) \ - template \ - struct Nttp { \ - }; \ - template \ - constexpr auto get_wrapper() noexcept->Nttp<__VA_ARGS__> { \ - return {}; \ - } \ - template class...> \ - struct NttpTemplateTypeList { \ - }; \ - template class... Cs> \ - constexpr auto get_wrapper() noexcept->NttpTemplateTypeList { \ - return {}; \ - } \ - \ - template class Container, \ - template \ - class List, \ - INTERNAL_CATCH_REMOVE_PARENS(signature)> \ - struct rewrap, List<__VA_ARGS__>> { \ - using type = TypeList>; \ - }; \ - template class Container, \ - template \ - class List, \ - INTERNAL_CATCH_REMOVE_PARENS(signature), \ - typename... Elements> \ - struct rewrap, List<__VA_ARGS__>, Elements...> { \ - using type = \ - typename append>, typename rewrap, Elements...>::type>::type; \ - }; \ - template class Final, template class... Containers, typename... Types> \ - struct create, TypeList> { \ - using type = typename append, typename rewrap, Types...>::type...>::type; \ - }; +#define INTERNAL_CATCH_TYPE_GEN\ + template struct TypeList {};\ + template\ + constexpr auto get_wrapper() noexcept -> TypeList { return {}; }\ + template class...> struct TemplateTypeList{};\ + template class...Cs>\ + constexpr auto get_wrapper() noexcept -> TemplateTypeList { return {}; }\ + template\ + struct append;\ + template\ + struct rewrap;\ + template class, typename...>\ + struct create;\ + template class, typename>\ + struct convert;\ + \ + template \ + struct append { using type = T; };\ + template< template class L1, typename...E1, template class L2, typename...E2, typename...Rest>\ + struct append, L2, Rest...> { using type = typename append, Rest...>::type; };\ + template< template class L1, typename...E1, typename...Rest>\ + struct append, TypeList, Rest...> { using type = L1; };\ + \ + template< template class Container, template class List, typename...elems>\ + struct rewrap, List> { using type = TypeList>; };\ + template< template class Container, template class List, class...Elems, typename...Elements>\ + struct rewrap, List, Elements...> { using type = typename append>, typename rewrap, Elements...>::type>::type; };\ + \ + template