From 8ad7d81c9a70ee998707aabdf6e07db5cc8d8a44 Mon Sep 17 00:00:00 2001 From: Isaac Torres Date: Wed, 6 Mar 2024 16:00:06 -0800 Subject: [PATCH 1/3] fix: support llvm-14 libc++ The memory_resource header is still experimental in llvm-14's standard library implementation. This adds a macro that can be enabled when we are compiling with this toolchain and standard library so the proper header is included. --- src/agrpc/detail/memory_resource_std_pmr.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/agrpc/detail/memory_resource_std_pmr.hpp b/src/agrpc/detail/memory_resource_std_pmr.hpp index 8b845b6f..42b73c52 100644 --- a/src/agrpc/detail/memory_resource_std_pmr.hpp +++ b/src/agrpc/detail/memory_resource_std_pmr.hpp @@ -17,13 +17,21 @@ #include +#ifndef SWIFTNAV_EXPERIMENTAL_MEMORY_RESOURCE #include +#else +#include +#endif AGRPC_NAMESPACE_BEGIN() namespace detail { +#ifndef SWIFTNAV_EXPERIMENTAL_MEMORY_RESOURCE namespace pmr = std::pmr; +#else +namespace pmr = std::experimental::pmr; +#endif namespace container = std; } From 902b093cae02397ce4bad81d777715df574f9d8d Mon Sep 17 00:00:00 2001 From: Isaac Torres Date: Mon, 25 Mar 2024 15:14:32 -0700 Subject: [PATCH 2/3] refactor to match existing project conventions --- src/agrpc/detail/memory_resource.hpp | 2 ++ src/agrpc/detail/memory_resource_std_pmr.hpp | 9 ------ .../memory_resource_std_pmr_experimental.hpp | 31 +++++++++++++++++++ 3 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 src/agrpc/detail/memory_resource_std_pmr_experimental.hpp diff --git a/src/agrpc/detail/memory_resource.hpp b/src/agrpc/detail/memory_resource.hpp index e517a548..02d7b52a 100644 --- a/src/agrpc/detail/memory_resource.hpp +++ b/src/agrpc/detail/memory_resource.hpp @@ -16,6 +16,8 @@ #include #elif defined(AGRPC_USE_BOOST_CONTAINER) #include +#elif defined(SWIFTNAV_EXPERIMENTAL_MEMORY_RESOURCE) +#include #else #include #endif diff --git a/src/agrpc/detail/memory_resource_std_pmr.hpp b/src/agrpc/detail/memory_resource_std_pmr.hpp index 42b73c52..48c79a95 100644 --- a/src/agrpc/detail/memory_resource_std_pmr.hpp +++ b/src/agrpc/detail/memory_resource_std_pmr.hpp @@ -16,22 +16,13 @@ #define AGRPC_DETAIL_MEMORY_RESOURCE_HPP #include - -#ifndef SWIFTNAV_EXPERIMENTAL_MEMORY_RESOURCE #include -#else -#include -#endif AGRPC_NAMESPACE_BEGIN() namespace detail { -#ifndef SWIFTNAV_EXPERIMENTAL_MEMORY_RESOURCE namespace pmr = std::pmr; -#else -namespace pmr = std::experimental::pmr; -#endif namespace container = std; } diff --git a/src/agrpc/detail/memory_resource_std_pmr_experimental.hpp b/src/agrpc/detail/memory_resource_std_pmr_experimental.hpp new file mode 100644 index 00000000..cee38135 --- /dev/null +++ b/src/agrpc/detail/memory_resource_std_pmr_experimental.hpp @@ -0,0 +1,31 @@ +// Copyright 2023 Dennis Hezel +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef AGRPC_DETAIL_MEMORY_RESOURCE_EXPERIMENTAL_HPP +#define AGRPC_DETAIL_MEMORY_RESOURCE_EXPERIMENTAL_HPP + +#include +#include + +AGRPC_NAMESPACE_BEGIN() + +namespace detail +{ +namespace pmr = std::experimental::pmr; +namespace container = std; +} + +AGRPC_NAMESPACE_END + +#endif // AGRPC_DETAIL_MEMORY_RESOURCE_EXPERIMENTAL_HPP From 47ed2638f4ab7ad6e46c6f05dec19354ed31c36c Mon Sep 17 00:00:00 2001 From: Isaac Torres Date: Mon, 25 Mar 2024 15:26:03 -0700 Subject: [PATCH 3/3] fix --- src/agrpc/detail/memory_resource_std_pmr.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/agrpc/detail/memory_resource_std_pmr.hpp b/src/agrpc/detail/memory_resource_std_pmr.hpp index 48c79a95..8b845b6f 100644 --- a/src/agrpc/detail/memory_resource_std_pmr.hpp +++ b/src/agrpc/detail/memory_resource_std_pmr.hpp @@ -16,6 +16,7 @@ #define AGRPC_DETAIL_MEMORY_RESOURCE_HPP #include + #include AGRPC_NAMESPACE_BEGIN()