diff options
author | Iain Sandoe <iain@sandoe.co.uk> | 2019-11-26 14:24:25 +0000 |
---|---|---|
committer | Iain Sandoe <iain@sandoe.co.uk> | 2019-11-26 14:24:25 +0000 |
commit | 61affb8e86cd20fa4c2a6d5ec76e30037a678fd4 (patch) | |
tree | df0a6e1ebd02be4a19fa402f224f93389f5654ce | |
parent | e5a6b54c1f8977bf37f7d698da5c010a01ec5fc3 (diff) |
c++-coroutines - Address review comments, naming in coroutine header.
Use libstdc naming convention, also ensure a reserved identifier
is used for comparison selection.
2019-11-26 Iain Sandoe <iain@sandoe.co.uk>
libstdc++-v3/
* include/experimental/coroutine: Use GNU convention for
naming. Use implementation-reserved identifiers.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/c++-coroutines@278724 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libstdc++-v3/include/experimental/coroutine | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/libstdc++-v3/include/experimental/coroutine b/libstdc++-v3/include/experimental/coroutine index d903352314f..afa65e10171 100644 --- a/libstdc++-v3/include/experimental/coroutine +++ b/libstdc++-v3/include/experimental/coroutine @@ -39,10 +39,10 @@ #if __cplusplus > 201703L && __cpp_impl_three_way_comparison >= 201907L # include <compare> -# define THE_SPACESHIP_HAS_LANDED 1 +# define _COROUTINES_USE_SPACESHIP 1 #else # include <bits/stl_function.h> -# define THE_SPACESHIP_HAS_LANDED 0 +# define _COROUTINES_USE_SPACESHIP 0 #endif namespace std _GLIBCXX_VISIBILITY (default) @@ -52,7 +52,7 @@ namespace std _GLIBCXX_VISIBILITY (default) #if __cpp_coroutines namespace experimental { - inline namespace coroutines_n4835 { + inline namespace __n4835 { // [coroutine.traits] // [coroutine.traits.primary] @@ -70,23 +70,23 @@ namespace std _GLIBCXX_VISIBILITY (default) { public: // 17.12.3.1, construct/reset - constexpr coroutine_handle () noexcept : __fr_ptr (0) {} + constexpr coroutine_handle () noexcept : _M_fr_ptr (0) {} constexpr coroutine_handle (decltype (nullptr) __h) noexcept - : __fr_ptr (__h) + : _M_fr_ptr (__h) {} coroutine_handle &operator= (decltype (nullptr)) noexcept { - __fr_ptr = nullptr; + _M_fr_ptr = nullptr; return *this; } public: // 17.12.3.2, export/import - constexpr void *address () const noexcept { return __fr_ptr; } + constexpr void *address () const noexcept { return _M_fr_ptr; } constexpr static coroutine_handle from_address (void *__a) noexcept { coroutine_handle __self; - __self.__fr_ptr = __a; + __self._M_fr_ptr = __a; return __self; } @@ -94,16 +94,16 @@ namespace std _GLIBCXX_VISIBILITY (default) // 17.12.3.3, observers constexpr explicit operator bool () const noexcept { - return bool(__fr_ptr); + return bool(_M_fr_ptr); } - bool done () const noexcept { return __builtin_coro_done (__fr_ptr); } + bool done () const noexcept { return __builtin_coro_done (_M_fr_ptr); } // 17.12.3.4, resumption void operator() () const { resume (); } - void resume () const { __builtin_coro_resume (__fr_ptr); } - void destroy () const { __builtin_coro_destroy (__fr_ptr); } + void resume () const { __builtin_coro_resume (_M_fr_ptr); } + void destroy () const { __builtin_coro_destroy (_M_fr_ptr); } protected: - void *__fr_ptr; + void *_M_fr_ptr; }; // [coroutine.handle.compare] @@ -114,7 +114,7 @@ namespace std _GLIBCXX_VISIBILITY (default) return __a.address () == __b.address (); } -#if THE_SPACESHIP_HAS_LANDED +#if _COROUTINES_USE_SPACESHIP constexpr strong_ordering operator<=> (coroutine_handle<> __a, coroutine_handle<> __b) noexcept; #else @@ -157,7 +157,7 @@ namespace std _GLIBCXX_VISIBILITY (default) static coroutine_handle from_promise (_Promise &p) { coroutine_handle __self; - __self.__fr_ptr + __self._M_fr_ptr = __builtin_coro_promise ((char *) &p, __alignof(_Promise), true); return __self; } @@ -170,14 +170,14 @@ namespace std _GLIBCXX_VISIBILITY (default) constexpr static coroutine_handle from_address (void *__a) { coroutine_handle __self; - __self.__fr_ptr = __a; + __self._M_fr_ptr = __a; return __self; } // 17.12.3.5, promise accesss _Promise &promise () const { void *__t - = __builtin_coro_promise (this->__fr_ptr, __alignof(_Promise), false); + = __builtin_coro_promise (this->_M_fr_ptr, __alignof(_Promise), false); return *static_cast<_Promise *> (__t); } }; @@ -218,7 +218,7 @@ namespace std _GLIBCXX_VISIBILITY (default) _Promise &promise () const { return *static_cast<_Promise *> ( - __builtin_coro_promise (this->__fr_ptr, __alignof(_Promise), false)); + __builtin_coro_promise (this->_M_fr_ptr, __alignof(_Promise), false)); } // 17.12.4.2.4, address @@ -226,7 +226,7 @@ namespace std _GLIBCXX_VISIBILITY (default) private: friend coroutine_handle<noop_coroutine_promise> noop_coroutine () noexcept; - coroutine_handle () noexcept { this->__fr_ptr = (void *) &__noop_coro_fr; } + coroutine_handle () noexcept { this->_M_fr_ptr = (void *) &__noop_coro_fr; } }; using noop_coroutine_handle = coroutine_handle<noop_coroutine_promise>; @@ -253,7 +253,7 @@ namespace std _GLIBCXX_VISIBILITY (default) void await_resume () {} }; - } // namespace coroutines_n4835 + } // namespace __n4835 } // namespace experimental #else |