From: bert hubert Date: Sun, 26 Apr 2015 18:13:11 +0000 (+0200) Subject: sync up LuaContext with master, plus include fix for building against recent boost X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~88^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ed34973d72735771ab79737713a2727f4c86fdb;p=thirdparty%2Fpdns.git sync up LuaContext with master, plus include fix for building against recent boost --- diff --git a/pdns/ext/luawrapper/include/LuaContext.hpp b/pdns/ext/luawrapper/include/LuaContext.hpp index 6562c0dfc5..0794b2e81f 100644 --- a/pdns/ext/luawrapper/include/LuaContext.hpp +++ b/pdns/ext/luawrapper/include/LuaContext.hpp @@ -58,6 +58,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # include "misc/exception.hpp" #endif +#ifdef __GNUC__ +# define ATTR_UNUSED __attribute__((unused)) +#else +# define ATTR_UNUSED +#endif + /** * Defines a Lua context * A Lua context is used to interpret Lua code. Since everything in Lua is a variable (including functions), @@ -1041,7 +1047,7 @@ private: template void registerFunctionImpl(const std::string& functionName, TFunctionType function, tag, tag) { - static_assert(std::is_class::value || std::is_pointer::value || std::is_union::value , "registerFunction can only be used for a class or a pointer"); + static_assert(std::is_class::value || std::is_pointer::value || std::is_union::value , "registerFunction can only be used for a class a union or a pointer"); checkTypeRegistration(mState, &typeid(TObject)); setTable(mState, Registry, &typeid(TObject), 0, functionName, std::move(function)); @@ -1702,11 +1708,11 @@ private: }; /// @deprecated -//static LuaContext::EmptyArray_t -// LuaEmptyArray {}; +static LuaContext::EmptyArray_t ATTR_UNUSED + LuaEmptyArray {}; /// @deprecated -//static LuaContext::Metatable_t -// LuaMetatable {}; +static LuaContext::Metatable_t ATTR_UNUSED + LuaMetatable {}; /**************************************************/ /* PARTIAL IMPLEMENTATIONS */ @@ -1756,10 +1762,18 @@ template<> struct LuaContext::PusherTotalMaxSize<> { static const int size = 0; }; // implementation of PusherMinSize -template -struct LuaContext::PusherMinSize { static const int size = Pusher::type>::minSize < PusherTotalMaxSize::size ? Pusher::type>::minSize : PusherMinSize::size; }; -template<> -struct LuaContext::PusherMinSize<> { static const int size = 0; }; +template +struct LuaContext::PusherMinSize +{ + static const int size = Pusher::type>::minSize < Pusher::type>::minSize + ? + PusherMinSize::type, TTypes...>::size + : + PusherMinSize::type, TTypes...>::size; +}; + +template +struct LuaContext::PusherMinSize { static const int size = Pusher::type>::minSize; }; // implementation of PusherMaxSize template