From cd95b7cd8dfa3547d68ffe52d1195de29fd225d6 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 11 Jul 2020 15:29:13 -0700 Subject: [PATCH] ircd::ctx: Specify inline linkage for various templates to prevent any dynsyms. --- include/ircd/ctx/dock.h | 8 ++++---- include/ircd/ctx/future.h | 33 +++++++++++++++++---------------- include/ircd/ctx/mutex.h | 4 ++-- include/ircd/ctx/promise.h | 12 ++++++------ include/ircd/http.h | 5 +++-- 5 files changed, 32 insertions(+), 30 deletions(-) diff --git a/include/ircd/ctx/dock.h b/include/ircd/ctx/dock.h index 1cfb20f3b..01e5334fd 100644 --- a/include/ircd/ctx/dock.h +++ b/include/ircd/ctx/dock.h @@ -88,7 +88,7 @@ noexcept /// Returns true if notified; false if timed out template -bool +inline bool ircd::ctx::dock::wait_for(const duration &dur) { static const duration zero(0); @@ -110,7 +110,7 @@ ircd::ctx::dock::wait_for(const duration &dur) /// Returns true if predicate passed; false if timed out template -bool +inline bool ircd::ctx::dock::wait_for(const duration &dur, const predicate &pred) { @@ -148,7 +148,7 @@ ircd::ctx::dock::wait_for(const duration &dur, /// Returns true if notified; false if timed out template -bool +inline bool ircd::ctx::dock::wait_until(time_point&& tp) { assert(current); @@ -168,7 +168,7 @@ ircd::ctx::dock::wait_until(time_point&& tp) /// Returns true if predicate passed; false if timed out template -bool +inline bool ircd::ctx::dock::wait_until(time_point&& tp, const predicate &pred) { diff --git a/include/ircd/ctx/future.h b/include/ircd/ctx/future.h index f9f8fa735..6ec93ee18 100644 --- a/include/ircd/ctx/future.h +++ b/include/ircd/ctx/future.h @@ -97,6 +97,7 @@ struct ircd::ctx::scoped_future }; template +inline ircd::ctx::scoped_future::~scoped_future() noexcept { @@ -108,7 +109,7 @@ noexcept template template -T +inline T ircd::ctx::future::get_until(const time_point &tp) { this->wait_until(tp); @@ -117,7 +118,7 @@ ircd::ctx::future::get_until(const time_point &tp) template template -T +inline T ircd::ctx::future::get(const duration &d) { this->wait(d); @@ -125,7 +126,7 @@ ircd::ctx::future::get(const duration &d) } template -T +inline T ircd::ctx::future::get() { wait(); @@ -140,7 +141,7 @@ ircd::ctx::future::get() } template -void +inline void ircd::ctx::future::wait() const { @@ -156,7 +157,7 @@ const template template -void +inline void ircd::ctx::future::wait(const duration &d) const { @@ -164,7 +165,7 @@ const } template -void +inline void ircd::ctx::future::wait(const duration &d) const { @@ -173,7 +174,7 @@ const template template -bool +inline bool ircd::ctx::future::wait(const duration &d, std::nothrow_t) const @@ -182,7 +183,7 @@ const } template -bool +inline bool ircd::ctx::future::wait(const duration &d, std::nothrow_t) const @@ -192,7 +193,7 @@ const template template -void +inline void ircd::ctx::future::wait_until(const time_point &tp) const { @@ -201,7 +202,7 @@ const } template -void +inline void ircd::ctx::future::wait_until(const time_point &tp) const { @@ -211,7 +212,7 @@ const template template -bool +inline bool ircd::ctx::future::wait_until(const time_point &tp, std::nothrow_t) const @@ -220,7 +221,7 @@ const } template -bool +inline bool ircd::ctx::future::wait_until(const time_point &tp, std::nothrow_t) const @@ -239,7 +240,7 @@ const template -void +inline void ircd::ctx::wait_until(const future &f, const time_point &tp) { @@ -249,7 +250,7 @@ ircd::ctx::wait_until(const future &f, template -bool +inline bool ircd::ctx::_wait_until(const future &f, const time_point &tp, std::nothrow_t) @@ -265,14 +266,14 @@ ircd::ctx::_wait_until(const future &f, } template -ircd::ctx::shared_state & +inline ircd::ctx::shared_state & ircd::ctx::state(future &future) { return future.state(); } template -const ircd::ctx::shared_state & +inline const ircd::ctx::shared_state & ircd::ctx::state(const future &future) { return future.state(); diff --git a/include/ircd/ctx/mutex.h b/include/ircd/ctx/mutex.h index 841dd100a..718266f20 100644 --- a/include/ircd/ctx/mutex.h +++ b/include/ircd/ctx/mutex.h @@ -106,14 +106,14 @@ ircd::ctx::mutex::lock() } template -bool +inline bool ircd::ctx::mutex::try_lock_for(const duration &d) { return try_lock_until(system_clock::now() + d); } template -bool +inline bool ircd::ctx::mutex::try_lock_until(const time_point &tp) { assert(current); diff --git a/include/ircd/ctx/promise.h b/include/ircd/ctx/promise.h index 913710698..56b2dd5f2 100644 --- a/include/ircd/ctx/promise.h +++ b/include/ircd/ctx/promise.h @@ -138,7 +138,7 @@ struct ircd::ctx::promise // template -void +inline void ircd::ctx::promise::set_value(T&& val) { if(!valid()) @@ -166,7 +166,7 @@ ircd::ctx::promise::set_value(T&& val) } template -void +inline void ircd::ctx::promise::set_value(const T &val) { if(!valid()) @@ -184,14 +184,14 @@ ircd::ctx::promise::set_value(const T &val) } template -ircd::ctx::shared_state & +inline ircd::ctx::shared_state & ircd::ctx::promise::state() { return promise_base::state(); } template -const ircd::ctx::shared_state & +inline const ircd::ctx::shared_state & ircd::ctx::promise::state() const { @@ -233,7 +233,7 @@ const noexcept } template -ircd::ctx::shared_state & +inline ircd::ctx::shared_state & ircd::ctx::promise_base::state() noexcept { @@ -241,7 +241,7 @@ noexcept } template -const ircd::ctx::shared_state & +inline const ircd::ctx::shared_state & ircd::ctx::promise_base::state() const noexcept { diff --git a/include/ircd/http.h b/include/ircd/http.h index d20a17520..10bd4668b 100644 --- a/include/ircd/http.h +++ b/include/ircd/http.h @@ -392,7 +392,7 @@ const } template -T +inline T ircd::http::query::string::get(const string_view &key, const T &def, const size_t &idx) @@ -407,7 +407,7 @@ catch(const bad_lex_cast &) } template -T +inline T ircd::http::query::string::at(const string_view &key, const size_t &idx) const @@ -416,6 +416,7 @@ const } template +inline ircd::http::error::error(const string_view &fmt, const http::code &code, args&&... a)