From 19d89bc434b9fb9c38dc8b7fc7c75970087b424f Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Fri, 1 Mar 2024 19:24:12 -0800 Subject: [PATCH] remove unnecessary explicit-this portability macro --- .clang-format | 3 +-- include/exec/__detail/__basic_sequence.hpp | 3 +-- include/stdexec/__detail/__basic_sender.hpp | 20 +++++++++----------- include/stdexec/__detail/__config.hpp | 12 ------------ include/stdexec/execution.hpp | 10 +++------- 5 files changed, 14 insertions(+), 34 deletions(-) diff --git a/.clang-format b/.clang-format index 0ae8c7b9a..f060858a7 100644 --- a/.clang-format +++ b/.clang-format @@ -86,8 +86,7 @@ Macros: [ 'STDEXEC_NO_UNIQUE_ADDRESS=[[no_unique_address]]', 'STDEXEC_IMMOVABLE_NO_UNIQUE_ADDRESS=[[no_unique_address]]', 'STDEXEC_MISSING_MEMBER(X,Y)=true', - 'STDEXEC_DEFINE_MEMBER(X)=void foo() {}', - 'STDEXEC_DEFINE_EXPLICIT_THIS_MEMFN(...)=__VA_ARGS__' + 'STDEXEC_DEFINE_MEMBER(X)=void foo() {}' ] MaxEmptyLinesToKeep: 2 NamespaceIndentation: All diff --git a/include/exec/__detail/__basic_sequence.hpp b/include/exec/__detail/__basic_sequence.hpp index 8f26c69a9..0e1895f98 100644 --- a/include/exec/__detail/__basic_sequence.hpp +++ b/include/exec/__detail/__basic_sequence.hpp @@ -106,8 +106,7 @@ namespace exec { } template - STDEXEC_DEFINE_EXPLICIT_THIS_MEMFN(auto apply) - (this _Sender&& __sndr, _ApplyFn&& __fun) // + static auto apply(_Sender&& __sndr, _ApplyFn&& __fun) // noexcept(stdexec::__nothrow_callable< stdexec::__detail::__impl_of<_Sender>, stdexec::__copy_cvref_fn<_Sender>, diff --git a/include/stdexec/__detail/__basic_sender.hpp b/include/stdexec/__detail/__basic_sender.hpp index ace8a9d55..d10e6c4a2 100644 --- a/include/stdexec/__detail/__basic_sender.hpp +++ b/include/stdexec/__detail/__basic_sender.hpp @@ -186,7 +186,7 @@ namespace stdexec { inline constexpr auto __get_state = // [](_Sender&& __sndr, __ignore) noexcept -> decltype(auto) { - return STDEXEC_CALL_EXPLICIT_THIS_MEMFN(static_cast<_Sender&&>(__sndr), apply)(__get_data()); + return __sndr.apply(static_cast<_Sender&&>(__sndr), __get_data()); }; inline constexpr auto __connect = // @@ -557,9 +557,10 @@ namespace stdexec { template STDEXEC_ATTRIBUTE((always_inline)) - STDEXEC_DEFINE_EXPLICIT_THIS_MEMFN(auto apply)(this _Sender&& __sndr, _ApplyFn&& __fun) noexcept( - __nothrow_callable<__detail::__impl_of<_Sender>, __copy_cvref_fn<_Sender>, _ApplyFn>) // - -> __call_result_t<__detail::__impl_of<_Sender>, __copy_cvref_fn<_Sender>, _ApplyFn> { // + static auto + apply(_Sender&& __sndr, _ApplyFn&& __fun) noexcept( + __nothrow_callable<__detail::__impl_of<_Sender>, __copy_cvref_fn<_Sender>, _ApplyFn>) // + -> __call_result_t<__detail::__impl_of<_Sender>, __copy_cvref_fn<_Sender>, _ApplyFn> { // return static_cast<_Sender&&>(__sndr).__impl_( __copy_cvref_fn<_Sender>(), static_cast<_ApplyFn&&>(__fun)); // } @@ -629,13 +630,10 @@ namespace stdexec { template STDEXEC_ATTRIBUTE((always_inline)) auto - operator()(_Sender&& __sndr, _ApplyFn&& __fun) const - noexcept(noexcept(STDEXEC_CALL_EXPLICIT_THIS_MEMFN((static_cast<_Sender&&>(__sndr)), apply)( - static_cast<_ApplyFn&&>(__fun)))) // - -> decltype(STDEXEC_CALL_EXPLICIT_THIS_MEMFN((static_cast<_Sender&&>(__sndr)), apply)( - static_cast<_ApplyFn&&>(__fun))) { - return STDEXEC_CALL_EXPLICIT_THIS_MEMFN((static_cast<_Sender&&>(__sndr)), apply)( - static_cast<_ApplyFn&&>(__fun)); // + operator()(_Sender&& __sndr, _ApplyFn&& __fun) const noexcept( + noexcept(__sndr.apply(static_cast<_Sender&&>(__sndr), static_cast<_ApplyFn&&>(__fun)))) // + -> decltype(__sndr.apply(static_cast<_Sender&&>(__sndr), static_cast<_ApplyFn&&>(__fun))) { + return __sndr.apply(static_cast<_Sender&&>(__sndr), static_cast<_ApplyFn&&>(__fun)); // } }; } // namespace __detail diff --git a/include/stdexec/__detail/__config.hpp b/include/stdexec/__detail/__config.hpp index 04b2060f0..fc938dda2 100644 --- a/include/stdexec/__detail/__config.hpp +++ b/include/stdexec/__detail/__config.hpp @@ -357,18 +357,6 @@ enum { # define STDEXEC_EXPLICIT_THIS(...) STDEXEC_HEAD_OR_NULL(0, __VA_ARGS__) #endif -#if STDEXEC_EXPLICIT_THIS() -# define STDEXEC_DEFINE_EXPLICIT_THIS_MEMFN(...) __VA_ARGS__ -# define STDEXEC_CALL_EXPLICIT_THIS_MEMFN(_OBJ, _NAME) (_OBJ)._NAME( STDEXEC_CALL_EXPLICIT_THIS_MEMFN_DETAIL -# define STDEXEC_CALL_EXPLICIT_THIS_MEMFN_DETAIL(...) __VA_ARGS__ ) -#else -# define STDEXEC_DEFINE_EXPLICIT_THIS_MEMFN(...) static __VA_ARGS__(STDEXEC_FUN_ARGS -# define STDEXEC_CALL_EXPLICIT_THIS_MEMFN(_OBJ, _NAME) (_OBJ)._NAME((_OBJ) STDEXEC_CALL_EXPLICIT_THIS_MEMFN_DETAIL -# define STDEXEC_CALL_EXPLICIT_THIS_MEMFN_DETAIL(...) __VA_OPT__(, ) __VA_ARGS__) -# define STDEXEC_EAT_THIS_DETAIL_this -# define STDEXEC_FUN_ARGS(...) STDEXEC_CAT(STDEXEC_EAT_THIS_DETAIL_, __VA_ARGS__)) -#endif - // Configure extra type checking #define STDEXEC_TYPE_CHECKING_ZERO() 0 #define STDEXEC_TYPE_CHECKING_ONE() 1 diff --git a/include/stdexec/execution.hpp b/include/stdexec/execution.hpp index f73937824..33fa7c11a 100644 --- a/include/stdexec/execution.hpp +++ b/include/stdexec/execution.hpp @@ -3034,10 +3034,8 @@ namespace stdexec { explicit __local_state(_CvrefSender&& __sndr) noexcept : __local_state::__local_state_base{{}, &__action>} - , __shared_state_( - STDEXEC_CALL_EXPLICIT_THIS_MEMFN(static_cast<_CvrefSender&&>(__sndr), apply)( - __detail::__get_data()) - .__shared_state) { + , __shared_state_(__sndr.apply(static_cast<_CvrefSender&&>(__sndr), __detail::__get_data()) + .__shared_state) { } ~__local_state() { @@ -3791,9 +3789,7 @@ namespace stdexec { _Sched __sched = query_or( get_completion_scheduler<_Set>, stdexec::get_env(__sndr), __none_such()); return __let_state_t{ - STDEXEC_CALL_EXPLICIT_THIS_MEMFN(static_cast<_Sender&&>(__sndr), apply)( - __detail::__get_data()), - __sched}; + __sndr.apply(static_cast<_Sender&&>(__sndr), __detail::__get_data()), __sched}; }; template