From 07e7cdcfa3b2902a5f5c36024aabc7c79bab2f04 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Tue, 1 Oct 2024 22:50:19 +0200 Subject: [PATCH] Check if __cpp_lib_smart_ptr_for_overwrite is defined before using it --- common/wivrn_sockets.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/wivrn_sockets.cpp b/common/wivrn_sockets.cpp index c5764d04..4db9da8a 100644 --- a/common/wivrn_sockets.cpp +++ b/common/wivrn_sockets.cpp @@ -260,7 +260,7 @@ std::pair xrt::driver size_t size = recvfrom(fd, nullptr, 0, MSG_PEEK | MSG_TRUNC, (sockaddr *)&addr, &addrlen); -#if __cpp_lib_smart_ptr_for_overwrite >= 202002L +#if defined(__cpp_lib_smart_ptr_for_overwrite) && __cpp_lib_smart_ptr_for_overwrite >= 202002L auto buffer = std::make_shared_for_overwrite(size); #else std::shared_ptr buffer(new uint8_t[size]); @@ -296,7 +296,7 @@ xrt::drivers::wivrn::deserialization_packet xrt::drivers::wivrn::UDP::receive_ra static const size_t message_size = 2048; static const size_t num_messages = 20; -#if __cpp_lib_smart_ptr_for_overwrite >= 202002L +#if defined(__cpp_lib_smart_ptr_for_overwrite) && __cpp_lib_smart_ptr_for_overwrite >= 202002L buffer = std::make_shared_for_overwrite(message_size * num_messages); #else buffer.reset(new uint8_t[message_size * num_messages]); @@ -378,7 +378,7 @@ xrt::drivers::wivrn::deserialization_packet xrt::drivers::wivrn::TCP::receive_ra size_t new_size = std::max(data.size_bytes() + expected_size, 4096); auto old = std::move(buffer); -#if __cpp_lib_smart_ptr_for_overwrite >= 202002L +#if defined(__cpp_lib_smart_ptr_for_overwrite) && __cpp_lib_smart_ptr_for_overwrite >= 202002L buffer = std::make_shared_for_overwrite(new_size); #else buffer.reset(new uint8_t[new_size]);