From 49a13b6eecb465f76266d9c47a2e6699a15e11c8 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 20 Jul 2022 12:22:33 -0700 Subject: [PATCH] ircd::asio: Fix undefined-var-template error; enable -fpch-instantiate-templates. --- include/ircd/Makefile.am | 3 +-- include/ircd/asio.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/ircd/Makefile.am b/include/ircd/Makefile.am index f9951c0b4..1540bd85f 100644 --- a/include/ircd/Makefile.am +++ b/include/ircd/Makefile.am @@ -7,8 +7,7 @@ AM_CXXFLAGS =# AM_CXXFLAGS += -x c++-header if CLANG11 -#TODO: XXX -#AM_CXXFLAGS += -fpch-instantiate-templates +AM_CXXFLAGS += -fpch-instantiate-templates endif if GCC diff --git a/include/ircd/asio.h b/include/ircd/asio.h index de81d8353..70ae7ed36 100644 --- a/include/ircd/asio.h +++ b/include/ircd/asio.h @@ -68,6 +68,20 @@ namespace boost #pragma GCC visibility pop #endif +// Template-specializations for some functions we may redefine (interpose). +// Declarations are needed for template instantiation in PCH and with LTO. +#if defined(BOOST_ASIO_HAS_EPOLL) +namespace boost::asio::detail +{ + using epoll_time_traits = asio::time_traits; + + template<> std::size_t + epoll_reactor::cancel_timer(timer_queue &, + typename timer_queue::per_timer_data &, + std::size_t max); +} +#endif + // Boost version dependent behavior for getting the io_service/io_context // abstract executor (recent versions) or the derived instance (old versions). namespace ircd::ios