[libcxx-commits] [PATCH] D152653: [libc++] Add [[nodiscard]] extensions to the functions in <bit>
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jun 12 11:15:00 PDT 2023
philnik added inline comments.
================
Comment at: libcxx/include/__bit/bit_floor.h:26
template <__libcpp_unsigned_integer _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Tp bit_floor(_Tp __t) noexcept {
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp bit_floor(_Tp __t) noexcept {
return __t == 0 ? 0 : _Tp{1} << std::__bit_log2(__t);
----------------
Mordante wrote:
> These should be documented in `libcxx/docs/UsingLibcxx.rst`.
>
> Maybe we should look at a script/clang-tidy check to generate the documentation for these extensions.
IMO we should just remove the list, since I don't really see any use for it. A user doesn't care which functions are marked `[[nodiscard]]` unless the compiler complains (or doesn't complain if a `[[nodiscard]]` is missing), and implementers can just look at the code or the `*.nodiscard_externsions.*.cpp`. files or grep for `_LIBCPP_NODISCARD_EXT`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152653/new/
https://reviews.llvm.org/D152653
More information about the libcxx-commits
mailing list