From aaddc98b46c2b918e908287f53a137d2fb5cf697 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 26 Feb 2014 21:37:38 +0100 Subject: Attempted fix for several GCC warnings. --- src/Bindings/LuaState.cpp | 7 +++++++ src/Bindings/ManualBindings.cpp | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src/Bindings') diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index ca7f6b255..45a066efe 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -677,6 +677,11 @@ void cLuaState::Push(void * a_Ptr) { ASSERT(IsValid()); + // Investigate the cause of this - what is the callstack? + LOGWARNING("Lua engine encountered an error - attempting to push a plain pointer"); + LogStackTrace(); + ASSERT(!"A plain pointer should never be pushed on Lua stack"); + lua_pushnil(m_LuaState); m_NumCurrentFunctionArgs += 1; } @@ -1265,6 +1270,8 @@ void cLuaState::LogStack(const char * a_Header) void cLuaState::LogStack(lua_State * a_LuaState, const char * a_Header) { + UNUSED(a_Header); // The param seems unused when compiling for release, so the compiler warns + LOGD((a_Header != NULL) ? a_Header : "Lua C API Stack contents:"); for (int i = lua_gettop(a_LuaState); i > 0; i--) { diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 2f3f3ee91..461186d3b 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -1321,7 +1321,9 @@ static int tolua_cPluginManager_ForEachCommand(lua_State * tolua_S) private: virtual bool Command(const AString & a_Command, const cPlugin * a_Plugin, const AString & a_Permission, const AString & a_HelpString) override { - lua_rawgeti( LuaState, LUA_REGISTRYINDEX, FuncRef); /* Push function reference */ + UNUSED(a_Plugin); + + lua_rawgeti(LuaState, LUA_REGISTRYINDEX, FuncRef); /* Push function reference */ tolua_pushcppstring(LuaState, a_Command); tolua_pushcppstring(LuaState, a_Permission); tolua_pushcppstring(LuaState, a_HelpString); @@ -1396,7 +1398,10 @@ static int tolua_cPluginManager_ForEachConsoleCommand(lua_State * tolua_S) private: virtual bool Command(const AString & a_Command, const cPlugin * a_Plugin, const AString & a_Permission, const AString & a_HelpString) override { - lua_rawgeti( LuaState, LUA_REGISTRYINDEX, FuncRef); /* Push function reference */ + UNUSED(a_Plugin); + UNUSED(a_Permission); + + lua_rawgeti(LuaState, LUA_REGISTRYINDEX, FuncRef); /* Push function reference */ tolua_pushcppstring(LuaState, a_Command); tolua_pushcppstring(LuaState, a_HelpString); -- cgit v1.2.3