From f438284a47294dc0fc92fd1a8a8959e7cd84809d Mon Sep 17 00:00:00 2001 From: isvogor Date: Mon, 3 Sep 2018 15:36:37 +0200 Subject: [PATCH] fmt rename to fmt_ to avoid naming conflict with the spdlog library --- single/sol/sol.hpp | 88 ++++++++++++++++++++-------------------- sol/container_traits.hpp | 18 ++++---- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/single/sol/sol.hpp b/single/sol/sol.hpp index 26ac864c..812f09d0 100644 --- a/single/sol/sol.hpp +++ b/single/sol/sol.hpp @@ -40,7 +40,7 @@ #ifdef check #define SOL_INSIDE_UNREAL_REMOVED_CHECK 1 #undef check -#endif +#endif #endif // Unreal Engine 4 Bullshit #if defined(__GNUC__) @@ -156,7 +156,7 @@ #define SOL_SAFE_REFERENCES 1 #endif - // Changes all typedefs of sol::function to point to the + // Changes all typedefs of sol::function to point to the // protected_function version, instead of unsafe_function #if !defined(SOL_SAFE_FUNCTION) #define SOL_SAFE_FUNCTION 1 @@ -186,7 +186,7 @@ #endif // Turn off Number Precision Checks - // if this is defined, we do not do range + // if this is defined, we do not do range // checks on integers / unsigned integers that might // be bigger than what Lua can represent #if !defined(SOL_NO_CHECK_NUMBER_PRECISION) @@ -246,7 +246,7 @@ #ifndef SOL_UNORDERED_MAP_COMPATIBLE_HASH #define SOL_UNORDERED_MAP_COMPATIBLE_HASH 1 #endif // SOL_UNORDERED_MAP_COMPATIBLE_HASH -#endif +#endif #ifndef SOL_STACK_STRING_OPTIMIZATION_SIZE #define SOL_STACK_STRING_OPTIMIZATION_SIZE 1024 @@ -1171,7 +1171,7 @@ namespace sol { hash ^= static_cast(*cptr++); hash *= static_cast(1099511628211ULL); } - return hash; + return hash; #endif } }; @@ -1435,7 +1435,7 @@ namespace sol { struct is_callable : std::is_function> {}; template - struct is_callable>::value + struct is_callable>::value && std::is_class>::value && std::is_same::value>> { @@ -1747,7 +1747,7 @@ namespace sol { template using is_string_constructible = any< meta::all>, std::is_same>>, char>>, - std::is_same, const char*>, + std::is_same, const char*>, std::is_same, char>, std::is_same, std::string>, std::is_same, std::initializer_list> #if defined(SOL_CXX17_FEATURES) && SOL_CXX17_FEATURES , std::is_same, std::string_view> @@ -5350,7 +5350,7 @@ namespace sol { "__ipairs", "next", "__type", - "__typeinfo" + "__typeinfo" } }; return names; } @@ -5417,7 +5417,7 @@ namespace sol { template struct is_container> - , meta::neg>> + , meta::neg>> , meta::neg>> >::value >> : std::true_type {}; @@ -5914,7 +5914,7 @@ namespace sol { } #if !defined(SOL_EXCEPTIONS_SAFE_PROPAGATION) // LuaJIT cannot have the catchall when the safe propagation is on - // but LuaJIT will swallow all C++ errors + // but LuaJIT will swallow all C++ errors // if we don't at least catch std::exception ones catch (...) { call_exception_handler(L, optional(nullopt), "caught (...) exception"); @@ -5925,7 +5925,7 @@ namespace sol { } #ifdef SOL_NOEXCEPT_FUNCTION_TYPE -#if 0 +#if 0 // impossible: g++/clang++ choke as they think this function is ambiguous: // to fix, wait for template and then switch on no-exceptness of the function template @@ -5968,7 +5968,7 @@ namespace sol { } #if !defined(SOL_EXCEPTIONS_SAFE_PROPAGATION) // LuaJIT cannot have the catchall when the safe propagation is on - // but LuaJIT will swallow all C++ errors + // but LuaJIT will swallow all C++ errors // if we don't at least catch std::exception ones catch (...) { call_exception_handler(L, optional(nullopt), "caught (...) exception"); @@ -7443,7 +7443,7 @@ namespace sol { return false; } allocated_size -= sizeof(T*); - + adjusted = static_cast(static_cast(pointer_adjusted) + sizeof(T*)); dx_adjusted = align(std::alignment_of::value, sizeof(unique_destructor), adjusted, allocated_size); if (dx_adjusted == nullptr) { @@ -7451,7 +7451,7 @@ namespace sol { return false; } allocated_size -= sizeof(unique_destructor); - + adjusted = static_cast(static_cast(dx_adjusted) + sizeof(unique_destructor)); id_adjusted = align(std::alignment_of::value, sizeof(unique_tag), adjusted, allocated_size); @@ -7460,7 +7460,7 @@ namespace sol { return false; } allocated_size -= sizeof(unique_tag); - + adjusted = static_cast(static_cast(id_adjusted) + sizeof(unique_tag)); data_adjusted = align(std::alignment_of::value, sizeof(Real), adjusted, allocated_size); if (data_adjusted == nullptr) { @@ -8763,7 +8763,7 @@ namespace stack { struct qualified_checker::value && !std::is_reference::value>> { typedef unique_usertype_traits> u_traits; typedef typename u_traits::type T; - + template static bool check(std::false_type, lua_State* L, int index, Handler&& handler, record& tracking) { return stack::unqualified_check(L, index, std::forward(handler), tracking); @@ -8771,7 +8771,7 @@ namespace stack { template static bool check(std::true_type, lua_State* L, int index, Handler&& handler, record& tracking) { - // we have a unique pointer type that can be + // we have a unique pointer type that can be // rebound to a base/derived type const type indextype = type_of(L, index); tracking.use(1); @@ -8801,7 +8801,7 @@ namespace stack { handler(L, index, type::userdata, indextype, "value is a userdata but is not the correct unique usertype"); return false; } - + template static bool check(lua_State* L, int index, Handler&& handler, record& tracking) { return check(meta::neg>(), L, index, std::forward(handler), tracking); @@ -9098,7 +9098,7 @@ namespace sol { dr.error = error_code::invalid_code_point; return dr; } - + // then everything is fine dr.codepoint = decoded; dr.error = error_code::ok; @@ -9116,7 +9116,7 @@ namespace sol { } char16_t lead = static_cast(*it); - + if (!unicode_detail::is_surrogate(lead)) { ++it; dr.codepoint = static_cast(lead); @@ -9137,7 +9137,7 @@ namespace sol { dr.next = it; return dr; } - + dr.codepoint = unicode_detail::combine_surrogates(lead, trail); dr.next = ++it; dr.error = error_code::ok; @@ -10074,10 +10074,10 @@ namespace stack { template struct qualified_getter::value - && is_container>::value - && !is_lua_primitive::value - && !is_transparent_argument::value + !std::is_reference::value + && is_container>::value + && !is_lua_primitive::value + && !is_transparent_argument::value >> { static T get(lua_State* L, int index, record& tracking) { if (type_of(L, index) == type::userdata) { @@ -13463,7 +13463,7 @@ namespace sol { const auto& meta = usertype_traits::metatable(); T* obj = detail::usertype_allocate(L); reference userdataref(L, -1); - + auto& func = std::get(f.functions); stack::call_into_lua(r, a, L, boost + start, func, detail::implicit_wrapper(obj)); @@ -14421,7 +14421,7 @@ namespace sol { template static void select_member_variable(std::true_type, lua_State* L, Fx&& fx, function_detail::class_indicator) { lua_CFunction freefunc = &function_detail::upvalue_this_member_variable::call; - + int upvalues = 0; upvalues += stack::push(L, nullptr); upvalues += stack::stack_detail::push_as_upvalues(L, fx); @@ -14432,7 +14432,7 @@ namespace sol { static void select_member_variable(std::true_type, lua_State* L, Fx&& fx) { typedef typename meta::bind_traits>::object_type C; lua_CFunction freefunc = &function_detail::upvalue_this_member_variable::call; - + int upvalues = 0; upvalues += stack::push(L, nullptr); upvalues += stack::stack_detail::push_as_upvalues(L, fx); @@ -14474,7 +14474,7 @@ namespace sol { template static void select_member_function(std::true_type, lua_State* L, Fx&& fx, function_detail::class_indicator) { lua_CFunction freefunc = &function_detail::upvalue_this_member_function::call; - + int upvalues = 0; upvalues += stack::push(L, nullptr); upvalues += stack::stack_detail::push_as_upvalues(L, fx); @@ -14485,7 +14485,7 @@ namespace sol { static void select_member_function(std::true_type, lua_State* L, Fx&& fx) { typedef typename meta::bind_traits>::object_type C; lua_CFunction freefunc = &function_detail::upvalue_this_member_function::call; - + int upvalues = 0; upvalues += stack::push(L, nullptr); upvalues += stack::stack_detail::push_as_upvalues(L, fx); @@ -15133,7 +15133,7 @@ namespace sol { } #if (!defined(SOL_EXCEPTIONS_SAFE_PROPAGATION) || !SOL_NO_EXCEPTIONS_SAFE_PROPAGATION) // LuaJIT cannot have the catchall when the safe propagation is on - // but LuaJIT will swallow all C++ errors + // but LuaJIT will swallow all C++ errors // if we don't at least catch std::exception ones catch (...) { onexcept(optional(nullopt), "caught (...) unknown error during protected_function call"); @@ -15220,7 +15220,7 @@ namespace sol { stack::check(lua_state(), -1, handler); #endif // Safety } - + basic_protected_function(lua_nil_t n) : base_t(n), error_handler(n) { } @@ -16571,25 +16571,25 @@ namespace sol { struct error_result { int results; - const char* fmt; + const char* fmt_; std::array args; - error_result() : results(0), fmt(nullptr) { + error_result() : results(0), fmt_(nullptr) { } - error_result(int results) : results(results), fmt(nullptr) { + error_result(int results) : results(results), fmt_(nullptr) { } - error_result(const char* fmt, const char* msg) : results(0), fmt(fmt) { + error_result(const char* fmt_, const char* msg) : results(0), fmt_(fmt_) { args[0] = msg; } }; inline int handle_errors(lua_State* L, const error_result& er) { - if (er.fmt == nullptr) { + if (er.fmt_ == nullptr) { return er.results; } - return luaL_error(L, er.fmt, er.args[0], er.args[1], er.args[2], er.args[3]); + return luaL_error(L, er.fmt_, er.args[0], er.args[1], er.args[2], er.args[3]); } template @@ -16684,7 +16684,7 @@ namespace sol { typedef meta::is_matched_lookup is_matched_lookup; typedef typename T::iterator iterator; typedef typename T::value_type value_type; - typedef std::conditional_t, std::conditional_t(), L, self); } - + static error_result erase_start(lua_State* L, T& self, K& key) { return erase_has(has_erase(), L, self, key); } @@ -17892,7 +17892,7 @@ namespace sol { std::remove_pointer_t>> meta_cumt; static const char* metakey = is_shim ? &usertype_traits>>::metatable()[0] : &usertype_traits::metatable()[0]; - static const std::array reg = { { + static const std::array reg = { { { "__pairs", &meta_cumt::pairs_call }, { "__ipairs", &meta_cumt::ipairs_call }, { "__len", &meta_cumt::length_call }, @@ -17911,7 +17911,7 @@ namespace sol { { "find", &meta_cumt::find_call }, { "erase", &meta_cumt::erase_call }, std::is_pointer::value ? luaL_Reg{ nullptr, nullptr } : luaL_Reg{ "__gc", &detail::usertype_alloc_destruct }, - { nullptr, nullptr } + { nullptr, nullptr } } }; if (luaL_newmetatable(L, metakey) == 1) { @@ -18298,7 +18298,7 @@ namespace sol { : index(index), new_index(newindex), runtime_target(runtimetarget) { } }; - + typedef map_t mapping_t; struct variable_wrapper { @@ -22062,7 +22062,7 @@ namespace sol { #else #define check(expr) { CA_ASSUME(expr); } #endif -#endif +#endif #endif // Unreal Engine 4 Bullshit #endif // SOL_HPP diff --git a/sol/container_traits.hpp b/sol/container_traits.hpp index 09332c72..3bcad56e 100644 --- a/sol/container_traits.hpp +++ b/sol/container_traits.hpp @@ -1,4 +1,4 @@ -// sol2 +// sol2 // The MIT License (MIT) @@ -456,25 +456,25 @@ namespace sol { struct error_result { int results; - const char* fmt; + const char* fmt_; std::array args; - error_result() : results(0), fmt(nullptr) { + error_result() : results(0), fmt_(nullptr) { } - error_result(int results) : results(results), fmt(nullptr) { + error_result(int results) : results(results), fmt_(nullptr) { } - error_result(const char* fmt, const char* msg) : results(0), fmt(fmt) { + error_result(const char* fmt_, const char* msg) : results(0), fmt_(fmt_) { args[0] = msg; } }; inline int handle_errors(lua_State* L, const error_result& er) { - if (er.fmt == nullptr) { + if (er.fmt_ == nullptr) { return er.results; } - return luaL_error(L, er.fmt, er.args[0], er.args[1], er.args[2], er.args[3]); + return luaL_error(L, er.fmt_, er.args[0], er.args[1], er.args[2], er.args[3]); } template @@ -569,7 +569,7 @@ namespace sol { typedef meta::is_matched_lookup is_matched_lookup; typedef typename T::iterator iterator; typedef typename T::value_type value_type; - typedef std::conditional_t, std::conditional_t(), L, self); } - + static error_result erase_start(lua_State* L, T& self, K& key) { return erase_has(has_erase(), L, self, key); }