Open DarkWingMcQuack opened 11 months ago
I tried writing a basic benchmarkt using google benchmark regarding asio::awaitable and got a -Wsubobject-linkage warning from gcc-13.1.1
asio::awaitable
static inline void UseAwaitable(benchmark::State& state) { asio::thread_pool io_context; asio::co_spawn( io_context, [&]() -> asio::awaitable<void> { for(auto _ : state) { asio::steady_timer timer(io_context); timer.expires_after(0us); co_await timer.async_wait(asio::use_awaitable); } }, asio::detached); io_context.join(); } BENCHMARK(UseAwaitable)->MeasureProcessCPUTime();
this is the gtest i wrote and i am getting the following warning:
In file included from /home/auser/code/build/deps/asio/asio/include/asio/co_spawn.hpp:519, from /home/auser/code/build/deps/asio/asio/include/asio.hpp:63, from /home/auser/code/benchmark/comm_benchmarks/transmission_benchmarks.hpp:3, from /home/auser/code/benchmark/comm_benchmarks/communication_benchmark.cpp:2: /home/auser/code/build/deps/asio/asio/include/asio/impl/co_spawn.hpp: In instantiation of ‘asio::awaitable<asio::detail::awaitable_thread_entry_point, Executor> asio::detail::co_spawn_entry_point(asio::awaitable<void, Executor>*, Executor, F, Handler) [with Executor = asio::any_io_executor; F = UseAwaitable(benchmark::State&)::<lambda()>; Handler = detached_handler]’: /home/auser/code/build/deps/asio/asio/include/asio/impl/co_spawn.hpp:283:36: required from ‘void asio::detail::initiate_co_spawn<Executor>::operator()(Handler&&, F&&) const [with Handler = asio::detail::detached_handler; F = UseAwaitable(benchmark::State&)::<lambda()>; Executor = asio::any_io_executor]’ /home/auser/code/build/deps/asio/asio/include/asio/impl/detached.hpp:89:43: required from ‘static asio::async_result<asio::detached_t, Signature>::return_type asio::async_result<asio::detached_t, Signature>::initiate(Initiation&&, RawCompletionToken&&, Args&& ...) [with Initiation = asio::detail::initiate_co_spawn<asio::any_io_executor>; RawCompletionToken = const asio::detached_t&; Args = {UseAwaitable(benchmark::State&)::<lambda()>}; Signature = void(std::__exception_ptr::exception_ptr); return_type = void]’ /home/auser/code/build/deps/asio/asio/include/asio/async_result.hpp:895:29: required from ‘typename asio::constraint<asio::detail::async_result_has_initiate_memfn<CompletionToken, Signatures>::value, decltype (asio::async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...))>::type asio::async_initiate(Initiation&&, CompletionToken&, Args&& ...) [with CompletionToken = const detached_t&; Signatures = {void(std::__exception_ptr::exception_ptr)}; Initiation = detail::initiate_co_spawn<any_io_executor>; Args = {UseAwaitable(benchmark::State&)::<lambda()>}; typename constraint<detail::async_result_has_initiate_memfn<CompletionToken, Signatures>::value, decltype (async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...))>::type = void; decltype (async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...)) = void; typename std::decay<_Ex>::type = detached_t]’ /home/auser/code/build/deps/asio/asio/include/asio/impl/co_spawn.hpp:375:79: required from ‘auto asio::co_spawn(const Executor&, F&&, CompletionToken&&, typename constraint<(is_executor<Executor>::value || execution::is_executor<T>::value)>::type) [with Executor = thread_pool::basic_executor_type<std::allocator<void>, 0>; F = UseAwaitable(benchmark::State&)::<lambda()>; CompletionToken = const detached_t&; typename constraint<(is_executor<Executor>::value || execution::is_executor<T>::value)>::type = int]’ /home/auser/code/build/deps/asio/asio/include/asio/impl/co_spawn.hpp:391:20: required from ‘auto asio::co_spawn(ExecutionContext&, F&&, CompletionToken&&, typename constraint<std::is_convertible<ExecutionContext&, execution_context&>::value>::type) [with ExecutionContext = thread_pool; F = UseAwaitable(benchmark::State&)::<lambda()>; CompletionToken = const detached_t&; typename constraint<std::is_convertible<ExecutionContext&, execution_context&>::value>::type = int]’ /home/auser/code/benchmark/comm_benchmarks/processing_benchmarks.hpp:170:19: required from here /home/auser/code/build/deps/asio/asio/include/asio/impl/co_spawn.hpp:171:1: warning: ‘asio::detail::co_spawn_entry_point<asio::any_io_executor, UseAwaitable(benchmark::State&)::<lambda()>, detached_handler>(asio::awaitable<void>*, asio::any_io_executor, UseAwaitable(benchmark::State&)::<lambda()>, detached_handler)::_ZN4asio6detail20co_spawn_entry_pointINS_15any_io_executorEZL12UseAwaitableRN9benchmark5StateEEUlvE_NS0_16detached_handlerEEENS_9awaitableINS0_28awaitable_thread_entry_pointET_EEPNS8_IvSA_EESA_T0_T1_.Frame’ has a field ‘UseAwaitable(benchmark::State&)::<lambda()> asio::detail::co_spawn_entry_point<asio::any_io_executor, UseAwaitable(benchmark::State&)::<lambda()>, detached_handler>(asio::awaitable<void>*, asio::any_io_executor, UseAwaitable(benchmark::State&)::<lambda()>, detached_handler)::_ZN4asio6detail20co_spawn_entry_pointINS_15any_io_executorEZL12UseAwaitableRN9benchmark5StateEEUlvE_NS0_16detached_handlerEEENS_9awaitableINS0_28awaitable_thread_entry_pointET_EEPNS8_IvSA_EESA_T0_T1_.Frame::f’ whose type has no linkage [-Wsubobject-linkage] 171 | } | ^
I tried writing a basic benchmarkt using google benchmark regarding
asio::awaitable
and got a -Wsubobject-linkage warning from gcc-13.1.1this is the gtest i wrote and i am getting the following warning: