diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 00000000..31cd405a --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,6 @@ +ignore: + - "untests/*" + - "samples/*" + - "toolset/*" + - "*/3rdparty/*" + - "*/modules/*" diff --git a/.travis.yml b/.travis.yml index 6589bcd1..069a68a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,6 +62,8 @@ matrix: - os: osx osx_image: xcode10 compiler: clang + addons: { homebrew: { packages: ["lcov"] } } + after_success: ./scripts/upload_coverage.sh before_install: - eval "${MATRIX_EVAL}" - if [ "$TRAVIS_OS_NAME" == 'osx' ]; then diff --git a/BUILD_INSTRUCTIONS.md b/BUILD_INSTRUCTIONS.md index 38893988..8aac80f4 100644 --- a/BUILD_INSTRUCTIONS.md +++ b/BUILD_INSTRUCTIONS.md @@ -1,4 +1,4 @@ -# Build Instructions +# Build Instructions ## * Requirements @@ -46,7 +46,7 @@ $ start enduro2d.sln ## * Running ```bash -$ cd your_engine_build_folder +$ cd your_engine_build_directory $ ctest $ ./samples/sample_00 ``` @@ -56,4 +56,3 @@ $ ./samples/sample_00 - CMake: https://cmake.org/ - CMake documentation: https://cmake.org/documentation/ - CMake FAQ: https://gitlab.kitware.com/cmake/community/wikis/FAQ - diff --git a/CMakeLists.txt b/CMakeLists.txt index fce54a24..541698dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,7 @@ if(E2D_BUILD_WITH_COVERAGE AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) set(E2D_COVERAGE_FLAGS "--coverage") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${E2D_COVERAGE_FLAGS}") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${E2D_COVERAGE_FLAGS}") + set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} ${E2D_COVERAGE_FLAGS}") endif() # diff --git a/README.md b/README.md index 1f3e26a9..438737fa 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![travis][badge.travis]][travis] [![appveyor][badge.appveyor]][appveyor] +[![codecov][badge.codecov]][codecov] [![language][badge.language]][language] [![license][badge.license]][license] [![paypal][badge.paypal]][paypal] @@ -16,14 +17,16 @@ ## [License (MIT)](./LICENSE.md) -[badge.travis]: https://img.shields.io/travis/enduro2d/enduro2d/master.svg?logo=travis&style=for-the-badge -[badge.appveyor]: https://img.shields.io/appveyor/ci/BlackMATov/enduro2d/master.svg?logo=appveyor&style=for-the-badge -[badge.language]: https://img.shields.io/badge/language-C%2B%2B14-red.svg?style=for-the-badge -[badge.license]: https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge -[badge.paypal]: https://img.shields.io/badge/donate-PayPal-orange.svg?logo=paypal&colorA=00457C&style=for-the-badge +[badge.travis]: https://img.shields.io/travis/enduro2d/enduro2d/master.svg?logo=travis +[badge.appveyor]: https://img.shields.io/appveyor/ci/BlackMATov/enduro2d/master.svg?logo=appveyor +[badge.codecov]: https://img.shields.io/codecov/c/github/enduro2d/enduro2d/master.svg?logo=codecov +[badge.language]: https://img.shields.io/badge/language-C%2B%2B14-red.svg +[badge.license]: https://img.shields.io/badge/license-MIT-blue.svg +[badge.paypal]: https://img.shields.io/badge/donate-PayPal-orange.svg?logo=paypal&colorA=00457C [travis]: https://travis-ci.org/enduro2d/enduro2d [appveyor]: https://ci.appveyor.com/project/BlackMATov/enduro2d +[codecov]: https://codecov.io/gh/enduro2d/enduro2d [language]: https://en.wikipedia.org/wiki/C%2B%2B14 [license]: https://en.wikipedia.org/wiki/MIT_License -[paypal]: https://www.paypal.me/matov \ No newline at end of file +[paypal]: https://www.paypal.me/matov diff --git a/headers/3rdparty/promise.hpp/invoke.hpp b/headers/3rdparty/promise.hpp/invoke.hpp index 01d2f138..b75657fd 100644 --- a/headers/3rdparty/promise.hpp/invoke.hpp +++ b/headers/3rdparty/promise.hpp/invoke.hpp @@ -1,7 +1,7 @@ /******************************************************************************* * This file is part of the "https://github.com/blackmatov/invoke.hpp" * For conditions of distribution and use, see copyright notice in LICENSE.md - * Copyright (C) 2018 Matvey Cherevko + * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) ******************************************************************************/ #pragma once diff --git a/headers/3rdparty/promise.hpp/jobber.hpp b/headers/3rdparty/promise.hpp/jobber.hpp index 7a74380f..958f8504 100644 --- a/headers/3rdparty/promise.hpp/jobber.hpp +++ b/headers/3rdparty/promise.hpp/jobber.hpp @@ -1,7 +1,7 @@ /******************************************************************************* * This file is part of the "https://github.com/blackmatov/promise.hpp" * For conditions of distribution and use, see copyright notice in LICENSE.md - * Copyright (C) 2018 Matvey Cherevko + * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) ******************************************************************************/ #pragma once diff --git a/headers/3rdparty/promise.hpp/promise.hpp b/headers/3rdparty/promise.hpp/promise.hpp index 1d4ca29b..2b68ee45 100644 --- a/headers/3rdparty/promise.hpp/promise.hpp +++ b/headers/3rdparty/promise.hpp/promise.hpp @@ -1,7 +1,7 @@ /******************************************************************************* * This file is part of the "https://github.com/blackmatov/promise.hpp" * For conditions of distribution and use, see copyright notice in LICENSE.md - * Copyright (C) 2018 Matvey Cherevko + * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) ******************************************************************************/ #pragma once diff --git a/headers/3rdparty/promise.hpp/scheduler.hpp b/headers/3rdparty/promise.hpp/scheduler.hpp index 226c39df..93a17bf1 100644 --- a/headers/3rdparty/promise.hpp/scheduler.hpp +++ b/headers/3rdparty/promise.hpp/scheduler.hpp @@ -1,7 +1,7 @@ /******************************************************************************* * This file is part of the "https://github.com/blackmatov/promise.hpp" * For conditions of distribution and use, see copyright notice in LICENSE.md - * Copyright (C) 2018 Matvey Cherevko + * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) ******************************************************************************/ #pragma once diff --git a/headers/3rdparty/variant/config.hpp b/headers/3rdparty/variant/config.hpp index 1b0838b0..e411d687 100644 --- a/headers/3rdparty/variant/config.hpp +++ b/headers/3rdparty/variant/config.hpp @@ -13,6 +13,10 @@ #error "MPark.Variant requires C++11 support." #endif +#ifndef __has_attribute +#define __has_attribute(x) 0 +#endif + #ifndef __has_builtin #define __has_builtin(x) 0 #endif @@ -25,6 +29,14 @@ #define __has_feature(x) 0 #endif +#if __has_attribute(always_inline) || defined(__GNUC__) +#define MPARK_ALWAYS_INLINE __attribute__((__always_inline__)) inline +#elif defined(_MSC_VER) +#define MPARK_ALWAYS_INLINE __forceinline +#else +#define MPARK_ALWAYS_INLINE inline +#endif + #if __has_builtin(__builtin_addressof) || \ (defined(__GNUC__) && __GNUC__ >= 7) || defined(_MSC_VER) #define MPARK_BUILTIN_ADDRESSOF @@ -42,8 +54,12 @@ #define MPARK_TYPE_PACK_ELEMENT #endif -#if defined(__cpp_constexpr) && __cpp_constexpr >= 201304 && \ - !(defined(_MSC_VER) && _MSC_VER <= 1915) +#if defined(__cpp_constexpr) && __cpp_constexpr >= 200704 && \ + !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 9) +#define MPARK_CPP11_CONSTEXPR +#endif + +#if defined(__cpp_constexpr) && __cpp_constexpr >= 201304 #define MPARK_CPP14_CONSTEXPR #endif @@ -74,6 +90,7 @@ #if !defined(__GLIBCXX__) || __has_include() // >= libstdc++-5 #define MPARK_TRIVIALITY_TYPE_TRAITS +#define MPARK_INCOMPLETE_TYPE_TRAITS #endif #endif // MPARK_CONFIG_HPP diff --git a/headers/3rdparty/variant/lib.hpp b/headers/3rdparty/variant/lib.hpp index a36870bd..42256686 100644 --- a/headers/3rdparty/variant/lib.hpp +++ b/headers/3rdparty/variant/lib.hpp @@ -15,7 +15,8 @@ #include "config.hpp" -#define MPARK_RETURN(...) -> decltype(__VA_ARGS__) { return __VA_ARGS__; } +#define MPARK_RETURN(...) \ + noexcept(noexcept(__VA_ARGS__)) -> decltype(__VA_ARGS__) { return __VA_ARGS__; } namespace mpark { namespace lib { @@ -205,48 +206,107 @@ namespace mpark { static constexpr bool value = decltype(test(0))::value; }; - template ::value> + template struct is_nothrow_swappable { static constexpr bool value = noexcept(swap(std::declval(), std::declval())); }; template - struct is_nothrow_swappable : std::false_type {}; + struct is_nothrow_swappable : std::false_type {}; } // namespace swappable } // namespace detail using detail::swappable::is_swappable; - using detail::swappable::is_nothrow_swappable; + + template + using is_nothrow_swappable = + detail::swappable::is_nothrow_swappable::value, T>; // + namespace detail { + + template + struct is_reference_wrapper : std::false_type {}; + + template + struct is_reference_wrapper> + : std::true_type {}; + + template + struct Invoke; + + template <> + struct Invoke { + template + inline static constexpr auto invoke(R T::*pmf, Arg &&arg, Args &&... args) + MPARK_RETURN((lib::forward(arg).*pmf)(lib::forward(args)...)) + }; + + template <> + struct Invoke { + template + inline static constexpr auto invoke(R T::*pmf, Arg &&arg, Args &&... args) + MPARK_RETURN((lib::forward(arg).get().*pmf)(lib::forward(args)...)) + }; + + template <> + struct Invoke { + template + inline static constexpr auto invoke(R T::*pmf, Arg &&arg, Args &&... args) + MPARK_RETURN(((*lib::forward(arg)).*pmf)(lib::forward(args)...)) + }; + + template <> + struct Invoke { + template + inline static constexpr auto invoke(R T::*pmo, Arg &&arg) + MPARK_RETURN(lib::forward(arg).*pmo) + }; + + template <> + struct Invoke { + template + inline static constexpr auto invoke(R T::*pmo, Arg &&arg) + MPARK_RETURN(lib::forward(arg).get().*pmo) + }; + + template <> + struct Invoke { + template + inline static constexpr auto invoke(R T::*pmo, Arg &&arg) + MPARK_RETURN((*lib::forward(arg)).*pmo) + }; + + template + inline constexpr auto invoke(R T::*f, Arg &&arg, Args &&... args) + MPARK_RETURN( + Invoke::value, + (std::is_base_of>::value + ? 0 + : is_reference_wrapper>::value + ? 1 + : 2)>::invoke(f, + lib::forward(arg), + lib::forward(args)...)) + #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable : 4100) #endif - template - inline constexpr auto invoke(F &&f, As &&... as) - MPARK_RETURN(lib::forward(f)(lib::forward(as)...)) + template + inline constexpr auto invoke(F &&f, Args &&... args) + MPARK_RETURN(lib::forward(f)(lib::forward(args)...)) #ifdef _MSC_VER #pragma warning(pop) #endif + } // namespace detail - template - inline constexpr auto invoke(T B::*pmv, D &&d) - MPARK_RETURN(lib::forward(d).*pmv) - - template - inline constexpr auto invoke(Pmv pmv, Ptr &&ptr) - MPARK_RETURN((*lib::forward(ptr)).*pmv) - - template - inline constexpr auto invoke(T B::*pmf, D &&d, As &&... as) - MPARK_RETURN((lib::forward(d).*pmf)(lib::forward(as)...)) - - template - inline constexpr auto invoke(Pmf pmf, Ptr &&ptr, As &&... as) - MPARK_RETURN(((*lib::forward(ptr)).*pmf)(lib::forward(as)...)) + template + inline constexpr auto invoke(F &&f, Args &&... args) + MPARK_RETURN(detail::invoke(lib::forward(f), + lib::forward(args)...)) namespace detail { diff --git a/headers/3rdparty/variant/variant.hpp b/headers/3rdparty/variant/variant.hpp index f0ac1c61..2364c736 100644 --- a/headers/3rdparty/variant/variant.hpp +++ b/headers/3rdparty/variant/variant.hpp @@ -379,9 +379,11 @@ namespace mpark { #ifdef MPARK_CPP14_CONSTEXPR template - inline constexpr Trait common_trait(Traits... traits) { + inline constexpr Trait common_trait(Traits... traits_) { Trait result = Trait::TriviallyAvailable; - for (Trait t : {traits...}) { + lib::array traits = {{traits_...}}; + for (std::size_t i = 0; i < sizeof...(Traits); ++i) { + Trait t = traits[i]; if (static_cast(t) > static_cast(result)) { result = t; } @@ -473,8 +475,13 @@ namespace mpark { struct base { template inline static constexpr AUTO_REFREF get_alt(V &&v) +#ifdef _MSC_VER + AUTO_REFREF_RETURN(recursive_union::get_alt( + lib::forward(v).data_, in_place_index_t{})) +#else AUTO_REFREF_RETURN(recursive_union::get_alt( data(lib::forward(v)), in_place_index_t{})) +#endif }; struct variant { @@ -487,7 +494,207 @@ namespace mpark { namespace visitation { +#if defined(MPARK_CPP14_CONSTEXPR) && !defined(_MSC_VER) +#define MPARK_VARIANT_SWITCH_VISIT +#endif + struct base { + template + using dispatch_result_t = decltype( + lib::invoke(std::declval(), + access::base::get_alt<0>(std::declval())...)); + + template + struct expected { + template + inline static constexpr bool but_got() { + return std::is_same::value; + } + }; + + template + struct visit_return_type_check { + static_assert( + expected::template but_got(), + "`visit` requires the visitor to have a single return type"); + + template + inline static constexpr DECLTYPE_AUTO invoke(Visitor &&visitor, + Alts &&... alts) + DECLTYPE_AUTO_RETURN(lib::invoke(lib::forward(visitor), + lib::forward(alts)...)) + }; + +#ifdef MPARK_VARIANT_SWITCH_VISIT + template + struct dispatcher; + + template + struct dispatcher { + template + MPARK_ALWAYS_INLINE static constexpr R dispatch( + F &&, typename ITs::type &&..., Vs &&...) { + MPARK_BUILTIN_UNREACHABLE; + } + + template + MPARK_ALWAYS_INLINE static constexpr R dispatch_case(F &&, Vs &&...) { + MPARK_BUILTIN_UNREACHABLE; + } + + template + MPARK_ALWAYS_INLINE static constexpr R dispatch_at(std::size_t, + F &&, + Vs &&...) { + MPARK_BUILTIN_UNREACHABLE; + } + }; + + template + struct dispatcher { + template + MPARK_ALWAYS_INLINE static constexpr R dispatch( + F &&f, typename ITs::type &&... visited_vs) { + using Expected = R; + using Actual = decltype(lib::invoke( + lib::forward(f), + access::base::get_alt( + lib::forward(visited_vs))...)); + return visit_return_type_check::invoke( + lib::forward(f), + access::base::get_alt( + lib::forward(visited_vs))...); + } + + template + MPARK_ALWAYS_INLINE static constexpr R dispatch( + F &&f, typename ITs::type &&... visited_vs, V &&v, Vs &&... vs) { +#define MPARK_DISPATCH(I) \ + dispatcher<(I < lib::decay_t::size()), \ + R, \ + ITs..., \ + lib::indexed_type>:: \ + template dispatch<0>(lib::forward(f), \ + lib::forward(visited_vs)..., \ + lib::forward(v), \ + lib::forward(vs)...) + +#define MPARK_DEFAULT(I) \ + dispatcher<(I < lib::decay_t::size()), R, ITs...>::template dispatch( \ + lib::forward(f), \ + lib::forward(visited_vs)..., \ + lib::forward(v), \ + lib::forward(vs)...) + + switch (v.index()) { + case B + 0: return MPARK_DISPATCH(B + 0); + case B + 1: return MPARK_DISPATCH(B + 1); + case B + 2: return MPARK_DISPATCH(B + 2); + case B + 3: return MPARK_DISPATCH(B + 3); + case B + 4: return MPARK_DISPATCH(B + 4); + case B + 5: return MPARK_DISPATCH(B + 5); + case B + 6: return MPARK_DISPATCH(B + 6); + case B + 7: return MPARK_DISPATCH(B + 7); + case B + 8: return MPARK_DISPATCH(B + 8); + case B + 9: return MPARK_DISPATCH(B + 9); + case B + 10: return MPARK_DISPATCH(B + 10); + case B + 11: return MPARK_DISPATCH(B + 11); + case B + 12: return MPARK_DISPATCH(B + 12); + case B + 13: return MPARK_DISPATCH(B + 13); + case B + 14: return MPARK_DISPATCH(B + 14); + case B + 15: return MPARK_DISPATCH(B + 15); + case B + 16: return MPARK_DISPATCH(B + 16); + case B + 17: return MPARK_DISPATCH(B + 17); + case B + 18: return MPARK_DISPATCH(B + 18); + case B + 19: return MPARK_DISPATCH(B + 19); + case B + 20: return MPARK_DISPATCH(B + 20); + case B + 21: return MPARK_DISPATCH(B + 21); + case B + 22: return MPARK_DISPATCH(B + 22); + case B + 23: return MPARK_DISPATCH(B + 23); + case B + 24: return MPARK_DISPATCH(B + 24); + case B + 25: return MPARK_DISPATCH(B + 25); + case B + 26: return MPARK_DISPATCH(B + 26); + case B + 27: return MPARK_DISPATCH(B + 27); + case B + 28: return MPARK_DISPATCH(B + 28); + case B + 29: return MPARK_DISPATCH(B + 29); + case B + 30: return MPARK_DISPATCH(B + 30); + case B + 31: return MPARK_DISPATCH(B + 31); + default: return MPARK_DEFAULT(B + 32); + } + +#undef MPARK_DEFAULT +#undef MPARK_DISPATCH + } + + template + MPARK_ALWAYS_INLINE static constexpr R dispatch_case(F &&f, + Vs &&... vs) { + using Expected = R; + using Actual = decltype( + lib::invoke(lib::forward(f), + access::base::get_alt(lib::forward(vs))...)); + return visit_return_type_check::invoke( + lib::forward(f), + access::base::get_alt(lib::forward(vs))...); + } + + template + MPARK_ALWAYS_INLINE static constexpr R dispatch_at(std::size_t index, + F &&f, + V &&v, + Vs &&... vs) { + static_assert(lib::all<(lib::decay_t::size() == + lib::decay_t::size())...>::value, + "all of the variants must be the same size."); +#define MPARK_DISPATCH_AT(I) \ + dispatcher<(I < lib::decay_t::size()), R>::template dispatch_case( \ + lib::forward(f), lib::forward(v), lib::forward(vs)...) + +#define MPARK_DEFAULT(I) \ + dispatcher<(I < lib::decay_t::size()), R>::template dispatch_at( \ + index, lib::forward(f), lib::forward(v), lib::forward(vs)...) + + switch (index) { + case B + 0: return MPARK_DISPATCH_AT(B + 0); + case B + 1: return MPARK_DISPATCH_AT(B + 1); + case B + 2: return MPARK_DISPATCH_AT(B + 2); + case B + 3: return MPARK_DISPATCH_AT(B + 3); + case B + 4: return MPARK_DISPATCH_AT(B + 4); + case B + 5: return MPARK_DISPATCH_AT(B + 5); + case B + 6: return MPARK_DISPATCH_AT(B + 6); + case B + 7: return MPARK_DISPATCH_AT(B + 7); + case B + 8: return MPARK_DISPATCH_AT(B + 8); + case B + 9: return MPARK_DISPATCH_AT(B + 9); + case B + 10: return MPARK_DISPATCH_AT(B + 10); + case B + 11: return MPARK_DISPATCH_AT(B + 11); + case B + 12: return MPARK_DISPATCH_AT(B + 12); + case B + 13: return MPARK_DISPATCH_AT(B + 13); + case B + 14: return MPARK_DISPATCH_AT(B + 14); + case B + 15: return MPARK_DISPATCH_AT(B + 15); + case B + 16: return MPARK_DISPATCH_AT(B + 16); + case B + 17: return MPARK_DISPATCH_AT(B + 17); + case B + 18: return MPARK_DISPATCH_AT(B + 18); + case B + 19: return MPARK_DISPATCH_AT(B + 19); + case B + 20: return MPARK_DISPATCH_AT(B + 20); + case B + 21: return MPARK_DISPATCH_AT(B + 21); + case B + 22: return MPARK_DISPATCH_AT(B + 22); + case B + 23: return MPARK_DISPATCH_AT(B + 23); + case B + 24: return MPARK_DISPATCH_AT(B + 24); + case B + 25: return MPARK_DISPATCH_AT(B + 25); + case B + 26: return MPARK_DISPATCH_AT(B + 26); + case B + 27: return MPARK_DISPATCH_AT(B + 27); + case B + 28: return MPARK_DISPATCH_AT(B + 28); + case B + 29: return MPARK_DISPATCH_AT(B + 29); + case B + 30: return MPARK_DISPATCH_AT(B + 30); + case B + 31: return MPARK_DISPATCH_AT(B + 31); + default: return MPARK_DEFAULT(B + 32); + } + +#undef MPARK_DEFAULT +#undef MPARK_DISPATCH_AT + } + }; +#else template inline static constexpr const T &at(const T &elem) noexcept { return elem; @@ -500,93 +707,46 @@ namespace mpark { } template - inline static constexpr int visit_visitor_return_type_check() { - static_assert(lib::all::value...>::value, - "`mpark::visit` requires the visitor to have a single " - "return type."); - return 0; + inline static constexpr lib::array, sizeof...(Fs) + 1> + make_farray(F &&f, Fs &&... fs) { + return {{lib::forward(f), lib::forward(fs)...}}; } - template - inline static constexpr lib::array< - lib::common_type_t...>, - sizeof...(Fs)> - make_farray(Fs &&... fs) { - using result = lib::array...>, - sizeof...(Fs)>; - return visit_visitor_return_type_check...>(), - result{{lib::forward(fs)...}}; - } - - template - struct dispatcher { - template - struct impl { - inline static constexpr DECLTYPE_AUTO dispatch(F f, Vs... vs) - DECLTYPE_AUTO_RETURN(lib::invoke( - static_cast(f), - access::base::get_alt(static_cast(vs))...)) - }; - }; - - template - inline static constexpr AUTO make_dispatch(lib::index_sequence) - AUTO_RETURN(&dispatcher::template impl::dispatch) - - template - inline static constexpr AUTO make_fdiagonal_impl() - AUTO_RETURN(make_dispatch( - lib::index_sequence::value...>{})) - - template - inline static constexpr AUTO make_fdiagonal_impl( - lib::index_sequence) - AUTO_RETURN(make_farray(make_fdiagonal_impl()...)) - - template - inline static constexpr /* auto * */ auto make_fdiagonal() - -> decltype(make_fdiagonal_impl( - lib::make_index_sequence::size()>{})) { - static_assert(lib::all<(lib::decay_t::size() == - lib::decay_t::size())...>::value, - "all of the variants must be the same size."); - return make_fdiagonal_impl( - lib::make_index_sequence::size()>{}); - } - -#ifdef MPARK_RETURN_TYPE_DEDUCTION - template - inline static constexpr auto make_fmatrix_impl(Is is) { - return make_dispatch(is); - } - - template - inline static constexpr auto make_fmatrix_impl( - Is, lib::index_sequence, Ls... ls) { - return make_farray(make_fmatrix_impl( - lib::push_back_t{}, ls...)...); - } - - template - inline static constexpr auto make_fmatrix() { - return make_fmatrix_impl( - lib::index_sequence<>{}, - lib::make_index_sequence::size()>{}...); - } -#else template struct make_fmatrix_impl { + + template + inline static constexpr dispatch_result_t dispatch( + F &&f, Vs &&... vs) { + using Expected = dispatch_result_t; + using Actual = decltype(lib::invoke( + lib::forward(f), + access::base::get_alt(lib::forward(vs))...)); + return visit_return_type_check::invoke( + lib::forward(f), + access::base::get_alt(lib::forward(vs))...); + } + +#ifdef MPARK_RETURN_TYPE_DEDUCTION + template + inline static constexpr auto impl(lib::index_sequence) { + return &dispatch; + } + + template + inline static constexpr auto impl(Is, + lib::index_sequence, + Ls... ls) { + return make_farray(impl(lib::push_back_t{}, ls...)...); + } +#else template struct impl; - template - struct impl { + template + struct impl> { inline constexpr AUTO operator()() const - AUTO_RETURN(make_dispatch(Is{})) + AUTO_RETURN(&dispatch) }; template @@ -595,8 +755,17 @@ namespace mpark { AUTO_RETURN( make_farray(impl, Ls...>{}()...)) }; +#endif }; +#ifdef MPARK_RETURN_TYPE_DEDUCTION + template + inline static constexpr auto make_fmatrix() { + return make_fmatrix_impl::impl( + lib::index_sequence<>{}, + lib::make_index_sequence::size()>{}...); + } +#else template inline static constexpr AUTO make_fmatrix() AUTO_RETURN( @@ -604,86 +773,141 @@ namespace mpark { lib::index_sequence<>, lib::make_index_sequence::size()>...>{}()) #endif - }; // namespace base - template - using FDiagonal = decltype(base::make_fdiagonal()); + template + struct make_fdiagonal_impl { + template + inline static constexpr dispatch_result_t dispatch( + F &&f, Vs &&... vs) { + using Expected = dispatch_result_t; + using Actual = decltype( + lib::invoke(lib::forward(f), + access::base::get_alt(lib::forward(vs))...)); + return visit_return_type_check::invoke( + lib::forward(f), + access::base::get_alt(lib::forward(vs))...); + } - template - struct fdiagonal { -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4268) -#endif - static constexpr FDiagonal value = - base::make_fdiagonal(); -#ifdef _MSC_VER -#pragma warning(pop) + template + inline static constexpr AUTO impl(lib::index_sequence) + AUTO_RETURN(make_farray(&dispatch...)) + }; + + template + inline static constexpr auto make_fdiagonal() + -> decltype(make_fdiagonal_impl::impl( + lib::make_index_sequence::size()>{})) { + static_assert(lib::all<(lib::decay_t::size() == + lib::decay_t::size())...>::value, + "all of the variants must be the same size."); + return make_fdiagonal_impl::impl( + lib::make_index_sequence::size()>{}); + } #endif }; +#if !defined(MPARK_VARIANT_SWITCH_VISIT) && \ + (!defined(_MSC_VER) || _MSC_VER >= 1910) template - constexpr FDiagonal fdiagonal::value; - - template - using FMatrix = decltype(base::make_fmatrix()); + using fmatrix_t = decltype(base::make_fmatrix()); template struct fmatrix { -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4268) -#endif - static constexpr FMatrix value = + static constexpr fmatrix_t value = base::make_fmatrix(); -#ifdef _MSC_VER -#pragma warning(pop) -#endif }; template - constexpr FMatrix fmatrix::value; + constexpr fmatrix_t fmatrix::value; + + template + using fdiagonal_t = decltype(base::make_fdiagonal()); + + template + struct fdiagonal { + static constexpr fdiagonal_t value = + base::make_fdiagonal(); + }; + + template + constexpr fdiagonal_t fdiagonal::value; +#endif struct alt { - template - inline static constexpr DECLTYPE_AUTO visit_alt_at(std::size_t index, - Visitor &&visitor, - Vs &&... vs) - DECLTYPE_AUTO_RETURN(base::at( - fdiagonal(vs)))...>::value, - index)(lib::forward(visitor), - as_base(lib::forward(vs))...)) - template inline static constexpr DECLTYPE_AUTO visit_alt(Visitor &&visitor, Vs &&... vs) +#ifdef MPARK_VARIANT_SWITCH_VISIT + DECLTYPE_AUTO_RETURN( + base::dispatcher< + true, + base::dispatch_result_t(vs)))...>>:: + template dispatch<0>(lib::forward(visitor), + as_base(lib::forward(vs))...)) +#elif !defined(_MSC_VER) || _MSC_VER >= 1910 DECLTYPE_AUTO_RETURN(base::at( fmatrix(vs)))...>::value, vs.index()...)(lib::forward(visitor), as_base(lib::forward(vs))...)) +#else + DECLTYPE_AUTO_RETURN(base::at( + base::make_fmatrix(vs)))...>(), + vs.index()...)(lib::forward(visitor), + as_base(lib::forward(vs))...)) +#endif + + template + inline static constexpr DECLTYPE_AUTO visit_alt_at(std::size_t index, + Visitor &&visitor, + Vs &&... vs) +#ifdef MPARK_VARIANT_SWITCH_VISIT + DECLTYPE_AUTO_RETURN( + base::dispatcher< + true, + base::dispatch_result_t(vs)))...>>:: + template dispatch_at<0>(index, + lib::forward(visitor), + as_base(lib::forward(vs))...)) +#elif !defined(_MSC_VER) || _MSC_VER >= 1910 + DECLTYPE_AUTO_RETURN(base::at( + fdiagonal(vs)))...>::value, + index)(lib::forward(visitor), + as_base(lib::forward(vs))...)) +#else + DECLTYPE_AUTO_RETURN(base::at( + base::make_fdiagonal(vs)))...>(), + index)(lib::forward(visitor), + as_base(lib::forward(vs))...)) +#endif }; struct variant { private: - template - struct visit_exhaustive_visitor_check { - static_assert( - lib::is_invocable::value, - "`mpark::visit` requires the visitor to be exhaustive."); + template + struct visitor { + template + inline static constexpr bool does_not_handle() { + return lib::is_invocable::value; + } + }; -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4100) -#endif - inline constexpr DECLTYPE_AUTO operator()(Visitor &&visitor, - Values &&... values) const + template + struct visit_exhaustiveness_check { + static_assert(visitor::template does_not_handle(), + "`visit` requires the visitor to be exhaustive."); + + inline static constexpr DECLTYPE_AUTO invoke(Visitor &&visitor, + Values &&... values) DECLTYPE_AUTO_RETURN(lib::invoke(lib::forward(visitor), lib::forward(values)...)) -#ifdef _MSC_VER -#pragma warning(pop) -#endif }; template @@ -693,11 +917,11 @@ namespace mpark { template inline constexpr DECLTYPE_AUTO operator()(Alts &&... alts) const DECLTYPE_AUTO_RETURN( - visit_exhaustive_visitor_check< + visit_exhaustiveness_check< Visitor, - decltype((lib::forward(alts).value))...>{}( - lib::forward(visitor_), - lib::forward(alts).value...)) + decltype((lib::forward(alts).value))...>:: + invoke(lib::forward(visitor_), + lib::forward(alts).value...)) }; template @@ -705,6 +929,12 @@ namespace mpark { AUTO_RETURN(value_visitor{lib::forward(visitor)}) public: + template + inline static constexpr DECLTYPE_AUTO visit_alt(Visitor &&visitor, + Vs &&... vs) + DECLTYPE_AUTO_RETURN(alt::visit_alt(lib::forward(visitor), + lib::forward(vs).impl_...)) + template inline static constexpr DECLTYPE_AUTO visit_alt_at(std::size_t index, Visitor &&visitor, @@ -715,10 +945,11 @@ namespace mpark { lib::forward(vs).impl_...)) template - inline static constexpr DECLTYPE_AUTO visit_alt(Visitor &&visitor, - Vs &&... vs) - DECLTYPE_AUTO_RETURN(alt::visit_alt(lib::forward(visitor), - lib::forward(vs).impl_...)) + inline static constexpr DECLTYPE_AUTO visit_value(Visitor &&visitor, + Vs &&... vs) + DECLTYPE_AUTO_RETURN( + visit_alt(make_value_visitor(lib::forward(visitor)), + lib::forward(vs)...)) template inline static constexpr DECLTYPE_AUTO visit_value_at(std::size_t index, @@ -728,13 +959,6 @@ namespace mpark { visit_alt_at(index, make_value_visitor(lib::forward(visitor)), lib::forward(vs)...)) - - template - inline static constexpr DECLTYPE_AUTO visit_value(Visitor &&visitor, - Vs &&... vs) - DECLTYPE_AUTO_RETURN( - visit_alt(make_value_visitor(lib::forward(visitor)), - lib::forward(vs)...)) }; } // namespace visitation @@ -860,13 +1084,13 @@ namespace mpark { #endif }; -#if defined(_MSC_VER) && _MSC_VER < 1910 +#if !defined(_MSC_VER) || _MSC_VER >= 1910 +#define MPARK_INHERITING_CTOR(type, base) using base::base; +#else #define MPARK_INHERITING_CTOR(type, base) \ template \ inline explicit constexpr type(Args &&... args) \ : base(lib::forward(args)...) {} -#else -#define MPARK_INHERITING_CTOR(type, base) using base::base; #endif template @@ -937,9 +1161,9 @@ namespace mpark { template inline static T &construct_alt(alt &a, Args &&... args) { - ::new (static_cast(lib::addressof(a))) + auto *result = ::new (static_cast(lib::addressof(a))) alt(in_place_t{}, lib::forward(args)...); - return a.value; + return result->value; } template diff --git a/modules/catch2 b/modules/catch2 index 461843b1..63d1a969 160000 --- a/modules/catch2 +++ b/modules/catch2 @@ -1 +1 @@ -Subproject commit 461843b1f02a4bf5c59db88ff201d2c56fabf3a4 +Subproject commit 63d1a96908ac40dd7f474a35085120bb3992ded7 diff --git a/modules/glew b/modules/glew index 8e190fe8..d6502196 160000 --- a/modules/glew +++ b/modules/glew @@ -1 +1 @@ -Subproject commit 8e190fe8fc9abbac9a6759cf730af90b5a192ee0 +Subproject commit d6502196316e8cfa6b782a3cedd054579f0cfc1b diff --git a/modules/glfw b/modules/glfw index f9923e90..90e22947 160000 --- a/modules/glfw +++ b/modules/glfw @@ -1 +1 @@ -Subproject commit f9923e90958e726aaabc86d83fb3681216d76067 +Subproject commit 90e22947c60b0c1fa47cf1496790ce1942e4a5d8 diff --git a/modules/promise.hpp b/modules/promise.hpp index a832ca36..9356ce78 160000 --- a/modules/promise.hpp +++ b/modules/promise.hpp @@ -1 +1 @@ -Subproject commit a832ca362bcab230eace0c8bedadba8ebd7c21b6 +Subproject commit 9356ce7868963c021bcd0e007aab82511abe25cb diff --git a/modules/pugixml b/modules/pugixml index b3db08ff..160c1c23 160000 --- a/modules/pugixml +++ b/modules/pugixml @@ -1 +1 @@ -Subproject commit b3db08ffccb78d680d8f7665ad9ed4cff6f92fcf +Subproject commit 160c1c23d9ccf40b5d8bbffa591483a2d7fe3d9f diff --git a/modules/variant b/modules/variant index 6507d027..f8aa7c16 160000 --- a/modules/variant +++ b/modules/variant @@ -1 +1 @@ -Subproject commit 6507d02740dd87f8c266fc6132149724f436b4a5 +Subproject commit f8aa7c16f05c17411e135e911a8edf3cc3116875 diff --git a/scripts/gen_lcov_coverage.sh b/scripts/upload_coverage.sh similarity index 51% rename from scripts/gen_lcov_coverage.sh rename to scripts/upload_coverage.sh index 8a466cdc..0193817f 100755 --- a/scripts/gen_lcov_coverage.sh +++ b/scripts/upload_coverage.sh @@ -6,11 +6,12 @@ mkdir -p $BUILD_DIR/coverage cd $BUILD_DIR/coverage cmake -DCMAKE_BUILD_TYPE=Debug -DE2D_BUILD_WITH_COVERAGE=ON ../.. cmake --build . -- -j8 + +lcov -d . -z ctest --verbose lcov -d . -c -o "coverage.info" -lcov -r "coverage.info" "*/Xcode.app/*" "*/untests/*" "*/3rdparty/*" "*/modules/*" -o "coverage-filtered.info" -lcov -d . -z +lcov -r "coverage.info" "*/usr/*" "*/Xcode.app/*" "*/untests/*" "*/samples/*" "*/toolset/*" "*/3rdparty/*" "*/modules/*" -o "coverage.info" +lcov -l "coverage.info" -genhtml -o "html" "coverage-filtered.info" -open html/index.html +bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" diff --git a/sources/3rdparty/pugixml/pugiconfig.hpp b/sources/3rdparty/pugixml/pugiconfig.hpp index ebd1f901..ff897168 100644 --- a/sources/3rdparty/pugixml/pugiconfig.hpp +++ b/sources/3rdparty/pugixml/pugiconfig.hpp @@ -1,7 +1,7 @@ /** * pugixml parser - version 1.9 * -------------------------------------------------------- - * Copyright (C) 2006-2018, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) + * Copyright (C) 2006-2019, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -49,7 +49,7 @@ #endif /** - * Copyright (c) 2006-2018 Arseny Kapoulkine + * Copyright (c) 2006-2019 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation diff --git a/sources/3rdparty/pugixml/pugixml.cpp b/sources/3rdparty/pugixml/pugixml.cpp index 39ea5b81..57bd50af 100644 --- a/sources/3rdparty/pugixml/pugixml.cpp +++ b/sources/3rdparty/pugixml/pugixml.cpp @@ -1,7 +1,7 @@ /** * pugixml parser - version 1.9 * -------------------------------------------------------- - * Copyright (C) 2006-2018, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) + * Copyright (C) 2006-2019, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -12766,7 +12766,7 @@ namespace pugi #endif /** - * Copyright (c) 2006-2018 Arseny Kapoulkine + * Copyright (c) 2006-2019 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation diff --git a/sources/3rdparty/pugixml/pugixml.hpp b/sources/3rdparty/pugixml/pugixml.hpp index da6c2985..bfba0e32 100644 --- a/sources/3rdparty/pugixml/pugixml.hpp +++ b/sources/3rdparty/pugixml/pugixml.hpp @@ -1,7 +1,7 @@ /** * pugixml parser - version 1.9 * -------------------------------------------------------- - * Copyright (C) 2006-2018, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) + * Copyright (C) 2006-2019, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -1445,7 +1445,7 @@ namespace std #endif /** - * Copyright (c) 2006-2018 Arseny Kapoulkine + * Copyright (c) 2006-2019 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation diff --git a/toolset/model_converter/modules/assimp b/toolset/model_converter/modules/assimp index 4407071a..e878560b 160000 --- a/toolset/model_converter/modules/assimp +++ b/toolset/model_converter/modules/assimp @@ -1 +1 @@ -Subproject commit 4407071aa0fea6e53f63d4a3f785abf8f43d8f21 +Subproject commit e878560b4b791d00566b0ebce1988b6637830653