From 9314fe5f75c41384f964270194ecd73da0d5e273 Mon Sep 17 00:00:00 2001 From: Dennis Hezel Date: Sun, 7 Apr 2024 12:12:34 +0200 Subject: [PATCH] feat: Prevent macros from leaking into user code --- .clang-format | 10 ++++ example/helper/one_shot_allocator.hpp | 2 - example/snippets/alarm.cpp | 1 + src/agrpc/alarm.hpp | 5 +- src/agrpc/client_rpc.hpp | 5 +- src/agrpc/default_server_rpc_traits.hpp | 2 + src/agrpc/detail/alarm.hpp | 4 +- src/agrpc/detail/algorithm.hpp | 4 +- src/agrpc/detail/allocate.hpp | 3 +- src/agrpc/detail/allocate_operation.hpp | 3 +- src/agrpc/detail/asio_forward.hpp | 50 +++---------------- src/agrpc/detail/asio_macros.hpp | 48 ++++++++++++++++++ src/agrpc/detail/asio_utils.hpp | 4 +- src/agrpc/detail/association_asio.hpp | 3 +- src/agrpc/detail/association_execution.hpp | 3 +- src/agrpc/detail/atomic_bool_stop_context.hpp | 4 +- src/agrpc/detail/atomic_intrusive_queue.hpp | 3 +- src/agrpc/detail/awaitable.hpp | 5 +- src/agrpc/detail/backoff.hpp | 3 +- src/agrpc/detail/basic_sender.hpp | 3 +- src/agrpc/detail/bind_allocator.hpp | 4 +- src/agrpc/detail/client_rpc_base.hpp | 3 +- src/agrpc/detail/client_rpc_context_base.hpp | 3 +- src/agrpc/detail/client_rpc_sender.hpp | 4 +- src/agrpc/detail/config.hpp | 25 +++++++--- src/agrpc/detail/coroutine_traits.hpp | 1 + .../create_and_submit_no_arg_operation.hpp | 3 +- src/agrpc/detail/default_completion_token.hpp | 3 +- src/agrpc/detail/epilogue.hpp | 33 ++++++++++++ src/agrpc/detail/execution_asio.hpp | 1 + src/agrpc/detail/execution_stdexec.hpp | 5 +- src/agrpc/detail/execution_unifex.hpp | 3 +- src/agrpc/detail/executor_with_default.hpp | 1 + src/agrpc/detail/forward.hpp | 3 +- src/agrpc/detail/functional.hpp | 3 +- src/agrpc/detail/grpc_context.hpp | 3 +- src/agrpc/detail/grpc_context.ipp | 3 +- .../detail/grpc_context_implementation.hpp | 3 +- src/agrpc/detail/grpc_executor_base.hpp | 3 +- src/agrpc/detail/grpc_executor_options.hpp | 4 +- src/agrpc/detail/grpc_sender.hpp | 3 +- .../health_check_repeatedly_request.hpp | 3 +- src/agrpc/detail/health_check_service.hpp | 9 ++-- .../detail/initiate_sender_implementation.hpp | 3 +- src/agrpc/detail/intrusive_circular_list.hpp | 4 +- src/agrpc/detail/intrusive_list.hpp | 4 +- src/agrpc/detail/intrusive_queue.hpp | 4 +- src/agrpc/detail/intrusive_slist.hpp | 4 +- src/agrpc/detail/manual_reset_event.hpp | 3 +- .../detail/manual_reset_event_operation.ipp | 4 +- src/agrpc/detail/math.hpp | 4 +- src/agrpc/detail/memory.hpp | 4 +- src/agrpc/detail/name.hpp | 3 +- src/agrpc/detail/notify_on_state_change.hpp | 3 +- src/agrpc/detail/notify_when_done_event.hpp | 3 +- src/agrpc/detail/operation.hpp | 3 +- src/agrpc/detail/operation_base.hpp | 3 +- src/agrpc/detail/operation_handle.hpp | 3 +- src/agrpc/detail/operation_implementation.hpp | 3 +- src/agrpc/detail/operation_initiation.hpp | 3 +- src/agrpc/detail/pool_resource.hpp | 3 +- src/agrpc/detail/pool_resource_allocator.hpp | 3 +- src/agrpc/detail/query_grpc_context.hpp | 8 +-- src/agrpc/detail/receiver.hpp | 3 +- .../detail/register_awaitable_rpc_handler.hpp | 5 +- .../detail/register_callback_rpc_handler.hpp | 3 +- .../detail/register_rpc_handler_asio_base.hpp | 3 +- .../detail/register_rpc_handler_base.hpp | 3 +- .../detail/register_sender_rpc_handler.hpp | 3 +- .../detail/register_yield_rpc_handler.hpp | 5 +- src/agrpc/detail/rethrow_first_arg.hpp | 4 +- src/agrpc/detail/rpc_executor_base.hpp | 3 +- src/agrpc/detail/rpc_request.hpp | 3 +- src/agrpc/detail/rpc_type.hpp | 3 +- src/agrpc/detail/schedule_sender.hpp | 3 +- .../sender_implementation_operation.hpp | 3 +- src/agrpc/detail/sender_of.hpp | 3 +- src/agrpc/detail/server_rpc_base.hpp | 3 +- src/agrpc/detail/server_rpc_context_base.hpp | 3 +- .../server_rpc_notify_when_done_base.hpp | 3 +- .../server_rpc_notify_when_done_mixin.hpp | 3 +- src/agrpc/detail/server_rpc_sender.hpp | 3 +- src/agrpc/detail/server_write_reactor.hpp | 3 +- src/agrpc/detail/start_server_rpc.hpp | 3 +- src/agrpc/detail/stop_callback_lifetime.hpp | 3 +- src/agrpc/detail/submit.hpp | 3 +- src/agrpc/detail/test.hpp | 3 +- src/agrpc/detail/tuple.hpp | 3 +- src/agrpc/detail/use_sender.hpp | 3 +- src/agrpc/detail/utility.hpp | 12 +---- src/agrpc/detail/waiter.hpp | 3 +- .../work_tracking_completion_handler.hpp | 4 +- src/agrpc/grpc_context.hpp | 5 +- src/agrpc/grpc_executor.hpp | 5 +- src/agrpc/health_check_service.hpp | 9 ++-- src/agrpc/notify_on_state_change.hpp | 5 +- src/agrpc/read.hpp | 5 +- src/agrpc/register_awaitable_rpc_handler.hpp | 4 +- src/agrpc/register_callback_rpc_handler.hpp | 2 + src/agrpc/register_sender_rpc_handler.hpp | 2 + src/agrpc/register_yield_rpc_handler.hpp | 3 +- src/agrpc/rpc_type.hpp | 2 + src/agrpc/run.hpp | 5 +- src/agrpc/server_rpc.hpp | 5 +- src/agrpc/server_rpc_ptr.hpp | 5 +- src/agrpc/test.hpp | 5 +- src/agrpc/use_sender.hpp | 5 +- src/agrpc/waiter.hpp | 5 +- test/src/test_alarm_17.cpp | 2 +- test/src/test_alarm_20.cpp | 4 +- test/src/test_bind_allocator_20.cpp | 2 +- test/src/test_client_rpc_17.cpp | 2 +- test/src/test_grpc_context_20.cpp | 4 +- test/src/test_server_rpc_17.cpp | 2 +- test/src/test_server_rpc_20.cpp | 4 +- test/src/test_waiter_17.cpp | 2 +- test/utils/utils/asio_forward.hpp | 50 ++++++++++++++----- test/utils/utils/asio_utils.cpp | 2 +- test/utils/utils/asio_utils.hpp | 2 +- 119 files changed, 408 insertions(+), 205 deletions(-) create mode 100644 src/agrpc/detail/asio_macros.hpp create mode 100644 src/agrpc/detail/epilogue.hpp diff --git a/.clang-format b/.clang-format index 2af7ee9e..a6ebb263 100644 --- a/.clang-format +++ b/.clang-format @@ -72,6 +72,16 @@ ForEachMacros: - foreach IncludeBlocks: Regroup IncludeCategories: + # epilogue + - Regex: 'agrpc/detail/epilogue\.hpp' + Priority: 5 + SortPriority: 0 + CaseSensitive: false + # config + - Regex: 'agrpc/detail/(config|awaitable|asio_macros)\.hpp' + Priority: 4 + SortPriority: 0 + CaseSensitive: false # Headers in <> without extension. - Regex: '<([A-Za-z0-9\Q/-_\E])+>' Priority: 3 diff --git a/example/helper/one_shot_allocator.hpp b/example/helper/one_shot_allocator.hpp index a60e80e9..732c1915 100644 --- a/example/helper/one_shot_allocator.hpp +++ b/example/helper/one_shot_allocator.hpp @@ -15,8 +15,6 @@ #ifndef AGRPC_HELPER_ONE_SHOT_ALLOCATOR_HPP #define AGRPC_HELPER_ONE_SHOT_ALLOCATOR_HPP -#include - #include #include #include diff --git a/example/snippets/alarm.cpp b/example/snippets/alarm.cpp index 5ae0df1e..804c7de9 100644 --- a/example/snippets/alarm.cpp +++ b/example/snippets/alarm.cpp @@ -15,6 +15,7 @@ #include "helper.hpp" #include +#include #include #include #include diff --git a/src/agrpc/alarm.hpp b/src/agrpc/alarm.hpp index df504e45..e2e7256d 100644 --- a/src/agrpc/alarm.hpp +++ b/src/agrpc/alarm.hpp @@ -17,13 +17,14 @@ #include #include -#include #include #include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() /** @@ -175,4 +176,6 @@ using Alarm = agrpc::BasicAlarm; AGRPC_NAMESPACE_END +#include + #endif // AGRPC_AGRPC_ALARM_HPP diff --git a/src/agrpc/client_rpc.hpp b/src/agrpc/client_rpc.hpp index 97de1de9..bf6ff63f 100644 --- a/src/agrpc/client_rpc.hpp +++ b/src/agrpc/client_rpc.hpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -26,6 +25,8 @@ #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail @@ -1179,4 +1180,6 @@ using GenericStreamingClientRPC = agrpc::ClientRPC + #endif // AGRPC_AGRPC_CLIENT_RPC_HPP diff --git a/src/agrpc/default_server_rpc_traits.hpp b/src/agrpc/default_server_rpc_traits.hpp index 946d4bad..b858d2a6 100644 --- a/src/agrpc/default_server_rpc_traits.hpp +++ b/src/agrpc/default_server_rpc_traits.hpp @@ -26,4 +26,6 @@ struct DefaultServerRPCTraits AGRPC_NAMESPACE_END +#include + #endif // AGRPC_AGRPC_DEFAULT_SERVER_RPC_TRAITS_HPP diff --git a/src/agrpc/detail/alarm.hpp b/src/agrpc/detail/alarm.hpp index 1019b227..4ef6a791 100644 --- a/src/agrpc/detail/alarm.hpp +++ b/src/agrpc/detail/alarm.hpp @@ -15,11 +15,13 @@ #ifndef AGRPC_DETAIL_ALARM_HPP #define AGRPC_DETAIL_ALARM_HPP -#include #include #include #include +#include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/algorithm.hpp b/src/agrpc/detail/algorithm.hpp index 80bf9f77..519b24ea 100644 --- a/src/agrpc/detail/algorithm.hpp +++ b/src/agrpc/detail/algorithm.hpp @@ -15,11 +15,11 @@ #ifndef AGRPC_DETAIL_ALGORITHM_HPP #define AGRPC_DETAIL_ALGORITHM_HPP -#include - #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/allocate.hpp b/src/agrpc/detail/allocate.hpp index 8f7d4fc6..7d26af1e 100644 --- a/src/agrpc/detail/allocate.hpp +++ b/src/agrpc/detail/allocate.hpp @@ -15,11 +15,12 @@ #ifndef AGRPC_DETAIL_ALLOCATE_HPP #define AGRPC_DETAIL_ALLOCATE_HPP -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/allocate_operation.hpp b/src/agrpc/detail/allocate_operation.hpp index 52f97a81..6921c264 100644 --- a/src/agrpc/detail/allocate_operation.hpp +++ b/src/agrpc/detail/allocate_operation.hpp @@ -18,11 +18,12 @@ #include #include #include -#include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/asio_forward.hpp b/src/agrpc/detail/asio_forward.hpp index b30d1a59..466e08ce 100644 --- a/src/agrpc/detail/asio_forward.hpp +++ b/src/agrpc/detail/asio_forward.hpp @@ -15,12 +15,9 @@ #ifndef AGRPC_DETAIL_ASIO_FORWARD_HPP #define AGRPC_DETAIL_ASIO_FORWARD_HPP -#include +#include #ifdef AGRPC_STANDALONE_ASIO -// -#include -// #include #include #include @@ -35,32 +32,15 @@ #include #include -#if (ASIO_VERSION >= 101900) +#ifdef AGRPC_ASIO_HAS_CANCELLATION_SLOT #include #include - -#define AGRPC_ASIO_HAS_CANCELLATION_SLOT -#endif - -#if (ASIO_VERSION >= 102201) -#include - -#define AGRPC_ASIO_HAS_BIND_ALLOCATOR -#endif - -#if (ASIO_VERSION >= 102400) -#define AGRPC_ASIO_HAS_NEW_SPAWN #endif -#if (ASIO_VERSION >= 102700) +#ifdef AGRPC_ASIO_HAS_IMMEDIATE_EXECUTOR #include - -#define AGRPC_ASIO_HAS_IMMEDIATE_EXECUTOR #endif #elif defined(AGRPC_BOOST_ASIO) -// -#include -// #include #include #include @@ -75,34 +55,20 @@ #include #include -#if (BOOST_VERSION >= 107700) +#ifdef AGRPC_ASIO_HAS_CANCELLATION_SLOT #include #include - -#define AGRPC_ASIO_HAS_CANCELLATION_SLOT -#endif - -#if (BOOST_VERSION >= 107900) -#include - -#define AGRPC_ASIO_HAS_BIND_ALLOCATOR -#endif - -#if (BOOST_VERSION >= 108000) -#define AGRPC_ASIO_HAS_NEW_SPAWN #endif -#if (BOOST_VERSION >= 108200) +#ifdef AGRPC_ASIO_HAS_IMMEDIATE_EXECUTOR #include - -#define AGRPC_ASIO_HAS_IMMEDIATE_EXECUTOR -#endif #endif - -#if defined(AGRPC_UNIFEX) || defined(AGRPC_STDEXEC) +#else #include #endif +#include + AGRPC_NAMESPACE_BEGIN() #ifdef AGRPC_STANDALONE_ASIO diff --git a/src/agrpc/detail/asio_macros.hpp b/src/agrpc/detail/asio_macros.hpp new file mode 100644 index 00000000..b629d85d --- /dev/null +++ b/src/agrpc/detail/asio_macros.hpp @@ -0,0 +1,48 @@ +// 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. + +#if !defined(AGRPC_ASIO_HAS_CANCELLATION_SLOT) && !defined(AGRPC_ASIO_HAS_NEW_SPAWN) && \ + !defined(AGRPC_ASIO_HAS_IMMEDIATE_EXECUTOR) + +#ifdef AGRPC_STANDALONE_ASIO // standalone Asio +#include + +#if (ASIO_VERSION >= 101900) +#define AGRPC_ASIO_HAS_CANCELLATION_SLOT +#endif + +#if (ASIO_VERSION >= 102400) +#define AGRPC_ASIO_HAS_NEW_SPAWN +#endif + +#if (ASIO_VERSION >= 102700) +#define AGRPC_ASIO_HAS_IMMEDIATE_EXECUTOR +#endif +#elif defined(AGRPC_BOOST_ASIO) // Boost.Asio +#include + +#if (BOOST_VERSION >= 107700) +#define AGRPC_ASIO_HAS_CANCELLATION_SLOT +#endif + +#if (BOOST_VERSION >= 108000) +#define AGRPC_ASIO_HAS_NEW_SPAWN +#endif + +#if (BOOST_VERSION >= 108200) +#define AGRPC_ASIO_HAS_IMMEDIATE_EXECUTOR +#endif +#endif + +#endif diff --git a/src/agrpc/detail/asio_utils.hpp b/src/agrpc/detail/asio_utils.hpp index e760ac3f..623c060c 100644 --- a/src/agrpc/detail/asio_utils.hpp +++ b/src/agrpc/detail/asio_utils.hpp @@ -16,9 +16,11 @@ #define AGRPC_DETAIL_ASIO_UTILS_HPP #include -#include #include +#include +#include + #if defined(AGRPC_STANDALONE_ASIO) || defined(AGRPC_BOOST_ASIO) AGRPC_NAMESPACE_BEGIN() diff --git a/src/agrpc/detail/association_asio.hpp b/src/agrpc/detail/association_asio.hpp index 8f15c3ed..4ec58b7c 100644 --- a/src/agrpc/detail/association_asio.hpp +++ b/src/agrpc/detail/association_asio.hpp @@ -16,9 +16,10 @@ #define AGRPC_DETAIL_ASSOCIATION_ASIO_HPP #include -#include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/association_execution.hpp b/src/agrpc/detail/association_execution.hpp index 90545090..176c38de 100644 --- a/src/agrpc/detail/association_execution.hpp +++ b/src/agrpc/detail/association_execution.hpp @@ -15,9 +15,10 @@ #ifndef AGRPC_DETAIL_ASSOCIATION_EXECUTION_HPP #define AGRPC_DETAIL_ASSOCIATION_EXECUTION_HPP -#include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/atomic_bool_stop_context.hpp b/src/agrpc/detail/atomic_bool_stop_context.hpp index ac608f68..ac3b05c4 100644 --- a/src/agrpc/detail/atomic_bool_stop_context.hpp +++ b/src/agrpc/detail/atomic_bool_stop_context.hpp @@ -16,13 +16,15 @@ #define AGRPC_DETAIL_ATOMIC_BOOL_STOP_CONTEXT_HPP #include -#include #include #include #include #include +#include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/atomic_intrusive_queue.hpp b/src/agrpc/detail/atomic_intrusive_queue.hpp index 1cd6c68b..06a973c9 100644 --- a/src/agrpc/detail/atomic_intrusive_queue.hpp +++ b/src/agrpc/detail/atomic_intrusive_queue.hpp @@ -15,12 +15,13 @@ #ifndef AGRPC_DETAIL_ATOMIC_INTRUSIVE_QUEUE_HPP #define AGRPC_DETAIL_ATOMIC_INTRUSIVE_QUEUE_HPP -#include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/awaitable.hpp b/src/agrpc/detail/awaitable.hpp index 898f5420..6b196ba1 100644 --- a/src/agrpc/detail/awaitable.hpp +++ b/src/agrpc/detail/awaitable.hpp @@ -12,8 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef AGRPC_DETAIL_AWAITABLE_HPP -#define AGRPC_DETAIL_AWAITABLE_HPP +#ifndef AGRPC_ASIO_HAS_CO_AWAIT #ifdef AGRPC_STANDALONE_ASIO #include @@ -33,4 +32,4 @@ #endif #endif -#endif // AGRPC_DETAIL_AWAITABLE_HPP +#endif diff --git a/src/agrpc/detail/backoff.hpp b/src/agrpc/detail/backoff.hpp index a255f25d..3e332b46 100644 --- a/src/agrpc/detail/backoff.hpp +++ b/src/agrpc/detail/backoff.hpp @@ -15,12 +15,13 @@ #ifndef AGRPC_DETAIL_BACKOFF_HPP #define AGRPC_DETAIL_BACKOFF_HPP -#include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/basic_sender.hpp b/src/agrpc/detail/basic_sender.hpp index 10f623ac..e292b85f 100644 --- a/src/agrpc/detail/basic_sender.hpp +++ b/src/agrpc/detail/basic_sender.hpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -30,6 +29,8 @@ #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/bind_allocator.hpp b/src/agrpc/detail/bind_allocator.hpp index a41ffb38..f78bfb72 100644 --- a/src/agrpc/detail/bind_allocator.hpp +++ b/src/agrpc/detail/bind_allocator.hpp @@ -16,11 +16,13 @@ #define AGRPC_DETAIL_BIND_ALLOCATOR_HPP #include -#include #include #include +#include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/client_rpc_base.hpp b/src/agrpc/detail/client_rpc_base.hpp index c6f49d8b..cde0a497 100644 --- a/src/agrpc/detail/client_rpc_base.hpp +++ b/src/agrpc/detail/client_rpc_base.hpp @@ -17,11 +17,12 @@ #include #include -#include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/client_rpc_context_base.hpp b/src/agrpc/detail/client_rpc_context_base.hpp index 5d3f5913..e48f8686 100644 --- a/src/agrpc/detail/client_rpc_context_base.hpp +++ b/src/agrpc/detail/client_rpc_context_base.hpp @@ -15,10 +15,11 @@ #ifndef AGRPC_DETAIL_CLIENT_RPC_CONTEXT_BASE_HPP #define AGRPC_DETAIL_CLIENT_RPC_CONTEXT_BASE_HPP -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/client_rpc_sender.hpp b/src/agrpc/detail/client_rpc_sender.hpp index bb72e4c7..69414dd0 100644 --- a/src/agrpc/detail/client_rpc_sender.hpp +++ b/src/agrpc/detail/client_rpc_sender.hpp @@ -16,7 +16,6 @@ #define AGRPC_DETAIL_CLIENT_RPC_SENDER_HPP #include -#include #include #include #include @@ -25,6 +24,9 @@ #include #include +#include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/config.hpp b/src/agrpc/detail/config.hpp index 2401379c..35c3e27f 100644 --- a/src/agrpc/detail/config.hpp +++ b/src/agrpc/detail/config.hpp @@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef AGRPC_DETAIL_CONFIG_HPP -#define AGRPC_DETAIL_CONFIG_HPP - #ifdef __has_include #if __has_include() #include #endif #endif +// Unlikely +#ifndef AGRPC_UNLIKELY + #ifdef __has_cpp_attribute #if __has_cpp_attribute(unlikely) && ((defined(_MSVC_LANG) && _MSVC_LANG > 201703L) || __cplusplus > 201703L) #if (defined(__GNUC__) && __GNUC__ > 9) || !defined(__GNUC__) @@ -37,6 +37,11 @@ #endif #endif +#endif + +// Likely +#ifndef AGRPC_LIKELY + #ifdef __has_cpp_attribute #if __has_cpp_attribute(likely) && ((defined(_MSVC_LANG) && _MSVC_LANG > 201703L) || __cplusplus > 201703L) #if (defined(__GNUC__) && __GNUC__ > 9) || !defined(__GNUC__) @@ -53,14 +58,14 @@ #endif #endif -#if __cpp_concepts >= 201907L -#define AGRPC_HAS_CONCEPTS #endif +// Try-catch +#ifndef AGRPC_TRY + #if __cpp_exceptions >= 199711L #define AGRPC_TRY try #define AGRPC_CATCH(...) catch (__VA_ARGS__) -#define AGRPC_RETHROW() throw #else #define AGRPC_TRY #define AGRPC_CATCH(...) \ @@ -68,9 +73,13 @@ { \ } \ else -#define AGRPC_RETHROW() ((void)0) #endif +#endif + +// Namespace +#ifndef AGRPC_NAMESPACE_BEGIN + #ifdef AGRPC_GENERATING_DOCUMENTATION #define AGRPC_NAMESPACE_BEGIN() \ namespace agrpc \ @@ -141,4 +150,4 @@ static_assert(false, } #endif -#endif // AGRPC_DETAIL_CONFIG_HPP +#endif diff --git a/src/agrpc/detail/coroutine_traits.hpp b/src/agrpc/detail/coroutine_traits.hpp index ba64f6a1..ebe3aecc 100644 --- a/src/agrpc/detail/coroutine_traits.hpp +++ b/src/agrpc/detail/coroutine_traits.hpp @@ -16,6 +16,7 @@ #define AGRPC_DETAIL_COROUTINE_TRAITS_HPP #include + #include #include diff --git a/src/agrpc/detail/create_and_submit_no_arg_operation.hpp b/src/agrpc/detail/create_and_submit_no_arg_operation.hpp index 1d285543..a69acf7e 100644 --- a/src/agrpc/detail/create_and_submit_no_arg_operation.hpp +++ b/src/agrpc/detail/create_and_submit_no_arg_operation.hpp @@ -16,11 +16,12 @@ #define AGRPC_DETAIL_CREATE_AND_SUBMIT_NO_ARG_OPERATION_HPP #include -#include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/default_completion_token.hpp b/src/agrpc/detail/default_completion_token.hpp index 7871b674..b7d65315 100644 --- a/src/agrpc/detail/default_completion_token.hpp +++ b/src/agrpc/detail/default_completion_token.hpp @@ -16,9 +16,10 @@ #define AGRPC_DETAIL_DEFAULT_COMPLETION_TOKEN_HPP #include -#include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/epilogue.hpp b/src/agrpc/detail/epilogue.hpp new file mode 100644 index 00000000..21d18649 --- /dev/null +++ b/src/agrpc/detail/epilogue.hpp @@ -0,0 +1,33 @@ +// 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. + +// config.hpp +#undef AGRPC_UNLIKELY +#undef AGRPC_LIKELY + +#undef AGRPC_TRY +#undef AGRPC_CATCH + +#undef AGRPC_NAMESPACE_BEGIN + +#undef AGRPC_NAMESPACE_END + +// asio_forward.hpp +#undef AGRPC_ASIO_HAS_CANCELLATION_SLOT +#undef AGRPC_ASIO_HAS_BIND_ALLOCATOR +#undef AGRPC_ASIO_HAS_NEW_SPAWN +#undef AGRPC_ASIO_HAS_IMMEDIATE_EXECUTOR + +// awaitable.hpp +#undef AGRPC_ASIO_HAS_CO_AWAIT \ No newline at end of file diff --git a/src/agrpc/detail/execution_asio.hpp b/src/agrpc/detail/execution_asio.hpp index f0e77b0d..d9393545 100644 --- a/src/agrpc/detail/execution_asio.hpp +++ b/src/agrpc/detail/execution_asio.hpp @@ -16,6 +16,7 @@ #define AGRPC_DETAIL_EXECUTION_ASIO_HPP #include + #include AGRPC_NAMESPACE_BEGIN() diff --git a/src/agrpc/detail/execution_stdexec.hpp b/src/agrpc/detail/execution_stdexec.hpp index 0044748f..d1b3a762 100644 --- a/src/agrpc/detail/execution_stdexec.hpp +++ b/src/agrpc/detail/execution_stdexec.hpp @@ -15,10 +15,11 @@ #ifndef AGRPC_DETAIL_EXECUTION_STDEXEC_HPP #define AGRPC_DETAIL_EXECUTION_STDEXEC_HPP -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail::exec @@ -28,7 +29,7 @@ using ::stdexec::get_allocator_t; struct GetAllocatorFn { template - decltype(auto) operator()(const Receiver & receiver) const + decltype(auto) operator()(const Receiver& receiver) const { if constexpr (::stdexec::tag_invocable<::stdexec::get_allocator_t, ::stdexec::env_of_t>) { diff --git a/src/agrpc/detail/execution_unifex.hpp b/src/agrpc/detail/execution_unifex.hpp index 54e22e43..1bfb6fb0 100644 --- a/src/agrpc/detail/execution_unifex.hpp +++ b/src/agrpc/detail/execution_unifex.hpp @@ -15,7 +15,6 @@ #ifndef AGRPC_DETAIL_EXECUTION_UNIFEX_HPP #define AGRPC_DETAIL_EXECUTION_UNIFEX_HPP -#include #include #include #include @@ -28,6 +27,8 @@ #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail::exec diff --git a/src/agrpc/detail/executor_with_default.hpp b/src/agrpc/detail/executor_with_default.hpp index 082b03d2..7d356a66 100644 --- a/src/agrpc/detail/executor_with_default.hpp +++ b/src/agrpc/detail/executor_with_default.hpp @@ -16,6 +16,7 @@ #define AGRPC_DETAIL_EXECUTOR_WITH_DEFAULT_HPP #include + #include AGRPC_NAMESPACE_BEGIN() diff --git a/src/agrpc/detail/forward.hpp b/src/agrpc/detail/forward.hpp index 15183d98..554cc039 100644 --- a/src/agrpc/detail/forward.hpp +++ b/src/agrpc/detail/forward.hpp @@ -15,11 +15,12 @@ #ifndef AGRPC_DETAIL_FORWARD_HPP #define AGRPC_DETAIL_FORWARD_HPP -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() template , std::uint32_t Options = detail::GrpcExecutorOptions::DEFAULT> diff --git a/src/agrpc/detail/functional.hpp b/src/agrpc/detail/functional.hpp index b33eb0e5..a4aaf3c5 100644 --- a/src/agrpc/detail/functional.hpp +++ b/src/agrpc/detail/functional.hpp @@ -15,11 +15,12 @@ #ifndef AGRPC_DETAIL_FUNCTIONAL_HPP #define AGRPC_DETAIL_FUNCTIONAL_HPP -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/grpc_context.hpp b/src/agrpc/detail/grpc_context.hpp index 16f55460..a084838a 100644 --- a/src/agrpc/detail/grpc_context.hpp +++ b/src/agrpc/detail/grpc_context.hpp @@ -15,13 +15,14 @@ #ifndef AGRPC_DETAIL_GRPC_CONTEXT_HPP #define AGRPC_DETAIL_GRPC_CONTEXT_HPP -#include #include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/grpc_context.ipp b/src/agrpc/detail/grpc_context.ipp index bd645faa..3a1c4e4f 100644 --- a/src/agrpc/detail/grpc_context.ipp +++ b/src/agrpc/detail/grpc_context.ipp @@ -16,7 +16,6 @@ #define AGRPC_DETAIL_GRPC_CONTEXT_IPP #include -#include #include #include #include @@ -29,6 +28,8 @@ #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/grpc_context_implementation.hpp b/src/agrpc/detail/grpc_context_implementation.hpp index e8f2c966..36c8a7fd 100644 --- a/src/agrpc/detail/grpc_context_implementation.hpp +++ b/src/agrpc/detail/grpc_context_implementation.hpp @@ -16,7 +16,6 @@ #define AGRPC_DETAIL_GRPC_CONTEXT_IMPLEMENTATION_HPP #include -#include #include #include #include @@ -26,6 +25,8 @@ #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/grpc_executor_base.hpp b/src/agrpc/detail/grpc_executor_base.hpp index 9e63f815..0ad6d3eb 100644 --- a/src/agrpc/detail/grpc_executor_base.hpp +++ b/src/agrpc/detail/grpc_executor_base.hpp @@ -15,13 +15,14 @@ #ifndef AGRPC_DETAIL_GRPC_EXECUTOR_BASE_HPP #define AGRPC_DETAIL_GRPC_EXECUTOR_BASE_HPP -#include #include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/grpc_executor_options.hpp b/src/agrpc/detail/grpc_executor_options.hpp index fc040f8c..2e9625ba 100644 --- a/src/agrpc/detail/grpc_executor_options.hpp +++ b/src/agrpc/detail/grpc_executor_options.hpp @@ -15,10 +15,10 @@ #ifndef AGRPC_DETAIL_GRPC_EXECUTOR_OPTIONS_HPP #define AGRPC_DETAIL_GRPC_EXECUTOR_OPTIONS_HPP -#include - #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/grpc_sender.hpp b/src/agrpc/detail/grpc_sender.hpp index 5ecec952..93ccfd88 100644 --- a/src/agrpc/detail/grpc_sender.hpp +++ b/src/agrpc/detail/grpc_sender.hpp @@ -16,9 +16,10 @@ #define AGRPC_DETAIL_GRPC_SENDER_HPP #include -#include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/health_check_repeatedly_request.hpp b/src/agrpc/detail/health_check_repeatedly_request.hpp index a9de5ac3..86fbb637 100644 --- a/src/agrpc/detail/health_check_repeatedly_request.hpp +++ b/src/agrpc/detail/health_check_repeatedly_request.hpp @@ -15,10 +15,11 @@ #ifndef AGRPC_DETAIL_HEALTH_CHECK_REPEATEDLY_REQUEST_HPP #define AGRPC_DETAIL_HEALTH_CHECK_REPEATEDLY_REQUEST_HPP -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/health_check_service.hpp b/src/agrpc/detail/health_check_service.hpp index 6e437545..a14c5e7e 100644 --- a/src/agrpc/detail/health_check_service.hpp +++ b/src/agrpc/detail/health_check_service.hpp @@ -12,10 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef AGRPC_DETAIL_HEALTH_CHECK_SERVICE_IPP -#define AGRPC_DETAIL_HEALTH_CHECK_SERVICE_IPP +#ifndef AGRPC_DETAIL_HEALTH_CHECK_SERVICE_HPP +#define AGRPC_DETAIL_HEALTH_CHECK_SERVICE_HPP -#include #include #include #include @@ -28,6 +27,8 @@ #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail @@ -315,4 +316,4 @@ inline void start_health_check_service(grpc::Server& server, agrpc::GrpcContext& AGRPC_NAMESPACE_END -#endif // AGRPC_DETAIL_HEALTH_CHECK_SERVICE_IPP +#endif // AGRPC_DETAIL_HEALTH_CHECK_SERVICE_HPP diff --git a/src/agrpc/detail/initiate_sender_implementation.hpp b/src/agrpc/detail/initiate_sender_implementation.hpp index 61650b36..25cdb09d 100644 --- a/src/agrpc/detail/initiate_sender_implementation.hpp +++ b/src/agrpc/detail/initiate_sender_implementation.hpp @@ -16,11 +16,12 @@ #define AGRPC_DETAIL_INITIATE_SENDER_IMPLEMENTATION_HPP #include -#include #include #include #include +#include + #if defined(AGRPC_STANDALONE_ASIO) || defined(AGRPC_BOOST_ASIO) #include #endif diff --git a/src/agrpc/detail/intrusive_circular_list.hpp b/src/agrpc/detail/intrusive_circular_list.hpp index be157e99..ea03b002 100644 --- a/src/agrpc/detail/intrusive_circular_list.hpp +++ b/src/agrpc/detail/intrusive_circular_list.hpp @@ -15,11 +15,11 @@ #ifndef AGRPC_DETAIL_INTRUSIVE_CIRCULAR_LIST_HPP #define AGRPC_DETAIL_INTRUSIVE_CIRCULAR_LIST_HPP -#include - #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/intrusive_list.hpp b/src/agrpc/detail/intrusive_list.hpp index 922f5f64..3a700b33 100644 --- a/src/agrpc/detail/intrusive_list.hpp +++ b/src/agrpc/detail/intrusive_list.hpp @@ -15,11 +15,11 @@ #ifndef AGRPC_DETAIL_INTRUSIVE_LIST_HPP #define AGRPC_DETAIL_INTRUSIVE_LIST_HPP -#include - #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/intrusive_queue.hpp b/src/agrpc/detail/intrusive_queue.hpp index 5f0f8ff6..86f820cf 100644 --- a/src/agrpc/detail/intrusive_queue.hpp +++ b/src/agrpc/detail/intrusive_queue.hpp @@ -15,10 +15,10 @@ #ifndef AGRPC_DETAIL_INTRUSIVE_QUEUE_HPP #define AGRPC_DETAIL_INTRUSIVE_QUEUE_HPP -#include - #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/intrusive_slist.hpp b/src/agrpc/detail/intrusive_slist.hpp index b3a92491..ae6b1aa1 100644 --- a/src/agrpc/detail/intrusive_slist.hpp +++ b/src/agrpc/detail/intrusive_slist.hpp @@ -15,11 +15,11 @@ #ifndef AGRPC_DETAIL_INTRUSIVE_SLIST_HPP #define AGRPC_DETAIL_INTRUSIVE_SLIST_HPP -#include - #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/manual_reset_event.hpp b/src/agrpc/detail/manual_reset_event.hpp index 34f56b05..3478277b 100644 --- a/src/agrpc/detail/manual_reset_event.hpp +++ b/src/agrpc/detail/manual_reset_event.hpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -28,6 +27,8 @@ #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/manual_reset_event_operation.ipp b/src/agrpc/detail/manual_reset_event_operation.ipp index 78b7775d..c07bb8fa 100644 --- a/src/agrpc/detail/manual_reset_event_operation.ipp +++ b/src/agrpc/detail/manual_reset_event_operation.ipp @@ -17,13 +17,15 @@ #include #include -#include #include #include #include #include #include +#include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/math.hpp b/src/agrpc/detail/math.hpp index 6ee38adf..d27e316e 100644 --- a/src/agrpc/detail/math.hpp +++ b/src/agrpc/detail/math.hpp @@ -15,11 +15,11 @@ #ifndef AGRPC_DETAIL_MATH_HPP #define AGRPC_DETAIL_MATH_HPP -#include - #include #include +#include + #if __cpp_lib_bitops >= 201907L #include #endif diff --git a/src/agrpc/detail/memory.hpp b/src/agrpc/detail/memory.hpp index c67b2852..dda4689f 100644 --- a/src/agrpc/detail/memory.hpp +++ b/src/agrpc/detail/memory.hpp @@ -15,11 +15,11 @@ #ifndef AGRPC_DETAIL_MEMORY_HPP #define AGRPC_DETAIL_MEMORY_HPP -#include - #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/name.hpp b/src/agrpc/detail/name.hpp index b4c76230..227fc585 100644 --- a/src/agrpc/detail/name.hpp +++ b/src/agrpc/detail/name.hpp @@ -16,12 +16,13 @@ #define AGRPC_DETAIL_NAME_HPP #include -#include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/notify_on_state_change.hpp b/src/agrpc/detail/notify_on_state_change.hpp index 8482d315..72f9a1ea 100644 --- a/src/agrpc/detail/notify_on_state_change.hpp +++ b/src/agrpc/detail/notify_on_state_change.hpp @@ -15,11 +15,12 @@ #ifndef AGRPC_DETAIL_NOTIFY_ON_STATE_CHANGE_HPP #define AGRPC_DETAIL_NOTIFY_ON_STATE_CHANGE_HPP -#include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/notify_when_done_event.hpp b/src/agrpc/detail/notify_when_done_event.hpp index 179496c3..cf0fa61a 100644 --- a/src/agrpc/detail/notify_when_done_event.hpp +++ b/src/agrpc/detail/notify_when_done_event.hpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -27,6 +26,8 @@ #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/operation.hpp b/src/agrpc/detail/operation.hpp index 28af22a4..847a05d6 100644 --- a/src/agrpc/detail/operation.hpp +++ b/src/agrpc/detail/operation.hpp @@ -18,9 +18,10 @@ #include #include #include -#include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/operation_base.hpp b/src/agrpc/detail/operation_base.hpp index bc2725a2..fe3cfe78 100644 --- a/src/agrpc/detail/operation_base.hpp +++ b/src/agrpc/detail/operation_base.hpp @@ -16,11 +16,12 @@ #define AGRPC_DETAIL_OPERATION_BASE_HPP #include -#include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/operation_handle.hpp b/src/agrpc/detail/operation_handle.hpp index f3ce89eb..41f95512 100644 --- a/src/agrpc/detail/operation_handle.hpp +++ b/src/agrpc/detail/operation_handle.hpp @@ -16,10 +16,11 @@ #define AGRPC_DETAIL_OPERATION_HANDLE_HPP #include -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/operation_implementation.hpp b/src/agrpc/detail/operation_implementation.hpp index 247ceafc..63ab970e 100644 --- a/src/agrpc/detail/operation_implementation.hpp +++ b/src/agrpc/detail/operation_implementation.hpp @@ -15,13 +15,14 @@ #ifndef AGRPC_DETAIL_OPERATION_IMPLEMENTATION_HPP #define AGRPC_DETAIL_OPERATION_IMPLEMENTATION_HPP -#include #include #include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/operation_initiation.hpp b/src/agrpc/detail/operation_initiation.hpp index ec5b8a9e..6343125f 100644 --- a/src/agrpc/detail/operation_initiation.hpp +++ b/src/agrpc/detail/operation_initiation.hpp @@ -15,10 +15,11 @@ #ifndef AGRPC_DETAIL_OPERATION_INITIATION_HPP #define AGRPC_DETAIL_OPERATION_INITIATION_HPP -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/pool_resource.hpp b/src/agrpc/detail/pool_resource.hpp index 73ac8609..d1ee5523 100644 --- a/src/agrpc/detail/pool_resource.hpp +++ b/src/agrpc/detail/pool_resource.hpp @@ -15,7 +15,6 @@ #ifndef AGRPC_DETAIL_POOL_RESOURCE_HPP #define AGRPC_DETAIL_POOL_RESOURCE_HPP -#include #include #include #include @@ -23,6 +22,8 @@ #include +#include + // The following PoolResource and related functions have been adapted from // https://github.com/boostorg/container/blob/develop/src/pool_resource.cpp diff --git a/src/agrpc/detail/pool_resource_allocator.hpp b/src/agrpc/detail/pool_resource_allocator.hpp index ee7c0b9a..fce2422b 100644 --- a/src/agrpc/detail/pool_resource_allocator.hpp +++ b/src/agrpc/detail/pool_resource_allocator.hpp @@ -15,11 +15,12 @@ #ifndef AGRPC_DETAIL_POOL_RESOURCE_ALLOCATOR_HPP #define AGRPC_DETAIL_POOL_RESOURCE_ALLOCATOR_HPP -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/query_grpc_context.hpp b/src/agrpc/detail/query_grpc_context.hpp index 9fe48ed9..7f5bad94 100644 --- a/src/agrpc/detail/query_grpc_context.hpp +++ b/src/agrpc/detail/query_grpc_context.hpp @@ -16,19 +16,16 @@ #define AGRPC_DETAIL_QUERY_GRPC_CONTEXT_HPP #include -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail { -#ifdef AGRPC_HAS_CONCEPTS -template -concept IS_CASTABLE_TO_GRPC_CONTEXT = requires(Context& context) { static_cast(context); }; -#else template inline constexpr bool IS_CASTABLE_TO_GRPC_CONTEXT = false; @@ -36,7 +33,6 @@ template inline constexpr bool IS_CASTABLE_TO_GRPC_CONTEXT(std::declval()))> = true; -#endif template decltype(auto) query_execution_context(const Executor& executor) diff --git a/src/agrpc/detail/receiver.hpp b/src/agrpc/detail/receiver.hpp index 4bc62175..8247385a 100644 --- a/src/agrpc/detail/receiver.hpp +++ b/src/agrpc/detail/receiver.hpp @@ -15,11 +15,12 @@ #ifndef AGRPC_DETAIL_RECEIVER_HPP #define AGRPC_DETAIL_RECEIVER_HPP -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/register_awaitable_rpc_handler.hpp b/src/agrpc/detail/register_awaitable_rpc_handler.hpp index cfb7ba81..eecddc31 100644 --- a/src/agrpc/detail/register_awaitable_rpc_handler.hpp +++ b/src/agrpc/detail/register_awaitable_rpc_handler.hpp @@ -15,13 +15,14 @@ #ifndef AGRPC_DETAIL_REGISTER_AWAITABLE_RPC_HANDLER_HPP #define AGRPC_DETAIL_REGISTER_AWAITABLE_RPC_HANDLER_HPP -#include #include -#include #include #include #include +#include +#include + #ifdef AGRPC_ASIO_HAS_CO_AWAIT AGRPC_NAMESPACE_BEGIN() diff --git a/src/agrpc/detail/register_callback_rpc_handler.hpp b/src/agrpc/detail/register_callback_rpc_handler.hpp index 85d2e09b..dd79f980 100644 --- a/src/agrpc/detail/register_callback_rpc_handler.hpp +++ b/src/agrpc/detail/register_callback_rpc_handler.hpp @@ -15,12 +15,13 @@ #ifndef AGRPC_DETAIL_REGISTER_CALLBACK_RPC_HANDLER_HPP #define AGRPC_DETAIL_REGISTER_CALLBACK_RPC_HANDLER_HPP -#include #include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/register_rpc_handler_asio_base.hpp b/src/agrpc/detail/register_rpc_handler_asio_base.hpp index ad9de91d..9d4f6308 100644 --- a/src/agrpc/detail/register_rpc_handler_asio_base.hpp +++ b/src/agrpc/detail/register_rpc_handler_asio_base.hpp @@ -16,13 +16,14 @@ #define AGRPC_DETAIL_REGISTER_RPC_HANDLER_ASIO_BASE_HPP #include -#include #include #include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/register_rpc_handler_base.hpp b/src/agrpc/detail/register_rpc_handler_base.hpp index f6dc08f8..96d7bb59 100644 --- a/src/agrpc/detail/register_rpc_handler_base.hpp +++ b/src/agrpc/detail/register_rpc_handler_base.hpp @@ -16,7 +16,6 @@ #define AGRPC_DETAIL_REGISTER_RPC_HANDLER_BASE_HPP #include -#include #include #include #include @@ -24,6 +23,8 @@ #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/register_sender_rpc_handler.hpp b/src/agrpc/detail/register_sender_rpc_handler.hpp index 5b81df0c..6d7d7098 100644 --- a/src/agrpc/detail/register_sender_rpc_handler.hpp +++ b/src/agrpc/detail/register_sender_rpc_handler.hpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -30,6 +29,8 @@ #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/register_yield_rpc_handler.hpp b/src/agrpc/detail/register_yield_rpc_handler.hpp index e8805db6..0c862029 100644 --- a/src/agrpc/detail/register_yield_rpc_handler.hpp +++ b/src/agrpc/detail/register_yield_rpc_handler.hpp @@ -15,8 +15,8 @@ #ifndef AGRPC_DETAIL_REGISTER_YIELD_RPC_HANDLER_HPP #define AGRPC_DETAIL_REGISTER_YIELD_RPC_HANDLER_HPP +#include #include -#include #include #include #include @@ -27,6 +27,9 @@ #include #endif +#include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/rethrow_first_arg.hpp b/src/agrpc/detail/rethrow_first_arg.hpp index 5fd177e0..e0bf79fd 100644 --- a/src/agrpc/detail/rethrow_first_arg.hpp +++ b/src/agrpc/detail/rethrow_first_arg.hpp @@ -15,10 +15,10 @@ #ifndef AGRPC_DETAIL_RETHROW_FIRST_ARG_HPP #define AGRPC_DETAIL_RETHROW_FIRST_ARG_HPP -#include - #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/rpc_executor_base.hpp b/src/agrpc/detail/rpc_executor_base.hpp index 137e4d68..1975fe4b 100644 --- a/src/agrpc/detail/rpc_executor_base.hpp +++ b/src/agrpc/detail/rpc_executor_base.hpp @@ -15,12 +15,13 @@ #ifndef AGRPC_DETAIL_RPC_EXECUTOR_BASE_HPP #define AGRPC_DETAIL_RPC_EXECUTOR_BASE_HPP -#include #include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/rpc_request.hpp b/src/agrpc/detail/rpc_request.hpp index 8a7b0c4e..720df650 100644 --- a/src/agrpc/detail/rpc_request.hpp +++ b/src/agrpc/detail/rpc_request.hpp @@ -15,10 +15,11 @@ #ifndef AGRPC_DETAIL_RPC_REQUEST_HPP #define AGRPC_DETAIL_RPC_REQUEST_HPP -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/rpc_type.hpp b/src/agrpc/detail/rpc_type.hpp index aa0bad5d..4b82c5a8 100644 --- a/src/agrpc/detail/rpc_type.hpp +++ b/src/agrpc/detail/rpc_type.hpp @@ -15,12 +15,13 @@ #ifndef AGRPC_DETAIL_RPC_TYPE_HPP #define AGRPC_DETAIL_RPC_TYPE_HPP -#include #include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/schedule_sender.hpp b/src/agrpc/detail/schedule_sender.hpp index d3fb9d3f..27e9bcda 100644 --- a/src/agrpc/detail/schedule_sender.hpp +++ b/src/agrpc/detail/schedule_sender.hpp @@ -16,10 +16,11 @@ #define AGRPC_DETAIL_SCHEDULE_SENDER_HPP #include -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/sender_implementation_operation.hpp b/src/agrpc/detail/sender_implementation_operation.hpp index 989afdfe..0113c6a5 100644 --- a/src/agrpc/detail/sender_implementation_operation.hpp +++ b/src/agrpc/detail/sender_implementation_operation.hpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -26,6 +25,8 @@ #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/sender_of.hpp b/src/agrpc/detail/sender_of.hpp index 81beeb30..8fc72a25 100644 --- a/src/agrpc/detail/sender_of.hpp +++ b/src/agrpc/detail/sender_of.hpp @@ -15,11 +15,12 @@ #ifndef AGRPC_DETAIL_SENDER_OF_HPP #define AGRPC_DETAIL_SENDER_OF_HPP -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/server_rpc_base.hpp b/src/agrpc/detail/server_rpc_base.hpp index adfa9ece..96b57fed 100644 --- a/src/agrpc/detail/server_rpc_base.hpp +++ b/src/agrpc/detail/server_rpc_base.hpp @@ -15,11 +15,12 @@ #ifndef AGRPC_DETAIL_SERVER_RPC_BASE_HPP #define AGRPC_DETAIL_SERVER_RPC_BASE_HPP -#include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/server_rpc_context_base.hpp b/src/agrpc/detail/server_rpc_context_base.hpp index 336a8e6e..965047b2 100644 --- a/src/agrpc/detail/server_rpc_context_base.hpp +++ b/src/agrpc/detail/server_rpc_context_base.hpp @@ -15,13 +15,14 @@ #ifndef AGRPC_DETAIL_SERVER_RPC_CONTEXT_BASE_HPP #define AGRPC_DETAIL_SERVER_RPC_CONTEXT_BASE_HPP -#include #include #include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/server_rpc_notify_when_done_base.hpp b/src/agrpc/detail/server_rpc_notify_when_done_base.hpp index a881e530..a4d7ff4a 100644 --- a/src/agrpc/detail/server_rpc_notify_when_done_base.hpp +++ b/src/agrpc/detail/server_rpc_notify_when_done_base.hpp @@ -15,11 +15,12 @@ #ifndef AGRPC_DETAIL_SERVER_RPC_NOTIFY_WHEN_DONE_BASE_HPP #define AGRPC_DETAIL_SERVER_RPC_NOTIFY_WHEN_DONE_BASE_HPP -#include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/server_rpc_notify_when_done_mixin.hpp b/src/agrpc/detail/server_rpc_notify_when_done_mixin.hpp index 0f4899b3..2d95be1c 100644 --- a/src/agrpc/detail/server_rpc_notify_when_done_mixin.hpp +++ b/src/agrpc/detail/server_rpc_notify_when_done_mixin.hpp @@ -15,9 +15,10 @@ #ifndef AGRPC_DETAIL_SERVER_RPC_NOTIFY_WHEN_DONE_MIXIN_HPP #define AGRPC_DETAIL_SERVER_RPC_NOTIFY_WHEN_DONE_MIXIN_HPP -#include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/server_rpc_sender.hpp b/src/agrpc/detail/server_rpc_sender.hpp index 3d04b160..9e30b7c9 100644 --- a/src/agrpc/detail/server_rpc_sender.hpp +++ b/src/agrpc/detail/server_rpc_sender.hpp @@ -15,7 +15,6 @@ #ifndef AGRPC_DETAIL_SERVER_RPC_SENDER_HPP #define AGRPC_DETAIL_SERVER_RPC_SENDER_HPP -#include #include #include #include @@ -25,6 +24,8 @@ #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/server_write_reactor.hpp b/src/agrpc/detail/server_write_reactor.hpp index 7a73ad5e..10920e29 100644 --- a/src/agrpc/detail/server_write_reactor.hpp +++ b/src/agrpc/detail/server_write_reactor.hpp @@ -16,13 +16,14 @@ #define AGRPC_DETAIL_SERVER_WRITE_REACTOR_HPP #include -#include #include #include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/start_server_rpc.hpp b/src/agrpc/detail/start_server_rpc.hpp index 5954ad88..2cad01a5 100644 --- a/src/agrpc/detail/start_server_rpc.hpp +++ b/src/agrpc/detail/start_server_rpc.hpp @@ -15,11 +15,12 @@ #ifndef AGRPC_DETAIL_START_SERVER_RPC_HPP #define AGRPC_DETAIL_START_SERVER_RPC_HPP -#include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/stop_callback_lifetime.hpp b/src/agrpc/detail/stop_callback_lifetime.hpp index 555d9955..8b88df0a 100644 --- a/src/agrpc/detail/stop_callback_lifetime.hpp +++ b/src/agrpc/detail/stop_callback_lifetime.hpp @@ -16,11 +16,12 @@ #define AGRPC_DETAIL_STOP_CALLBACK_LIFETIME_HPP #include -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/submit.hpp b/src/agrpc/detail/submit.hpp index 95b1ce08..3285381b 100644 --- a/src/agrpc/detail/submit.hpp +++ b/src/agrpc/detail/submit.hpp @@ -15,10 +15,11 @@ #ifndef AGRPC_DETAIL_SUBMIT_HPP #define AGRPC_DETAIL_SUBMIT_HPP -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/test.hpp b/src/agrpc/detail/test.hpp index eb945cda..3f503f4b 100644 --- a/src/agrpc/detail/test.hpp +++ b/src/agrpc/detail/test.hpp @@ -15,9 +15,10 @@ #ifndef AGRPC_DETAIL_TEST_HPP #define AGRPC_DETAIL_TEST_HPP -#include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/tuple.hpp b/src/agrpc/detail/tuple.hpp index b4c3cc49..90bfe41c 100644 --- a/src/agrpc/detail/tuple.hpp +++ b/src/agrpc/detail/tuple.hpp @@ -15,11 +15,12 @@ #ifndef AGRPC_DETAIL_TUPLE_HPP #define AGRPC_DETAIL_TUPLE_HPP -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/use_sender.hpp b/src/agrpc/detail/use_sender.hpp index 512267a7..91ea6d50 100644 --- a/src/agrpc/detail/use_sender.hpp +++ b/src/agrpc/detail/use_sender.hpp @@ -15,10 +15,11 @@ #ifndef AGRPC_DETAIL_USE_SENDER_HPP #define AGRPC_DETAIL_USE_SENDER_HPP -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/utility.hpp b/src/agrpc/detail/utility.hpp index 68d6025e..31389156 100644 --- a/src/agrpc/detail/utility.hpp +++ b/src/agrpc/detail/utility.hpp @@ -15,11 +15,11 @@ #ifndef AGRPC_DETAIL_UTILITY_HPP #define AGRPC_DETAIL_UTILITY_HPP -#include - #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail @@ -68,13 +68,6 @@ struct RemoveCref template using RemoveCrefT = typename detail::RemoveCref::Type; -#ifdef AGRPC_HAS_CONCEPTS -template -concept IS_EQUALITY_COMPARABLE = requires(const T& lhs, const T& rhs) { - static_cast(lhs == rhs); - static_cast(lhs != rhs); -}; -#else template inline constexpr bool IS_EQUALITY_COMPARABLE = false; @@ -82,7 +75,6 @@ template inline constexpr bool IS_EQUALITY_COMPARABLE< T, std::void_t(std::declval() == std::declval())), decltype(static_cast(std::declval() != std::declval()))>> = true; -#endif template inline constexpr bool ALWAYS_FALSE = false; diff --git a/src/agrpc/detail/waiter.hpp b/src/agrpc/detail/waiter.hpp index b1136312..1a2f32ef 100644 --- a/src/agrpc/detail/waiter.hpp +++ b/src/agrpc/detail/waiter.hpp @@ -17,9 +17,10 @@ #include #include -#include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/detail/work_tracking_completion_handler.hpp b/src/agrpc/detail/work_tracking_completion_handler.hpp index ae5fae8e..ade45090 100644 --- a/src/agrpc/detail/work_tracking_completion_handler.hpp +++ b/src/agrpc/detail/work_tracking_completion_handler.hpp @@ -17,13 +17,13 @@ #include #include -#include #include #include -#include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail diff --git a/src/agrpc/grpc_context.hpp b/src/agrpc/grpc_context.hpp index c36c6c5b..0f4172bd 100644 --- a/src/agrpc/grpc_context.hpp +++ b/src/agrpc/grpc_context.hpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -31,6 +30,8 @@ #include #include +#include + AGRPC_NAMESPACE_BEGIN() /** @@ -310,4 +311,6 @@ struct std::uses_allocator : std::false_type { }; +#include + #endif // AGRPC_AGRPC_GRPC_CONTEXT_HPP diff --git a/src/agrpc/grpc_executor.hpp b/src/agrpc/grpc_executor.hpp index 589a5288..783fcf39 100644 --- a/src/agrpc/grpc_executor.hpp +++ b/src/agrpc/grpc_executor.hpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -30,6 +29,8 @@ #include #include +#include + AGRPC_NAMESPACE_BEGIN() /** @@ -669,4 +670,6 @@ struct agrpc::asio::traits::query_member +#include + #endif // AGRPC_AGRPC_GRPC_EXECUTOR_HPP diff --git a/src/agrpc/health_check_service.hpp b/src/agrpc/health_check_service.hpp index 21530321..2ad6ced0 100644 --- a/src/agrpc/health_check_service.hpp +++ b/src/agrpc/health_check_service.hpp @@ -15,7 +15,6 @@ #ifndef AGRPC_AGRPC_HEALTH_CHECK_SERVICE_HPP #define AGRPC_AGRPC_HEALTH_CHECK_SERVICE_HPP -#include #include #include #include @@ -27,6 +26,8 @@ #include #include +#include + #ifdef __has_include #if __has_include("grpc/health/v1/health.grpc.pb.h") #include @@ -150,6 +151,8 @@ void start_health_check_service(grpc::Server& server, agrpc::GrpcContext& grpc_c AGRPC_NAMESPACE_END -#endif // AGRPC_AGRPC_HEALTH_CHECK_SERVICE_HPP - #include + +#include + +#endif // AGRPC_AGRPC_HEALTH_CHECK_SERVICE_HPP diff --git a/src/agrpc/notify_on_state_change.hpp b/src/agrpc/notify_on_state_change.hpp index a75ee276..291c46cf 100644 --- a/src/agrpc/notify_on_state_change.hpp +++ b/src/agrpc/notify_on_state_change.hpp @@ -15,12 +15,13 @@ #ifndef AGRPC_AGRPC_NOTIFY_ON_STATE_CHANGE_HPP #define AGRPC_AGRPC_NOTIFY_ON_STATE_CHANGE_HPP -#include #include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail @@ -80,4 +81,6 @@ inline constexpr detail::NotifyOnStateChangeFn notify_on_state_change{}; AGRPC_NAMESPACE_END +#include + #endif // AGRPC_AGRPC_NOTIFY_ON_STATE_CHANGE_HPP diff --git a/src/agrpc/read.hpp b/src/agrpc/read.hpp index abd2b4aa..65144f6d 100644 --- a/src/agrpc/read.hpp +++ b/src/agrpc/read.hpp @@ -15,10 +15,11 @@ #ifndef AGRPC_AGRPC_READ_HPP #define AGRPC_AGRPC_READ_HPP -#include #include #include +#include + AGRPC_NAMESPACE_BEGIN() namespace detail @@ -74,4 +75,6 @@ inline constexpr detail::ReadFn read{}; AGRPC_NAMESPACE_END +#include + #endif // AGRPC_AGRPC_READ_HPP diff --git a/src/agrpc/register_awaitable_rpc_handler.hpp b/src/agrpc/register_awaitable_rpc_handler.hpp index aefe48c6..1d28d93e 100644 --- a/src/agrpc/register_awaitable_rpc_handler.hpp +++ b/src/agrpc/register_awaitable_rpc_handler.hpp @@ -16,8 +16,8 @@ #define AGRPC_AGRPC_REGISTER_AWAITABLE_RPC_HANDLER_HPP #include + #include -#include #ifdef AGRPC_ASIO_HAS_CO_AWAIT @@ -84,4 +84,6 @@ AGRPC_NAMESPACE_END #endif +#include + #endif // AGRPC_AGRPC_REGISTER_AWAITABLE_RPC_HANDLER_HPP diff --git a/src/agrpc/register_callback_rpc_handler.hpp b/src/agrpc/register_callback_rpc_handler.hpp index fc9a9789..e6bb7de1 100644 --- a/src/agrpc/register_callback_rpc_handler.hpp +++ b/src/agrpc/register_callback_rpc_handler.hpp @@ -76,4 +76,6 @@ AGRPC_NAMESPACE_END #endif +#include + #endif // AGRPC_AGRPC_REGISTER_CALLBACK_RPC_HANDLER_HPP diff --git a/src/agrpc/register_sender_rpc_handler.hpp b/src/agrpc/register_sender_rpc_handler.hpp index 1ca34f51..4fff1bbc 100644 --- a/src/agrpc/register_sender_rpc_handler.hpp +++ b/src/agrpc/register_sender_rpc_handler.hpp @@ -52,4 +52,6 @@ template AGRPC_NAMESPACE_END +#include + #endif // AGRPC_AGRPC_REGISTER_SENDER_RPC_HANDLER_HPP diff --git a/src/agrpc/register_yield_rpc_handler.hpp b/src/agrpc/register_yield_rpc_handler.hpp index 98a0d6f4..79cb7d26 100644 --- a/src/agrpc/register_yield_rpc_handler.hpp +++ b/src/agrpc/register_yield_rpc_handler.hpp @@ -15,7 +15,6 @@ #ifndef AGRPC_AGRPC_REGISTER_YIELD_RPC_HANDLER_HPP #define AGRPC_AGRPC_REGISTER_YIELD_RPC_HANDLER_HPP -#include #include AGRPC_NAMESPACE_BEGIN() @@ -77,4 +76,6 @@ auto register_yield_rpc_handler(agrpc::GrpcContext& grpc_context, detail::GetSer AGRPC_NAMESPACE_END +#include + #endif // AGRPC_AGRPC_REGISTER_YIELD_RPC_HANDLER_HPP diff --git a/src/agrpc/rpc_type.hpp b/src/agrpc/rpc_type.hpp index 13376d67..2487caac 100644 --- a/src/agrpc/rpc_type.hpp +++ b/src/agrpc/rpc_type.hpp @@ -92,4 +92,6 @@ enum class ServerRPCType AGRPC_NAMESPACE_END +#include + #endif // AGRPC_AGRPC_RPC_TYPE_HPP diff --git a/src/agrpc/run.hpp b/src/agrpc/run.hpp index 16d30347..2b64a0f7 100644 --- a/src/agrpc/run.hpp +++ b/src/agrpc/run.hpp @@ -19,13 +19,14 @@ #include #include -#include #include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() /** @@ -314,4 +315,6 @@ AGRPC_NAMESPACE_END #endif +#include + #endif // AGRPC_AGRPC_RUN_HPP diff --git a/src/agrpc/server_rpc.hpp b/src/agrpc/server_rpc.hpp index e1994b4a..4363f224 100644 --- a/src/agrpc/server_rpc.hpp +++ b/src/agrpc/server_rpc.hpp @@ -16,7 +16,6 @@ #define AGRPC_AGRPC_SERVER_RPC_HPP #include -#include #include #include #include @@ -24,6 +23,8 @@ #include #include +#include + AGRPC_NAMESPACE_BEGIN() /** @@ -985,4 +986,6 @@ using GenericServerRPC = agrpc::ServerRPC; AGRPC_NAMESPACE_END +#include + #endif // AGRPC_AGRPC_SERVER_RPC_HPP diff --git a/src/agrpc/server_rpc_ptr.hpp b/src/agrpc/server_rpc_ptr.hpp index ed4a68c8..e4864e1e 100644 --- a/src/agrpc/server_rpc_ptr.hpp +++ b/src/agrpc/server_rpc_ptr.hpp @@ -15,12 +15,13 @@ #ifndef AGRPC_AGRPC_SERVER_RPC_PTR_HPP #define AGRPC_AGRPC_SERVER_RPC_PTR_HPP -#include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() /** @@ -136,4 +137,6 @@ class ServerRPCPtr AGRPC_NAMESPACE_END +#include + #endif // AGRPC_AGRPC_SERVER_RPC_PTR_HPP diff --git a/src/agrpc/test.hpp b/src/agrpc/test.hpp index db3b774e..e32c2c18 100644 --- a/src/agrpc/test.hpp +++ b/src/agrpc/test.hpp @@ -16,11 +16,12 @@ #define AGRPC_AGRPC_TEST_HPP #include -#include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() /** @@ -52,4 +53,6 @@ inline void process_grpc_tag(agrpc::GrpcContext& grpc_context, void* tag, bool o AGRPC_NAMESPACE_END +#include + #endif // AGRPC_AGRPC_TEST_HPP diff --git a/src/agrpc/use_sender.hpp b/src/agrpc/use_sender.hpp index 7e938f01..3cd325af 100644 --- a/src/agrpc/use_sender.hpp +++ b/src/agrpc/use_sender.hpp @@ -16,9 +16,10 @@ #define AGRPC_AGRPC_USE_SENDER_HPP #include -#include #include +#include + AGRPC_NAMESPACE_BEGIN() /** @@ -58,4 +59,6 @@ inline constexpr agrpc::UseSender use_sender{}; AGRPC_NAMESPACE_END +#include + #endif // AGRPC_AGRPC_USE_SENDER_HPP diff --git a/src/agrpc/waiter.hpp b/src/agrpc/waiter.hpp index c3088f49..34ec06df 100644 --- a/src/agrpc/waiter.hpp +++ b/src/agrpc/waiter.hpp @@ -16,13 +16,14 @@ #define AGRPC_AGRPC_WAITER_HPP #include -#include #include #include #include #include #include +#include + AGRPC_NAMESPACE_BEGIN() /** @@ -177,4 +178,6 @@ class Waiter AGRPC_NAMESPACE_END +#include + #endif // AGRPC_AGRPC_WAITER_HPP diff --git a/test/src/test_alarm_17.cpp b/test/src/test_alarm_17.cpp index 0a5b4ebf..9b834e37 100644 --- a/test/src/test_alarm_17.cpp +++ b/test/src/test_alarm_17.cpp @@ -130,7 +130,7 @@ TEST_CASE_FIXTURE(test::GrpcContextTest, "agrpc::Alarm::cancel") CHECK_FALSE(ok); } -#ifdef AGRPC_ASIO_HAS_CANCELLATION_SLOT +#ifdef AGRPC_TEST_ASIO_HAS_CANCELLATION_SLOT TEST_CASE_FIXTURE(test::GrpcContextTest, "asio::deferred with Alarm") { bool ok1{false}; diff --git a/test/src/test_alarm_20.cpp b/test/src/test_alarm_20.cpp index d3e67237..cf7dee08 100644 --- a/test/src/test_alarm_20.cpp +++ b/test/src/test_alarm_20.cpp @@ -23,7 +23,7 @@ #include #endif -#ifdef AGRPC_ASIO_HAS_CO_AWAIT +#ifdef AGRPC_TEST_ASIO_HAS_CO_AWAIT TEST_CASE_FIXTURE(test::GrpcContextTest, "co_spawn two Alarms and await their ok using GrpcExecutor") { using GrpcAwaitable = asio::awaitable; @@ -64,7 +64,7 @@ TEST_CASE_FIXTURE(test::GrpcContextTest, "co_await Alarm with GrpcExecutor().grpc_context(0))::value); } -#ifdef AGRPC_ASIO_HAS_CANCELLATION_SLOT +#ifdef AGRPC_TEST_ASIO_HAS_CANCELLATION_SLOT // gRPC requests seem to be uncancellable on platforms other than Windows #ifdef _WIN32 TEST_CASE_TEMPLATE("Unary RPC::request can be cancelled", RPC, test::UnaryClientRPC, test::GenericUnaryClientRPC) diff --git a/test/src/test_grpc_context_20.cpp b/test/src/test_grpc_context_20.cpp index 4735b1da..38eb1ac6 100644 --- a/test/src/test_grpc_context_20.cpp +++ b/test/src/test_grpc_context_20.cpp @@ -46,7 +46,7 @@ TEST_CASE_FIXTURE( } #endif -#ifdef AGRPC_ASIO_HAS_CO_AWAIT +#ifdef AGRPC_TEST_ASIO_HAS_CO_AWAIT TEST_CASE_FIXTURE(test::GrpcContextTest, "stop GrpcContext from awaitable while waiting for an Alarm") { bool ok{true}; @@ -122,7 +122,7 @@ TEST_CASE_FIXTURE(test::GrpcContextTest, grpc_context.reset(); } -#ifdef AGRPC_ASIO_HAS_CANCELLATION_SLOT +#ifdef AGRPC_TEST_ASIO_HAS_CANCELLATION_SLOT TEST_CASE_FIXTURE(test::GrpcContextTest, "bind_executor can be used to switch to io_context when awaiting asio::steady_timer from GrpcContext") { diff --git a/test/src/test_server_rpc_17.cpp b/test/src/test_server_rpc_17.cpp index 967152af..4c8c3b21 100644 --- a/test/src/test_server_rpc_17.cpp +++ b/test/src/test_server_rpc_17.cpp @@ -479,7 +479,7 @@ TEST_CASE("ServerRPC::service_name/method_name") check_eq_and_null_terminated("BidirectionalStreaming", test::BidirectionalStreamingServerRPC::method_name()); } -#ifdef AGRPC_ASIO_HAS_CANCELLATION_SLOT +#ifdef AGRPC_TEST_ASIO_HAS_CANCELLATION_SLOT TEST_CASE_TEMPLATE("ServerRPC resumable read can be cancelled", RPC, test::ClientStreamingServerRPC, test::BidirectionalStreamingServerRPC) { diff --git a/test/src/test_server_rpc_20.cpp b/test/src/test_server_rpc_20.cpp index efc9302b..0d733fe4 100644 --- a/test/src/test_server_rpc_20.cpp +++ b/test/src/test_server_rpc_20.cpp @@ -30,7 +30,7 @@ #include #include -#ifdef AGRPC_ASIO_HAS_CO_AWAIT +#ifdef AGRPC_TEST_ASIO_HAS_CO_AWAIT template struct ServerRPCAwaitableTest : test::ClientServerRPCTest::ClientRPC, ServerRPC> { @@ -473,7 +473,7 @@ TEST_CASE_TEMPLATE("Awaitable ServerRPC/ClientRPC generic streaming success", RP }); } -#ifdef AGRPC_ASIO_HAS_CANCELLATION_SLOT +#ifdef AGRPC_TEST_ASIO_HAS_CANCELLATION_SLOT TEST_CASE_FIXTURE(ServerRPCAwaitableTest, "Awaitable ServerRPC resumable read can be cancelled") { diff --git a/test/src/test_waiter_17.cpp b/test/src/test_waiter_17.cpp index 1befec57..33cbc2c0 100644 --- a/test/src/test_waiter_17.cpp +++ b/test/src/test_waiter_17.cpp @@ -138,7 +138,7 @@ TEST_CASE_FIXTURE(test::IoContextTest, "Waiter: can handle lots of completion ar io_context.run(); } -#ifdef AGRPC_ASIO_HAS_CANCELLATION_SLOT +#ifdef AGRPC_TEST_ASIO_HAS_CANCELLATION_SLOT TEST_CASE_FIXTURE(test::GrpcContextTest, "Waiter: cancel wait for alarm and wait again") { bool done{}; diff --git a/test/utils/utils/asio_forward.hpp b/test/utils/utils/asio_forward.hpp index 19c79efe..cf3f41e2 100644 --- a/test/utils/utils/asio_forward.hpp +++ b/test/utils/utils/asio_forward.hpp @@ -15,9 +15,6 @@ #ifndef AGRPC_UTILS_ASIO_FORWARD_HPP #define AGRPC_UTILS_ASIO_FORWARD_HPP -#include -#include - #ifdef AGRPC_STANDALONE_ASIO #include #include @@ -27,13 +24,28 @@ #include #include #include +#include #include +#include + +#ifdef ASIO_HAS_CO_AWAIT +#include + +#define AGRPC_TEST_ASIO_HAS_CO_AWAIT +#endif + +#if (ASIO_VERSION >= 101900) +#include +#include + +#define AGRPC_TEST_ASIO_HAS_CANCELLATION_SLOT +#endif -#if defined(AGRPC_ASIO_HAS_CO_AWAIT) && defined(AGRPC_ASIO_HAS_CANCELLATION_SLOT) +#if defined(AGRPC_TEST_ASIO_HAS_CO_AWAIT) && defined(AGRPC_TEST_ASIO_HAS_CANCELLATION_SLOT) #include #endif -#ifdef AGRPC_ASIO_HAS_CANCELLATION_SLOT +#ifdef AGRPC_TEST_ASIO_HAS_CANCELLATION_SLOT #include #include #include @@ -51,13 +63,10 @@ #include #define AGRPC_TEST_ASIO_HAS_NEW_SPAWN -#elif defined(AGRPC_ASIO_HAS_CANCELLATION_SLOT) +#elif defined(AGRPC_TEST_ASIO_HAS_CANCELLATION_SLOT) #include #endif #elif defined(AGRPC_BOOST_ASIO) -// -#include -// #include #include #include @@ -66,13 +75,28 @@ #include #include #include +#include #include +#include + +#ifdef BOOST_ASIO_HAS_CO_AWAIT +#include + +#define AGRPC_TEST_ASIO_HAS_CO_AWAIT +#endif + +#if (BOOST_VERSION >= 107700) +#include +#include + +#define AGRPC_TEST_ASIO_HAS_CANCELLATION_SLOT +#endif -#if defined(AGRPC_ASIO_HAS_CO_AWAIT) && defined(AGRPC_ASIO_HAS_CANCELLATION_SLOT) +#if defined(AGRPC_TEST_ASIO_HAS_CO_AWAIT) && defined(AGRPC_TEST_ASIO_HAS_CANCELLATION_SLOT) #include #endif -#ifdef AGRPC_ASIO_HAS_CANCELLATION_SLOT +#ifdef AGRPC_TEST_ASIO_HAS_CANCELLATION_SLOT #include #include #include @@ -90,7 +114,7 @@ #include #define AGRPC_TEST_ASIO_HAS_NEW_SPAWN -#elif defined(AGRPC_ASIO_HAS_CANCELLATION_SLOT) +#elif defined(AGRPC_TEST_ASIO_HAS_CANCELLATION_SLOT) #include #endif #endif @@ -145,7 +169,7 @@ using ErrorCode = std::error_code; #ifdef AGRPC_TEST_ASIO_HAS_NEW_SPAWN inline constexpr auto ASIO_DEFERRED = asio::deferred; -#elif defined(AGRPC_ASIO_HAS_CANCELLATION_SLOT) +#elif defined(AGRPC_TEST_ASIO_HAS_CANCELLATION_SLOT) inline constexpr auto ASIO_DEFERRED = asio::experimental::deferred; #endif } // namespace test diff --git a/test/utils/utils/asio_utils.cpp b/test/utils/utils/asio_utils.cpp index 581c0bc8..dffe0f2f 100644 --- a/test/utils/utils/asio_utils.cpp +++ b/test/utils/utils/asio_utils.cpp @@ -38,7 +38,7 @@ void post(const agrpc::GrpcExecutor& executor, const std::function& func asio::post(executor, function); } -#ifdef AGRPC_ASIO_HAS_CO_AWAIT +#ifdef AGRPC_TEST_ASIO_HAS_CO_AWAIT void co_spawn(agrpc::GrpcContext& grpc_context, const std::function()>& function) { asio::co_spawn(grpc_context, function, test::RethrowFirstArg{}); diff --git a/test/utils/utils/asio_utils.hpp b/test/utils/utils/asio_utils.hpp index 7a2cd392..dff94014 100644 --- a/test/utils/utils/asio_utils.hpp +++ b/test/utils/utils/asio_utils.hpp @@ -220,7 +220,7 @@ void post(agrpc::GrpcContext& grpc_context, const std::function& functio void post(const agrpc::GrpcExecutor& executor, const std::function& function); -#ifdef AGRPC_ASIO_HAS_CO_AWAIT +#ifdef AGRPC_TEST_ASIO_HAS_CO_AWAIT void co_spawn(agrpc::GrpcContext& grpc_context, const std::function()>& function); template