[libcxx-commits] [PATCH] D154590: [libc++] mark barrier constructor as constexpr explicit
Edo via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 6 03:05:13 PDT 2023
diamante0018 created this revision.
Herald added a project: All.
diamante0018 requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
If I read the standard correctly, the public constructor of "barrier" should be marked as "constexpr explicit".
I see some of the internal classes used by the barrier header are correctly marked but I think, if I'm not mistaken, the standard would like the public class to have the correct definition as well.
Additionally, I think some of the public functions of the class barrier should have the inline specifier as well as they are marked with "_LIBCPP_INLINE_VISIBILITY".
Many other libc++ classes follow this "inline" pattern (latch for example)
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D154590
Files:
libcxx/include/barrier
Index: libcxx/include/barrier
===================================================================
--- libcxx/include/barrier
+++ libcxx/include/barrier
@@ -297,30 +297,30 @@
return __barrier_base<_CompletionF>::max();
}
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
- barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF())
+ inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
+ constexpr explicit barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF())
: __b_(__count, _VSTD::move(__completion)) {
}
barrier(barrier const&) = delete;
barrier& operator=(barrier const&) = delete;
- [[__nodiscard__]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
+ [[__nodiscard__]] inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
arrival_token arrive(ptrdiff_t __update = 1)
{
return __b_.arrive(__update);
}
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
+ inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
void wait(arrival_token&& __phase) const
{
__b_.wait(_VSTD::move(__phase));
}
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
+ inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
void arrive_and_wait()
{
wait(arrive());
}
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
+ inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
void arrive_and_drop()
{
__b_.arrive_and_drop();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154590.537646.patch
Type: text/x-patch
Size: 1542 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230706/ba1ba47d/attachment.bin>
More information about the libcxx-commits
mailing list