[libcxx-commits] [PATCH] D129054: [libc++] Consolidate the different [[nodiscard]] configuration options into a single one
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Jul 3 17:52:11 PDT 2022
philnik created this revision.
philnik added reviewers: ldionne, Mordante, var-const.
Herald added a project: All.
philnik requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D129054
Files:
libcxx/docs/ReleaseNotes.rst
libcxx/include/__config
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -823,13 +823,13 @@
// _LIBCPP_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not
// specified as such as an extension.
-# if defined(_LIBCPP_ENABLE_NODISCARD) && !defined(_LIBCPP_DISABLE_NODISCARD_EXT)
+# if defined (_LIBCPP_ENABLE_NODISCARD_EXT)
# define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD
# else
# define _LIBCPP_NODISCARD_EXT
# endif
-# if !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) && (_LIBCPP_STD_VER > 17 || defined(_LIBCPP_ENABLE_NODISCARD))
+# if _LIBCPP_STD_VER > 17 || defined(_LIBCPP_ENABLE_NODISCARD_EXT)
# define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD
# else
# define _LIBCPP_NODISCARD_AFTER_CXX17
Index: libcxx/docs/ReleaseNotes.rst
===================================================================
--- libcxx/docs/ReleaseNotes.rst
+++ libcxx/docs/ReleaseNotes.rst
@@ -160,6 +160,11 @@
To disable deprecation warnings you have to define ``_LIBCPP_DISABLE_DEPRECATION_WARNINGS``. Note that this
disables all deprecation warnings.
+- ``_LIBCPP_ENABLE_NODISCARD`` and ``_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17`` are no longer respected.
+ Any standards-required ``[[nodiscard]]`` applications in C++20 are now always enabled. Any extended applications
+ can now be enabled by defining ``_LIBCPP_ENABLE_NODISCARD_EXT``. Note that this also enables applications of
+ ``[[nodiscard]]`` in places where no version of the standard requires the attribute.
+
ABI Changes
-----------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129054.441987.patch
Type: text/x-patch
Size: 1625 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220704/2c22a70e/attachment.bin>
More information about the libcxx-commits
mailing list