From 1af8fd87d91e543fdb54cc24d378cf654610fb97 Mon Sep 17 00:00:00 2001 From: elsid Date: Fri, 21 Feb 2025 19:28:01 +0100 Subject: [PATCH] Update sol3 to v3.5.0 To fix warning (silenced by 3b97af0ac417c6f5ee2d16fa4c2cab2885409352): In file included from ../../../extern/sol3/sol/stack_check_get.hpp:28, from ../../../extern/sol3/sol/stack.hpp:32, from ../../../extern/sol3/sol/sol.hpp:52, from ../../../components/lua/luastate.hpp:8, from ../../../apps/openmw/mwlua/context.hpp:4, from ../../../apps/openmw/mwlua/soundbindings.hpp:6, from ../../../apps/openmw/mwlua/soundbindings.cpp:1: In function 'OptionalType sol::stack::stack_detail::get_optional(lua_State*, int, Handler&&, sol::stack::record&) [with OptionalType = sol::optional; T = float; Handler = int (*)(lua_State*, int, sol::type, sol::type, const char*) noexcept]', inlined from 'static Optional sol::stack::qualified_getter, void>::type>::get(lua_State*, int, sol::stack::record&) [with Optional = sol::optional]' at ../../../extern/sol3/sol/stack_check_get_qualified.hpp:133:50, inlined from 'decltype(auto) sol::stack::stack_detail::unchecked_get(lua_State*, int, sol::stack::record&) [with T = sol::optional]' at ../../../extern/sol3/sol/stack_core.hpp:725:18, inlined from 'decltype (unchecked_get(L, index, tracking)) sol::stack::get(lua_State*, int, record&) [with T = sol::optional]' at ../../../extern/sol3/sol/stack_core.hpp:1186:41, inlined from 'decltype(auto) sol::stack::get(lua_State*, int) [with T = sol::optional]' at ../../../extern/sol3/sol/stack_core.hpp:1193:17: ../../../extern/sol3/sol/stack_check_get_qualified.hpp:112:49: error: '*(float*)((char*)& + offsetof(sol::optional,sol::optional::.sol::detail::optional_move_assign_base::.sol::detail::optional_copy_assign_base::.sol::detail::optional_move_base::.sol::detail::optional_copy_base::.sol::detail::optional_operations_base::.sol::detail::optional_storage_base::))' may be used uninitialized [-Werror=maybe-uninitialized] 112 | return {}; | ^ ../../../extern/sol3/sol/stack_check_get_qualified.hpp: In function 'decltype(auto) sol::stack::get(lua_State*, int) [with T = sol::optional]': ../../../extern/sol3/sol/stack_check_get_qualified.hpp:112:49: note: '' declared here 112 | return {}; | ^ --- extern/sol3/README.md | 4 +- extern/sol3/sol/abort.hpp | 47 ++++ extern/sol3/sol/as_args.hpp | 2 +- extern/sol3/sol/as_returns.hpp | 2 +- extern/sol3/sol/assert.hpp | 24 +-- extern/sol3/sol/base_traits.hpp | 35 ++- extern/sol3/sol/bind_traits.hpp | 10 +- extern/sol3/sol/bytecode.hpp | 4 +- extern/sol3/sol/call.hpp | 32 +-- extern/sol3/sol/compatibility.hpp | 26 +-- extern/sol3/sol/compatibility/compat-5.3.h | 12 +- extern/sol3/sol/compatibility/compat-5.4.h | 12 +- extern/sol3/sol/compatibility/lua_version.hpp | 99 +++++---- extern/sol3/sol/config.hpp | 50 +++++ extern/sol3/sol/coroutine.hpp | 12 +- extern/sol3/sol/debug.hpp | 13 +- extern/sol3/sol/demangle.hpp | 8 +- extern/sol3/sol/deprecate.hpp | 2 +- extern/sol3/sol/detail/build_version.hpp | 64 +++--- extern/sol3/sol/dump_handler.hpp | 4 +- extern/sol3/sol/ebco.hpp | 3 +- extern/sol3/sol/environment.hpp | 23 +- extern/sol3/sol/epilogue.hpp | 4 +- extern/sol3/sol/error.hpp | 27 ++- extern/sol3/sol/error_handler.hpp | 27 ++- extern/sol3/sol/forward.hpp | 14 +- extern/sol3/sol/forward_as.hpp | 44 ++++ extern/sol3/sol/forward_detail.hpp | 4 +- extern/sol3/sol/function.hpp | 2 +- extern/sol3/sol/function_result.hpp | 2 +- extern/sol3/sol/function_types.hpp | 14 +- extern/sol3/sol/function_types_core.hpp | 2 +- extern/sol3/sol/function_types_overloaded.hpp | 4 +- extern/sol3/sol/function_types_stateful.hpp | 6 +- extern/sol3/sol/function_types_stateless.hpp | 28 +-- extern/sol3/sol/function_types_templated.hpp | 4 +- extern/sol3/sol/in_place.hpp | 2 +- extern/sol3/sol/inheritance.hpp | 2 +- extern/sol3/sol/load_result.hpp | 16 +- extern/sol3/sol/lua_table.hpp | 10 +- extern/sol3/sol/lua_value.hpp | 4 +- extern/sol3/sol/make_reference.hpp | 2 +- extern/sol3/sol/metatable.hpp | 10 +- extern/sol3/sol/object.hpp | 2 +- extern/sol3/sol/object_base.hpp | 2 +- extern/sol3/sol/optional.hpp | 12 +- extern/sol3/sol/optional_implementation.hpp | 14 +- extern/sol3/sol/overload.hpp | 4 +- extern/sol3/sol/packaged_coroutine.hpp | 12 +- extern/sol3/sol/pairs_iterator.hpp | 2 +- extern/sol3/sol/pointer_like.hpp | 3 +- extern/sol3/sol/policies.hpp | 2 +- extern/sol3/sol/prologue.hpp | 6 +- extern/sol3/sol/property.hpp | 2 +- extern/sol3/sol/protect.hpp | 2 +- extern/sol3/sol/protected_function.hpp | 20 +- extern/sol3/sol/protected_function_result.hpp | 25 ++- extern/sol3/sol/protected_handler.hpp | 4 +- extern/sol3/sol/proxy_base.hpp | 2 +- extern/sol3/sol/raii.hpp | 2 +- extern/sol3/sol/reference.hpp | 14 +- extern/sol3/sol/resolve.hpp | 2 +- extern/sol3/sol/sol.hpp | 18 +- extern/sol3/sol/stack.hpp | 47 +++- extern/sol3/sol/stack/detail/pairs.hpp | 4 +- extern/sol3/sol/stack_check.hpp | 2 +- extern/sol3/sol/stack_check_get.hpp | 2 +- extern/sol3/sol/stack_check_get_qualified.hpp | 21 +- .../sol3/sol/stack_check_get_unqualified.hpp | 8 +- extern/sol3/sol/stack_check_qualified.hpp | 2 +- extern/sol3/sol/stack_check_unqualified.hpp | 131 ++++++++++-- extern/sol3/sol/stack_core.hpp | 48 ++--- extern/sol3/sol/stack_field.hpp | 2 +- extern/sol3/sol/stack_get.hpp | 2 +- extern/sol3/sol/stack_get_qualified.hpp | 2 +- extern/sol3/sol/stack_get_unqualified.hpp | 99 ++++----- extern/sol3/sol/stack_guard.hpp | 4 +- extern/sol3/sol/stack_iterator.hpp | 2 +- extern/sol3/sol/stack_pop.hpp | 2 +- extern/sol3/sol/stack_probe.hpp | 4 +- extern/sol3/sol/stack_proxy.hpp | 2 +- extern/sol3/sol/stack_proxy_base.hpp | 2 +- extern/sol3/sol/stack_push.hpp | 107 +++++----- extern/sol3/sol/stack_reference.hpp | 6 +- extern/sol3/sol/state.hpp | 2 +- extern/sol3/sol/state_handling.hpp | 18 +- extern/sol3/sol/state_view.hpp | 18 +- extern/sol3/sol/string_view.hpp | 2 +- extern/sol3/sol/table.hpp | 2 +- extern/sol3/sol/table_core.hpp | 12 +- extern/sol3/sol/table_iterator.hpp | 2 +- extern/sol3/sol/table_proxy.hpp | 22 +- extern/sol3/sol/thread.hpp | 12 +- extern/sol3/sol/tie.hpp | 2 +- extern/sol3/sol/traits.hpp | 39 ++-- extern/sol3/sol/trampoline.hpp | 25 +-- extern/sol3/sol/tuple.hpp | 2 +- extern/sol3/sol/types.hpp | 97 +++++++-- extern/sol3/sol/unique_usertype_traits.hpp | 2 +- extern/sol3/sol/unreachable.hpp | 37 ++++ extern/sol3/sol/unsafe_function.hpp | 10 +- extern/sol3/sol/unsafe_function_result.hpp | 8 +- extern/sol3/sol/userdata.hpp | 18 +- extern/sol3/sol/usertype.hpp | 2 +- extern/sol3/sol/usertype_container.hpp | 90 +++++--- extern/sol3/sol/usertype_container_launch.hpp | 2 +- extern/sol3/sol/usertype_core.hpp | 4 +- extern/sol3/sol/usertype_proxy.hpp | 2 +- extern/sol3/sol/usertype_storage.hpp | 10 +- extern/sol3/sol/usertype_traits.hpp | 2 +- extern/sol3/sol/utility/is_integer.hpp | 43 ++++ extern/sol3/sol/utility/to_string.hpp | 59 +++++ extern/sol3/sol/variadic_args.hpp | 2 +- extern/sol3/sol/variadic_results.hpp | 2 +- extern/sol3/sol/version.hpp | 202 ++++++++++-------- extern/sol3/sol/wrapper.hpp | 4 +- 116 files changed, 1407 insertions(+), 712 deletions(-) create mode 100644 extern/sol3/sol/abort.hpp create mode 100644 extern/sol3/sol/config.hpp create mode 100644 extern/sol3/sol/forward_as.hpp create mode 100644 extern/sol3/sol/unreachable.hpp create mode 100644 extern/sol3/sol/utility/is_integer.hpp create mode 100644 extern/sol3/sol/utility/to_string.hpp diff --git a/extern/sol3/README.md b/extern/sol3/README.md index 202b2ca08b..c68f64b5d3 100644 --- a/extern/sol3/README.md +++ b/extern/sol3/README.md @@ -1,5 +1,3 @@ -The code in this directory is copied from https://github.com/ThePhD/sol2.git (64096348465b980e2f1d0e5ba9cbeea8782e8f27) - -Additional changes include cherry-picking upstream commit d805d027e0a0a7222e936926139f06e23828ce9f to fix compilation under Clang 19. +The code in this directory is copied from https://github.com/ThePhD/sol2.git (9190880c593dfb018ccf5cc9729ab87739709862) License: MIT diff --git a/extern/sol3/sol/abort.hpp b/extern/sol3/sol/abort.hpp new file mode 100644 index 0000000000..692244daa7 --- /dev/null +++ b/extern/sol3/sol/abort.hpp @@ -0,0 +1,47 @@ +// sol2 + +// The MIT License (MIT) + +// Copyright (c) 2013-2022 Rapptz, ThePhD and contributors + +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#ifndef SOL_ABORT_HPP +#define SOL_ABORT_HPP + +#include + +#include + +#include + +// clang-format off +#if SOL_IS_ON(SOL_DEBUG_BUILD) + #if SOL_IS_ON(SOL_COMPILER_VCXX) + #define SOL_DEBUG_ABORT() \ + if (true) { ::std::abort(); } \ + static_assert(true, "") + #else + #define SOL_DEBUG_ABORT() ::std::abort() + #endif +#else + #define SOL_DEBUG_ABORT() static_assert(true, "") +#endif +// clang-format on + +#endif // SOL_ABORT_HPP diff --git a/extern/sol3/sol/as_args.hpp b/extern/sol3/sol/as_args.hpp index 5afe78b0e4..719a3cdc99 100644 --- a/extern/sol3/sol/as_args.hpp +++ b/extern/sol3/sol/as_args.hpp @@ -2,7 +2,7 @@ // The MIT License (MIT) -// Copyright (c) 2013-2021 Rapptz, ThePhD and contributors +// Copyright (c) 2013-2022 Rapptz, ThePhD and contributors // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in diff --git a/extern/sol3/sol/as_returns.hpp b/extern/sol3/sol/as_returns.hpp index 0ac499e67d..982f408b71 100644 --- a/extern/sol3/sol/as_returns.hpp +++ b/extern/sol3/sol/as_returns.hpp @@ -2,7 +2,7 @@ // The MIT License (MIT) -// Copyright (c) 2013-2021 Rapptz, ThePhD and contributors +// Copyright (c) 2013-2022 Rapptz, ThePhD and contributors // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in diff --git a/extern/sol3/sol/assert.hpp b/extern/sol3/sol/assert.hpp index e46b9f122a..fbe2175a2c 100644 --- a/extern/sol3/sol/assert.hpp +++ b/extern/sol3/sol/assert.hpp @@ -2,7 +2,7 @@ // The MIT License (MIT) -// Copyright (c) 2013-2021 Rapptz, ThePhD and contributors +// Copyright (c) 2013-2022 Rapptz, ThePhD and contributors // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in @@ -28,7 +28,7 @@ #include -#if SOL_IS_ON(SOL2_CI_I_) +#if SOL_IS_ON(SOL2_CI) struct pre_main { pre_main() { @@ -43,15 +43,15 @@ struct pre_main { // clang-format off -#if SOL_IS_ON(SOL_USER_C_ASSERT_I_) - #define sol_c_assert(...) SOL_C_ASSERT(__VA_ARGS__) +#if SOL_IS_ON(SOL_USER_ASSERT) + #define SOL_ASSERT(...) SOL_C_ASSERT(__VA_ARGS__) #else - #if SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #if SOL_IS_ON(SOL_DEBUG_BUILD) #include #include #include - #define sol_c_assert(...) \ + #define SOL_ASSERT(...) \ do { \ if (!(__VA_ARGS__)) { \ std::cerr << "Assertion `" #__VA_ARGS__ "` failed in " << __FILE__ << " line " << __LINE__ << std::endl; \ @@ -59,7 +59,7 @@ struct pre_main { } \ } while (false) #else - #define sol_c_assert(...) \ + #define SOL_ASSERT(...) \ do { \ if (false) { \ (void)(__VA_ARGS__); \ @@ -68,15 +68,15 @@ struct pre_main { #endif #endif -#if SOL_IS_ON(SOL_USER_M_ASSERT_I_) - #define sol_m_assert(message, ...) SOL_M_ASSERT(message, __VA_ARGS__) +#if SOL_IS_ON(SOL_USER_ASSERT_MSG) + #define SOL_ASSERT_MSG(message, ...) SOL_ASSERT_MSG(message, __VA_ARGS__) #else - #if SOL_IS_ON(SOL_DEBUG_BUILD_I_) + #if SOL_IS_ON(SOL_DEBUG_BUILD) #include #include #include - #define sol_m_assert(message, ...) \ + #define SOL_ASSERT_MSG(message, ...) \ do { \ if (!(__VA_ARGS__)) { \ std::cerr << "Assertion `" #__VA_ARGS__ "` failed in " << __FILE__ << " line " << __LINE__ << ": " << message << std::endl; \ @@ -84,7 +84,7 @@ struct pre_main { } \ } while (false) #else - #define sol_m_assert(message, ...) \ + #define SOL_ASSERT_MSG(message, ...) \ do { \ if (false) { \ (void)(__VA_ARGS__); \ diff --git a/extern/sol3/sol/base_traits.hpp b/extern/sol3/sol/base_traits.hpp index a28f23a74c..d7b4965c70 100644 --- a/extern/sol3/sol/base_traits.hpp +++ b/extern/sol3/sol/base_traits.hpp @@ -2,7 +2,7 @@ // The MIT License (MIT) -// Copyright (c) 2013-2021 Rapptz, ThePhD and contributors +// Copyright (c) 2013-2022 Rapptz, ThePhD and contributors // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in @@ -62,6 +62,39 @@ namespace sol { template