From b86d90f0e50fdbc931059ee4131c3aa32b1d7724 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Mon, 7 Aug 2017 02:27:08 -0400 Subject: [PATCH] std::cend doesn't exist in C++11 remove unused variables detected by clang and g++ appease the parenthesis monster that was put into g++ 5.0 --- single/sol/sol.hpp | 27 +++-- sol/container_traits.hpp | 12 +-- sol/container_usertype_metatable.hpp | 1 - sol/stack.hpp | 2 +- sol/stack_get.hpp | 4 +- sol/state_view.hpp | 4 +- test_container_semantics.cpp | 144 +++++++++++++-------------- 7 files changed, 96 insertions(+), 98 deletions(-) diff --git a/single/sol/sol.hpp b/single/sol/sol.hpp index 60536878..668f5c24 100644 --- a/single/sol/sol.hpp +++ b/single/sol/sol.hpp @@ -20,8 +20,8 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // This file was generated with a script. -// Generated 2017-08-07 06:06:53.826612 UTC -// This header was generated with sol v2.18.0 (revision 03c229b) +// Generated 2017-08-07 06:26:17.141906 UTC +// This header was generated with sol v2.18.0 (revision ca685e0) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -6201,8 +6201,8 @@ namespace sol { template static void insert_at_end(std::true_type, types, lua_State* L, T& arr, std::size_t) { - using std::cend; - arr.insert(cend(arr), stack::get(L, -lua_size::value)); + using std::end; + arr.insert(end(arr), stack::get(L, -lua_size::value)); } template @@ -8268,7 +8268,7 @@ namespace sol { namespace sol { namespace detail { inline const std::string& default_chunk_name() { - static const std::string name = "script"; + static const std::string name = ""; return name; } @@ -13675,12 +13675,12 @@ namespace sol { return luaL_error(L, "sol: cannot call '__pairs' on type '%s': it is not recognized as a container", detail::demangle().c_str()); } - static iterator begin(lua_State* L, T& self) { + static iterator begin(lua_State* L, T&) { luaL_error(L, "sol: cannot call 'being' on type '%s': it is not recognized as a container", detail::demangle().c_str()); return lua_nil; } - static iterator end(lua_State* L, T& self) { + static iterator end(lua_State* L, T&) { luaL_error(L, "sol: cannot call 'end' on type '%s': it is not recognized as a container", detail::demangle().c_str()); return lua_nil; } @@ -13798,7 +13798,7 @@ namespace sol { return get_associative(is_associative(), L, it); } - static int get_comparative(std::false_type, lua_State* L, T& self, K& key) { + static int get_comparative(std::false_type, lua_State* L, T&, K&) { return luaL_error(L, "cannot get this key on '%s': no suitable way to increment iterator and compare to key value '%s'", detail::demangle().data(), detail::demangle().data()); } @@ -13880,7 +13880,7 @@ namespace sol { set_writable(is_writable(), L, self, it, std::move(value)); } - static void set_comparative(std::false_type, lua_State* L, T& self, stack_object key, stack_object value) { + static void set_comparative(std::false_type, lua_State* L, T&, stack_object, stack_object) { luaL_error(L, "cannot set this value on '%s': no suitable way to increment iterator or compare to '%s' key", detail::demangle().data(), detail::demangle().data()); } @@ -14442,11 +14442,11 @@ namespace sol { return 3; } - static iterator begin(lua_State* L, T& self) { + static iterator begin(lua_State*, T& self) { return std::addressof(self[0]); } - static iterator end(lua_State* L, T& self) { + static iterator end(lua_State*, T& self) { return std::addressof(self[std::extent::value]); } }; @@ -14690,7 +14690,6 @@ namespace sol { } }; if (luaL_newmetatable(L, metakey) == 1) { - stack_reference metatable(L, -1); luaL_setfuncs(L, reg.data(), 0); } lua_setmetatable(L, -2); @@ -15990,7 +15989,7 @@ namespace sol { lua_error(L); } set_environment(env, stack_reference(L, raw_index(index + 1))); - if (lua_call(L, 0, LUA_MULTRET)) { + if (lua_pcall(L, 0, LUA_MULTRET, 0)) { lua_error(L); } int postindex = lua_gettop(L); @@ -16013,7 +16012,7 @@ namespace sol { lua_error(L); } set_environment(env, stack_reference(L, raw_index(index + 1))); - if (lua_call(L, 0, LUA_MULTRET)) { + if (lua_pcall(L, 0, LUA_MULTRET, 0)) { lua_error(L); } int postindex = lua_gettop(L); diff --git a/sol/container_traits.hpp b/sol/container_traits.hpp index 7f17ddfe..8cbc4198 100644 --- a/sol/container_traits.hpp +++ b/sol/container_traits.hpp @@ -351,12 +351,12 @@ namespace sol { return luaL_error(L, "sol: cannot call '__pairs' on type '%s': it is not recognized as a container", detail::demangle().c_str()); } - static iterator begin(lua_State* L, T& self) { + static iterator begin(lua_State* L, T&) { luaL_error(L, "sol: cannot call 'being' on type '%s': it is not recognized as a container", detail::demangle().c_str()); return lua_nil; } - static iterator end(lua_State* L, T& self) { + static iterator end(lua_State* L, T&) { luaL_error(L, "sol: cannot call 'end' on type '%s': it is not recognized as a container", detail::demangle().c_str()); return lua_nil; } @@ -474,7 +474,7 @@ namespace sol { return get_associative(is_associative(), L, it); } - static int get_comparative(std::false_type, lua_State* L, T& self, K& key) { + static int get_comparative(std::false_type, lua_State* L, T&, K&) { return luaL_error(L, "cannot get this key on '%s': no suitable way to increment iterator and compare to key value '%s'", detail::demangle().data(), detail::demangle().data()); } @@ -556,7 +556,7 @@ namespace sol { set_writable(is_writable(), L, self, it, std::move(value)); } - static void set_comparative(std::false_type, lua_State* L, T& self, stack_object key, stack_object value) { + static void set_comparative(std::false_type, lua_State* L, T&, stack_object, stack_object) { luaL_error(L, "cannot set this value on '%s': no suitable way to increment iterator or compare to '%s' key", detail::demangle().data(), detail::demangle().data()); } @@ -1118,11 +1118,11 @@ namespace sol { return 3; } - static iterator begin(lua_State* L, T& self) { + static iterator begin(lua_State*, T& self) { return std::addressof(self[0]); } - static iterator end(lua_State* L, T& self) { + static iterator end(lua_State*, T& self) { return std::addressof(self[std::extent::value]); } }; diff --git a/sol/container_usertype_metatable.hpp b/sol/container_usertype_metatable.hpp index 8087badb..d19441ea 100644 --- a/sol/container_usertype_metatable.hpp +++ b/sol/container_usertype_metatable.hpp @@ -258,7 +258,6 @@ namespace sol { } }; if (luaL_newmetatable(L, metakey) == 1) { - stack_reference metatable(L, -1); luaL_setfuncs(L, reg.data(), 0); } lua_setmetatable(L, -2); diff --git a/sol/stack.hpp b/sol/stack.hpp index 5d2d1603..7f81cbd6 100644 --- a/sol/stack.hpp +++ b/sol/stack.hpp @@ -37,7 +37,7 @@ namespace sol { namespace detail { inline const std::string& default_chunk_name() { - static const std::string name = "script"; + static const std::string name = ""; return name; } diff --git a/sol/stack_get.hpp b/sol/stack_get.hpp index 633f829a..0f29e06b 100644 --- a/sol/stack_get.hpp +++ b/sol/stack_get.hpp @@ -98,8 +98,8 @@ namespace sol { template static void insert_at_end(std::true_type, types, lua_State* L, T& arr, std::size_t) { - using std::cend; - arr.insert(cend(arr), stack::get(L, -lua_size::value)); + using std::end; + arr.insert(end(arr), stack::get(L, -lua_size::value)); } template diff --git a/sol/state_view.hpp b/sol/state_view.hpp index a575d5d8..12a9beeb 100644 --- a/sol/state_view.hpp +++ b/sol/state_view.hpp @@ -368,7 +368,7 @@ namespace sol { lua_error(L); } set_environment(env, stack_reference(L, raw_index(index + 1))); - if (lua_call(L, 0, LUA_MULTRET)) { + if (lua_pcall(L, 0, LUA_MULTRET, 0)) { lua_error(L); } int postindex = lua_gettop(L); @@ -391,7 +391,7 @@ namespace sol { lua_error(L); } set_environment(env, stack_reference(L, raw_index(index + 1))); - if (lua_call(L, 0, LUA_MULTRET)) { + if (lua_pcall(L, 0, LUA_MULTRET, 0)) { lua_error(L); } int postindex = lua_gettop(L); diff --git a/test_container_semantics.cpp b/test_container_semantics.cpp index 46b6ee48..65fb18e2 100644 --- a/test_container_semantics.cpp +++ b/test_container_semantics.cpp @@ -106,21 +106,21 @@ end std::size_t idx = 0; for (const auto& i : items) { const auto& v = values[idx]; - REQUIRE(i == v); + REQUIRE((i == v)); ++idx; } } - REQUIRE(s1 == 6); - REQUIRE(s2 == 5); - REQUIRE(s3 == 4); - REQUIRE(len == 6); - REQUIRE(first == 20); - REQUIRE(last == 18); - REQUIRE(i1 == 1); - REQUIRE(i2 == 4); - REQUIRE(v1 == 11); - REQUIRE(v2 == 13); - REQUIRE(v3 == 18); + REQUIRE((s1 == 6)); + REQUIRE((s2 == 5)); + REQUIRE((s3 == 4)); + REQUIRE((len == 6)); + REQUIRE((first == 20)); + REQUIRE((last == 18)); + REQUIRE((i1 == 1)); + REQUIRE((i2 == 4)); + REQUIRE((v1 == 11)); + REQUIRE((v2 == 13)); + REQUIRE((v3 == 18)); } template @@ -215,21 +215,21 @@ end std::size_t idx = 0; for (const auto& i : items) { const auto& v = values[idx]; - REQUIRE(i == v); + REQUIRE((i == v)); ++idx; } } - REQUIRE(s1 == 7); - REQUIRE(s2 == 6); - REQUIRE(s3 == 5); - REQUIRE(len == 7); - REQUIRE(first == 12); - REQUIRE(last == 20); - REQUIRE(i1 == 11); - REQUIRE(i2 == 14); - REQUIRE(v1 == 11); - REQUIRE(v2 == 13); - REQUIRE(v3 == 20); + REQUIRE((s1 == 7)); + REQUIRE((s2 == 6)); + REQUIRE((s3 == 5)); + REQUIRE((len == 7)); + REQUIRE((first == 12)); + REQUIRE((last == 20)); + REQUIRE((i1 == 11)); + REQUIRE((i2 == 14)); + REQUIRE((v1 == 11)); + REQUIRE((v2 == 13)); + REQUIRE((v3 == 20)); } template @@ -302,20 +302,20 @@ void unordered_container_check(sol::state& lua, T& items) { for (const auto& i : items) { const auto& v = values[idx]; auto it = items.find(v); - REQUIRE(it != items.cend()); - REQUIRE(*it == v); + REQUIRE((it != items.cend())); + REQUIRE((*it == v)); ++idx; } } - REQUIRE(s1 == 7); - REQUIRE(s2 == 6); - REQUIRE(s3 == 5); - REQUIRE(len == 7); - REQUIRE(i1 == 11); - REQUIRE(i2 == 14); - REQUIRE(v1 == 11); - REQUIRE(v2 == 13); - REQUIRE(v3 == 20); + REQUIRE((s1 == 7)); + REQUIRE((s2 == 6)); + REQUIRE((s3 == 5)); + REQUIRE((len == 7)); + REQUIRE((i1 == 11)); + REQUIRE((i2 == 14)); + REQUIRE((v1 == 11)); + REQUIRE((v2 == 13)); + REQUIRE((v3 == 20)); } template @@ -418,23 +418,23 @@ end std::size_t idx = 0; for (const auto& i : items) { const auto& v = values[idx]; - REQUIRE(i == v); + REQUIRE((i == v)); ++idx; } } - REQUIRE(s1 == 7); - REQUIRE(s2 == 6); - REQUIRE(s3 == 5); - REQUIRE(len == 7); - REQUIRE(first.first == 12); - REQUIRE(last.first == 20); - REQUIRE(first.second == 31); - REQUIRE(last.second == 30); - REQUIRE(i1 == 21); - REQUIRE(i2 == 24); - REQUIRE(v1 == 21); - REQUIRE(v2 == 23); - REQUIRE(v3 == 30); + REQUIRE((s1 == 7)); + REQUIRE((s2 == 6)); + REQUIRE((s3 == 5)); + REQUIRE((len == 7)); + REQUIRE((first.first == 12)); + REQUIRE((last.first == 20)); + REQUIRE((first.second == 31)); + REQUIRE((last.second == 30)); + REQUIRE((i1 == 21)); + REQUIRE((i2 == 24)); + REQUIRE((v1 == 21)); + REQUIRE((v2 == 23)); + REQUIRE((v3 == 30)); } template @@ -516,20 +516,20 @@ void associative_unordered_container_check(sol::state& lua, T& items) { for (const auto& i : items) { const auto& v = values[idx]; auto it = items.find(v.first); - REQUIRE(it != items.cend()); - REQUIRE(it->second == v.second); + REQUIRE((it != items.cend())); + REQUIRE((it->second == v.second)); ++idx; } } - REQUIRE(s1 == 7); - REQUIRE(s2 == 6); - REQUIRE(s3 == 5); - REQUIRE(len == 7); - REQUIRE(i1 == 21); - REQUIRE(i2 == 24); - REQUIRE(v1 == 21); - REQUIRE(v2 == 23); - REQUIRE(v3 == 30); + REQUIRE((s1 == 7)); + REQUIRE((s2 == 6)); + REQUIRE((s3 == 5)); + REQUIRE((len == 7)); + REQUIRE((i1 == 21)); + REQUIRE((i2 == 24)); + REQUIRE((v1 == 21)); + REQUIRE((v2 == 23)); + REQUIRE((v3 == 30)); } template @@ -624,21 +624,21 @@ end std::size_t idx = 0; for (const auto& i : items) { const auto& v = values[idx]; - REQUIRE(i == v); + REQUIRE((i == v)); ++idx; } } - REQUIRE(first == 11); - REQUIRE(last == 18); - REQUIRE(s1 == 5); - REQUIRE(s2 == 5); - REQUIRE(s3 == 5); - REQUIRE(len == 5); - REQUIRE(i1 == 1); - REQUIRE(i2 == 4); - REQUIRE(v1 == 12); - REQUIRE(v2 == 15); - REQUIRE(v3 == 14); + REQUIRE((first == 11)); + REQUIRE((last == 18)); + REQUIRE((s1 == 5)); + REQUIRE((s2 == 5)); + REQUIRE((s3 == 5)); + REQUIRE((len == 5)); + REQUIRE((i1 == 1)); + REQUIRE((i2 == 4)); + REQUIRE((v1 == 12)); + REQUIRE((v2 == 15)); + REQUIRE((v3 == 14)); } TEST_CASE("containers/sequence containers", "check all of the functinos for every single container") {