From: Remi Gacogne Date: Thu, 11 Dec 2025 10:29:33 +0000 (+0100) Subject: LuaWrapper: Fix C++11 compatibility X-Git-Tag: rec-5.4.0-beta1~57^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99d46e343d9b353b5d1f2c701994911a23d65e0d;p=thirdparty%2Fpdns.git LuaWrapper: Fix C++11 compatibility Signed-off-by: Remi Gacogne --- diff --git a/ext/luawrapper/include/LuaContext.hpp b/ext/luawrapper/include/LuaContext.hpp index 97530a52ef..90246dfef1 100644 --- a/ext/luawrapper/include/LuaContext.hpp +++ b/ext/luawrapper/include/LuaContext.hpp @@ -38,7 +38,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include #include #include #include @@ -47,7 +46,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include #include #include #include @@ -57,6 +55,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#if __cplusplus >= 201703L +#include +#include +#endif /* C++17 */ + // Set the older gcc define for tsan if clang or modern gcc tell us we have tsan. #if defined(__has_feature) #if __has_feature(thread_sanitizer) @@ -2002,8 +2005,10 @@ struct LuaContext::FunctionArgumentsCounter<> { // implementation of IsOptional template struct LuaContext::IsOptional> : public std::true_type {}; +#if __cplusplus >= 201703L template struct LuaContext::IsOptional> : public std::true_type {}; +#endif /* C++ 17 */ // implementation of LuaFunctionCaller template @@ -2557,6 +2562,7 @@ private: }; }; +#if __cplusplus >= 201703L // std::variant template struct LuaContext::Pusher> @@ -2573,6 +2579,7 @@ struct LuaContext::Pusher> return obj; } }; +#endif /* C++17 */ // boost::optional template @@ -2593,6 +2600,7 @@ struct LuaContext::Pusher> { } }; +#if __cplusplus >= 201703L // std::optional template struct LuaContext::Pusher> { @@ -2611,6 +2619,7 @@ struct LuaContext::Pusher> { } } }; +#endif /* C++17 */ // tuple template @@ -2961,6 +2970,7 @@ struct LuaContext::Reader> } }; +#if __cplusplus >= 201703L // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) template struct LuaContext::Reader> @@ -2978,6 +2988,7 @@ struct LuaContext::Reader> } }; // NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks) +#endif /* C++ 17 */ // boost::variant template @@ -3026,6 +3037,7 @@ public: } }; +#if __cplusplus >= 201703L // std::variant template struct LuaContext::Reader> @@ -3059,6 +3071,7 @@ public: return variantRead(state, index); } }; +#endif /* C++ 17 */ // reading a tuple // tuple have an additional argument for their functions, that is the maximum size to read