We didn't support noop_coroutine for GCC in previous conforming patch. So that GCC couldn't use noop_coroutine() defined in <coroutine>. And after this patch, GCC should be able to compile the whole <coroutine> header.
Details
- Reviewers
• Quuxplusone ldionne Mordante iains - Group Reviewers
Restricted Project - Commits
- rG6441536c27cf: [libcxx] [Coroutines] Support noop_coroutine for GCC
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The changes in <__coroutine/noop_coroutine_handle.h> might be correct, but I have no idea and assume I'll never have any idea. :)
Who knows enough about coroutine innards to review this?
libcxx/include/__coroutine/noop_coroutine_handle.h | ||
---|---|---|
78 | The double-underscore here seems suspicious. Could you make it a single underscore? or is this specific identifier magic to GCC somehow? | |
libcxx/test/std/language.support/support.coroutines/coroutine.handle/coroutine.handle.noop/noop_coroutine.pass.cpp | ||
23–24 | At this point, I think you could just remove this #if and start using the usual annotations, e.g. // UNSUPPORTED: clang-13 or whatever. | |
80–81 | Let's keep these consistent with lines 60–61. I have no preference on the order or whether they end with , "", but let's be consistent one way or the other. |
I added @iains who is the original author of libstdc++'s coroutine. I am not sure if Iain would take a look. But I believe the implementation might be correct since I looked at the implementation of libstdc++'s implementation.
libcxx/include/__coroutine/noop_coroutine_handle.h | ||
---|---|---|
78 | I guess you are referring the double-underscore in the middle instead of the start, right? My bad. It is my typo. | |
libcxx/test/std/language.support/support.coroutines/coroutine.handle/coroutine.handle.noop/noop_coroutine.pass.cpp | ||
23–24 | I think the line // UNSUPPORTED: libcpp-no-coroutines would filter clang-13 out. | |
80–81 | We can't do that. Since noop_coroutine_handle::done() is constexpr and std::coroutine_handle<>::done() isn't constexpr. |
libcxx/include/__coroutine/noop_coroutine_handle.h | ||
---|---|---|
78 | Yep, I meant the double-underscore in the middle. Also, please remove the trailing underscore in __dummy_resume_destroy_func_. Nobody's 100% sure whether we use trailing-underscore for data members or private members ;) but __dummy_resume_destroy_func_ is neither private nor data, so it definitely shouldn't have one. Just make it __dummy_resume_destroy_func(). | |
libcxx/test/std/language.support/support.coroutines/coroutine.handle/coroutine.handle.noop/noop_coroutine.pass.cpp | ||
23–24 | No problem. I was just trying to guess the name of some compiler that might fail the condition #if __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC). | |
80–81 | Oops, I hadn't noticed that these were regular assert instead of static_assert. So they can't use , ""; but at least you can put them in the same order: i.e., please swap lines 69 and 70. |
libcxx/test/std/language.support/support.coroutines/coroutine.handle/coroutine.handle.noop/noop_coroutine.pass.cpp | ||
---|---|---|
80–81 | Yeah, but is is weird to see assert(X.y() && X) since it would crash if X is null. How do you think about swap lines 58 and 59? |
libcxx/test/std/language.support/support.coroutines/coroutine.handle/coroutine.handle.noop/noop_coroutine.pass.cpp | ||
---|---|---|
80–81 | Sure, swap either pair, as long as it ends up consistent. |