diff --git a/src/core/lib/promise/all_ok.h b/src/core/lib/promise/all_ok.h index 72d9d3815b3..2ca128f3c8a 100644 --- a/src/core/lib/promise/all_ok.h +++ b/src/core/lib/promise/all_ok.h @@ -77,7 +77,7 @@ class AllOk { // If any fail, cancel the rest and return the failure. // If all succeed, return Ok. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION auto AllOk(Promises... promises) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto AllOk(Promises... promises) { return promise_detail::AllOk(std::move(promises)...); } diff --git a/src/core/lib/promise/cancel_callback.h b/src/core/lib/promise/cancel_callback.h index ed999c293f3..9ff66231a47 100644 --- a/src/core/lib/promise/cancel_callback.h +++ b/src/core/lib/promise/cancel_callback.h @@ -69,8 +69,8 @@ class Handler { // completion. // Returns a promise with the same result type as main_fn. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION auto OnCancel(MainFn main_fn, - CancelFn cancel_fn) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto OnCancel(MainFn main_fn, + CancelFn cancel_fn) { return [on_cancel = cancel_callback_detail::Handler(std::move(cancel_fn)), main_fn = promise_detail::PromiseLike( @@ -87,8 +87,8 @@ GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION auto OnCancel(MainFn main_fn, // resulting promise. If the factory is dropped without being called, cancel_fn // is called. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION auto OnCancelFactory(MainFn main_fn, - CancelFn cancel_fn) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto OnCancelFactory( + MainFn main_fn, CancelFn cancel_fn) { return [on_cancel = cancel_callback_detail::Handler(std::move(cancel_fn)), main_fn = std::move(main_fn)]() mutable { diff --git a/src/core/lib/promise/context.h b/src/core/lib/promise/context.h index a0eed9396e8..65ee6f1a4a8 100644 --- a/src/core/lib/promise/context.h +++ b/src/core/lib/promise/context.h @@ -105,13 +105,13 @@ class WithContext { // Return true if a context of type T is currently active. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION bool HasContext() { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline bool HasContext() { return promise_detail::Context::get() != nullptr; } // Retrieve the current value of a context, or abort if the value is unset. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION T* GetContext() { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline T* GetContext() { auto* p = promise_detail::Context::get(); DCHECK_NE(p, nullptr); return p; @@ -119,12 +119,12 @@ GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION T* GetContext() { // Retrieve the current value of a context, or nullptr if the value is unset. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION T* MaybeGetContext() { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline T* MaybeGetContext() { return promise_detail::Context::get(); } template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION void SetContext(T* p) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline void SetContext(T* p) { promise_detail::Context::set(p); } diff --git a/src/core/lib/promise/detail/promise_factory.h b/src/core/lib/promise/detail/promise_factory.h index 49dc25c3301..eba027464d6 100644 --- a/src/core/lib/promise/detail/promise_factory.h +++ b/src/core/lib/promise/detail/promise_factory.h @@ -124,7 +124,7 @@ GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION // Promote a callable() -> T|Poll to a PromiseFactory(A) -> Promise // by dropping the argument passed to the factory. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION absl::enable_if_t< +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline absl::enable_if_t< !IsVoidCallable>::value, PromiseLike>> PromiseFactoryImpl(F f, A&&) { return PromiseLike(std::move(f)); @@ -132,7 +132,7 @@ PromiseFactoryImpl(F f, A&&) { // Promote a callable() -> T|Poll to a PromiseFactory() -> Promise template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION absl::enable_if_t< +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline absl::enable_if_t< !IsVoidCallable>::value, PromiseLike>> PromiseFactoryImpl(F f) { return PromiseLike(std::move(f)); @@ -140,7 +140,7 @@ PromiseFactoryImpl(F f) { // Given a callable(A) -> Promise, name it a PromiseFactory and use it. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION absl::enable_if_t< +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline absl::enable_if_t< IsVoidCallable>::value, PromiseLike()(std::declval()))>> PromiseFactoryImpl(F&& f, A&& arg) { @@ -149,7 +149,7 @@ PromiseFactoryImpl(F&& f, A&& arg) { // Given a callable(A) -> Promise, name it a PromiseFactory and use it. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION absl::enable_if_t< +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline absl::enable_if_t< IsVoidCallable>::value, PromiseLike()(std::declval()))>> PromiseFactoryImpl(F& f, A&& arg) { diff --git a/src/core/lib/promise/detail/promise_like.h b/src/core/lib/promise/detail/promise_like.h index 8515e8b46fb..b31d9126459 100644 --- a/src/core/lib/promise/detail/promise_like.h +++ b/src/core/lib/promise/detail/promise_like.h @@ -63,7 +63,7 @@ struct PollWrapper> { }; template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION auto WrapInPoll(T&& x) +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto WrapInPoll(T&& x) -> decltype(PollWrapper::Wrap(std::forward(x))) { return PollWrapper::Wrap(std::forward(x)); } diff --git a/src/core/lib/promise/detail/status.h b/src/core/lib/promise/detail/status.h index d33c32644cf..335c5365c2b 100644 --- a/src/core/lib/promise/detail/status.h +++ b/src/core/lib/promise/detail/status.h @@ -30,7 +30,7 @@ namespace promise_detail { // Convert with a move the input status to an absl::Status. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION absl::Status IntoStatus( +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline absl::Status IntoStatus( absl::StatusOr* status) { return std::move(status->status()); } @@ -103,7 +103,7 @@ struct StatusCastImpl&> { // For cases where the status is guaranteed to be a failure (and hence not // needing to preserve values) see FailureStatusCast<> below. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION To StatusCast(From&& from) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline To StatusCast(From&& from) { return StatusCastImpl::Cast(std::forward(from)); } @@ -127,7 +127,7 @@ struct FailureStatusCastImpl, const absl::Status&> { }; template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION To FailureStatusCast(From&& from) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline To FailureStatusCast(From&& from) { DCHECK(!IsStatusOk(from)); return FailureStatusCastImpl::Cast(std::forward(from)); } diff --git a/src/core/lib/promise/for_each.h b/src/core/lib/promise/for_each.h index c990f249845..3cb965aab7f 100644 --- a/src/core/lib/promise/for_each.h +++ b/src/core/lib/promise/for_each.h @@ -229,7 +229,8 @@ class ForEach { /// For each item acquired by calling Reader::Next, run the promise Action. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION for_each_detail::ForEach +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline for_each_detail::ForEach ForEach(Reader reader, Action action, DebugLocation whence = {}) { return for_each_detail::ForEach(std::move(reader), std::move(action), whence); diff --git a/src/core/lib/promise/if.h b/src/core/lib/promise/if.h index 55d18aa74c7..17e584c8ad5 100644 --- a/src/core/lib/promise/if.h +++ b/src/core/lib/promise/if.h @@ -32,8 +32,8 @@ namespace grpc_core { namespace promise_detail { template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION typename CallPoll::PollResult ChooseIf( - CallPoll call_poll, bool result, T* if_true, F* if_false) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline typename CallPoll::PollResult +ChooseIf(CallPoll call_poll, bool result, T* if_true, F* if_false) { if (result) { auto promise = if_true->Make(); return call_poll(promise); @@ -44,8 +44,9 @@ GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION typename CallPoll::PollResult ChooseIf( } template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION typename CallPoll::PollResult ChooseIf( - CallPoll call_poll, absl::StatusOr result, T* if_true, F* if_false) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline typename CallPoll::PollResult +ChooseIf(CallPoll call_poll, absl::StatusOr result, T* if_true, + F* if_false) { if (!result.ok()) { return typename CallPoll::PollResult(result.status()); } else if (*result) { @@ -199,7 +200,7 @@ class If { // This makes it safe to capture lambda arguments in the promise factory by // reference. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::If If( +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::If If( C condition, T if_true, F if_false) { return promise_detail::If(std::move(condition), std::move(if_true), std::move(if_false)); diff --git a/src/core/lib/promise/join.h b/src/core/lib/promise/join.h index 81619e33142..922a42b36bc 100644 --- a/src/core/lib/promise/join.h +++ b/src/core/lib/promise/join.h @@ -74,13 +74,13 @@ struct WrapInTuple { /// Combinator to run all promises to completion, and return a tuple /// of their results. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Join Join( - Promise... promises) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Join +Join(Promise... promises) { return promise_detail::Join(std::move(promises)...); } template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION auto Join(F promise) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto Join(F promise) { return Map(std::move(promise), promise_detail::WrapInTuple{}); } diff --git a/src/core/lib/promise/loop.h b/src/core/lib/promise/loop.h index 768746f7b60..d2fda934ccb 100644 --- a/src/core/lib/promise/loop.h +++ b/src/core/lib/promise/loop.h @@ -140,7 +140,7 @@ class Loop { // Expects F returns LoopCtl - if it's Continue, then run the loop again - // otherwise yield the returned value as the result of the loop. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Loop Loop(F f) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Loop Loop(F f) { return promise_detail::Loop(std::move(f)); } diff --git a/src/core/lib/promise/map.h b/src/core/lib/promise/map.h index 52023fd2dc7..f93a852fcb0 100644 --- a/src/core/lib/promise/map.h +++ b/src/core/lib/promise/map.h @@ -67,8 +67,8 @@ class Map { // Takes a promise, and a synchronous function to mutate its result, and // returns a promise. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Map Map( - Promise promise, Fn fn) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Map +Map(Promise promise, Fn fn) { return promise_detail::Map(std::move(promise), std::move(fn)); } @@ -76,7 +76,7 @@ GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Map Map( // and a bool indicating whether there was ever a Pending{} value observed from // polling. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION auto CheckDelayed(Promise promise) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto CheckDelayed(Promise promise) { using P = promise_detail::PromiseLike; return [delayed = false, promise = P(std::move(promise))]() mutable -> Poll> { diff --git a/src/core/lib/promise/poll.h b/src/core/lib/promise/poll.h index 879a5f42335..fc932f2f9eb 100644 --- a/src/core/lib/promise/poll.h +++ b/src/core/lib/promise/poll.h @@ -222,8 +222,8 @@ struct PollTraits> { }; template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION bool operator==(const Poll& a, - const Poll& b) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline bool operator==(const Poll& a, + const Poll& b) { if (a.pending() && b.pending()) return true; if (a.ready() && b.ready()) return a.value() == b.value(); return false; @@ -262,7 +262,7 @@ struct PollCastImpl> { }; template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Poll poll_cast(U poll) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline Poll poll_cast(U poll) { return PollCastImpl::Cast(std::move(poll)); } diff --git a/src/core/lib/promise/promise.h b/src/core/lib/promise/promise.h index b5ac75d73d2..8f98ab8d5d9 100644 --- a/src/core/lib/promise/promise.h +++ b/src/core/lib/promise/promise.h @@ -71,8 +71,8 @@ class Immediate { // Return \a value immediately template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Immediate Immediate( - T value) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Immediate +Immediate(T value) { return promise_detail::Immediate(std::move(value)); } @@ -89,7 +89,7 @@ struct ImmediateOkStatus { // should fail to compile. When modifying this code these should be uncommented // and their miscompilation verified. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION auto WithResult(F f) -> +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto WithResult(F f) -> typename std::enable_if>::value, F>::type { return f; diff --git a/src/core/lib/promise/race.h b/src/core/lib/promise/race.h index a17fc074b7d..96c5eb53ab7 100644 --- a/src/core/lib/promise/race.h +++ b/src/core/lib/promise/race.h @@ -74,8 +74,8 @@ class Race { /// If two results are simultaneously available, bias towards the first result /// listed. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Race Race( - Promises... promises) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Race +Race(Promises... promises) { return promise_detail::Race(std::move(promises)...); } diff --git a/src/core/lib/promise/seq.h b/src/core/lib/promise/seq.h index 80cd2981308..4c55daf28d9 100644 --- a/src/core/lib/promise/seq.h +++ b/src/core/lib/promise/seq.h @@ -106,32 +106,33 @@ struct SeqIterResultTraits { // etc // Return the final value. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION F Seq(F functor) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline F Seq(F functor) { return functor; } template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Seq Seq( +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Seq Seq( F0 f0, F1 f1, DebugLocation whence = {}) { return promise_detail::Seq(std::move(f0), std::move(f1), whence); } template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Seq Seq( +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Seq Seq( F0 f0, F1 f1, F2 f2, DebugLocation whence = {}) { return promise_detail::Seq(std::move(f0), std::move(f1), std::move(f2), whence); } template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Seq Seq( - F0 f0, F1 f1, F2 f2, F3 f3, DebugLocation whence = {}) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Seq +Seq(F0 f0, F1 f1, F2 f2, F3 f3, DebugLocation whence = {}) { return promise_detail::Seq( std::move(f0), std::move(f1), std::move(f2), std::move(f3), whence); } template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Seq +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Seq Seq(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, DebugLocation whence = {}) { return promise_detail::Seq(std::move(f0), std::move(f1), std::move(f2), std::move(f3), @@ -140,7 +141,8 @@ Seq(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, DebugLocation whence = {}) { template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Seq +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Seq Seq(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, F5 f5, DebugLocation whence = {}) { return promise_detail::Seq( std::move(f0), std::move(f1), std::move(f2), std::move(f3), std::move(f4), diff --git a/src/core/lib/promise/try_join.h b/src/core/lib/promise/try_join.h index e80eaee9a89..03a38c04e20 100644 --- a/src/core/lib/promise/try_join.h +++ b/src/core/lib/promise/try_join.h @@ -133,13 +133,14 @@ struct WrapInStatusOrTuple { // If any fail, cancel the rest and return the failure. // If all succeed, return Ok(tuple-of-results). template