]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
sync up LuaContext with master, plus include fix for building against recent boost
authorbert hubert <bert.hubert@netherlabs.nl>
Sun, 26 Apr 2015 18:13:11 +0000 (20:13 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Sun, 26 Apr 2015 18:13:11 +0000 (20:13 +0200)
pdns/ext/luawrapper/include/LuaContext.hpp

index 6562c0dfc53e938d1f21135094f9edbcb98a5d33..0794b2e81fc43dae217f3b1a7ded6fc880e50b60 100644 (file)
@@ -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<typename TFunctionType, typename TRetValue, typename TObject, typename... TOtherParams>
     void registerFunctionImpl(const std::string& functionName, TFunctionType function, tag<TObject>, tag<TRetValue (TOtherParams...)>)
     {
-        static_assert(std::is_class<TObject>::value || std::is_pointer<TObject>::value || std::is_union<TObject>::value , "registerFunction can only be used for a class or a pointer");
+        static_assert(std::is_class<TObject>::value || std::is_pointer<TObject>::value || std::is_union<TObject>::value , "registerFunction can only be used for a class a union or a pointer");
 
         checkTypeRegistration(mState, &typeid(TObject));
         setTable<TRetValue(TObject&, TOtherParams...)>(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<typename TFirst, typename... TTypes>
-struct LuaContext::PusherMinSize<TFirst, TTypes...> { static const int size = Pusher<typename std::decay<TFirst>::type>::minSize < PusherTotalMaxSize<TTypes...>::size ? Pusher<typename std::decay<TFirst>::type>::minSize : PusherMinSize<TTypes...>::size; };
-template<>
-struct LuaContext::PusherMinSize<> { static const int size = 0; };
+template<typename TFirst, typename TSecond, typename... TTypes>
+struct LuaContext::PusherMinSize<TFirst, TSecond, TTypes...> 
+{ 
+    static const int size = Pusher<typename std::decay<TFirst>::type>::minSize < Pusher<typename std::decay<TSecond>::type>::minSize 
+                            ? 
+                            PusherMinSize<typename std::decay<TFirst>::type, TTypes...>::size 
+                            : 
+                            PusherMinSize<typename std::decay<TSecond>::type, TTypes...>::size;
+};
+
+template<typename TFirst>
+struct LuaContext::PusherMinSize<TFirst> { static const int size = Pusher<typename std::decay<TFirst>::type>::minSize; };
 
 // implementation of PusherMaxSize
 template<typename TFirst, typename... TTypes>