[libcxx-commits] [PATCH] D108080: [libcxx] simplifies nodiscard by permanently enabling the attribute...

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Aug 14 15:20:53 PDT 2021


cjdb created this revision.
cjdb added reviewers: ldionne, zoecarver, Mordante.
cjdb requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

...for anything that already had `_LIBCPP_NODISCARD_EXT` or
`_LIBCPP_NODISCARD_AFTER_CXX17`.

nodiscard in libc++ has had multi-layered complexity for quite some
time, requiring users to know that they need to opt into a lot of what
we mark as nodiscard. There are also many knobs: an opt-in mechanism
(that users can easily overlook) and three opt-out mechanisms, which can
lead to confused users.

This patch does not break any code that wasn't already buggy or
questionable to begin with.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108080

Files:
  libcxx/docs/UsingLibcxx.rst
  libcxx/include/__algorithm/adjacent_find.h
  libcxx/include/__algorithm/all_of.h
  libcxx/include/__algorithm/any_of.h
  libcxx/include/__algorithm/binary_search.h
  libcxx/include/__algorithm/clamp.h
  libcxx/include/__algorithm/count.h
  libcxx/include/__algorithm/count_if.h
  libcxx/include/__algorithm/equal.h
  libcxx/include/__algorithm/equal_range.h
  libcxx/include/__algorithm/find.h
  libcxx/include/__algorithm/find_end.h
  libcxx/include/__algorithm/find_first_of.h
  libcxx/include/__algorithm/find_if.h
  libcxx/include/__algorithm/find_if_not.h
  libcxx/include/__algorithm/includes.h
  libcxx/include/__algorithm/is_heap.h
  libcxx/include/__algorithm/is_heap_until.h
  libcxx/include/__algorithm/is_partitioned.h
  libcxx/include/__algorithm/is_permutation.h
  libcxx/include/__algorithm/is_sorted.h
  libcxx/include/__algorithm/is_sorted_until.h
  libcxx/include/__algorithm/lexicographical_compare.h
  libcxx/include/__algorithm/lower_bound.h
  libcxx/include/__algorithm/max.h
  libcxx/include/__algorithm/max_element.h
  libcxx/include/__algorithm/min.h
  libcxx/include/__algorithm/min_element.h
  libcxx/include/__algorithm/minmax.h
  libcxx/include/__algorithm/minmax_element.h
  libcxx/include/__algorithm/mismatch.h
  libcxx/include/__algorithm/none_of.h
  libcxx/include/__algorithm/remove.h
  libcxx/include/__algorithm/remove_if.h
  libcxx/include/__algorithm/search.h
  libcxx/include/__algorithm/search_n.h
  libcxx/include/__algorithm/unique.h
  libcxx/include/__algorithm/upper_bound.h
  libcxx/include/__config
  libcxx/include/__functional/identity.h
  libcxx/include/__iterator/empty.h
  libcxx/include/__memory/allocator.h
  libcxx/include/__memory/allocator_traits.h
  libcxx/include/__memory/temporary_buffer.h
  libcxx/include/__mutex_base
  libcxx/include/__node_handle
  libcxx/include/__utility/as_const.h
  libcxx/include/__utility/forward.h
  libcxx/include/__utility/move.h
  libcxx/include/__utility/to_underlying.h
  libcxx/include/array
  libcxx/include/cstddef
  libcxx/include/deque
  libcxx/include/filesystem
  libcxx/include/forward_list
  libcxx/include/future
  libcxx/include/list
  libcxx/include/map
  libcxx/include/new
  libcxx/include/queue
  libcxx/include/regex
  libcxx/include/scoped_allocator
  libcxx/include/set
  libcxx/include/stack
  libcxx/include/string
  libcxx/include/string_view
  libcxx/include/type_traits
  libcxx/include/unordered_map
  libcxx/include/unordered_set
  libcxx/include/vector
  libcxx/test/libcxx/diagnostics/enable_nodiscard.verify.cpp
  libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.verify.cpp
  libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.verify.cpp
  libcxx/test/libcxx/diagnostics/nodiscard.pass.cpp
  libcxx/test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp
  libcxx/test/libcxx/diagnostics/nodiscard_aftercxx17.verify.cpp
  libcxx/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp
  libcxx/test/libcxx/diagnostics/nodiscard_extensions.verify.cpp
  libcxx/test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp
  libcxx/test/std/utilities/utility/forward/forward.fail.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108080.366464.patch
Type: text/x-patch
Size: 84665 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210814/bc9eaa0d/attachment-0001.bin>


More information about the libcxx-commits mailing list