[libcxx-commits] [libcxx] [libc++] Deprecate _LIBCPP_ENABLE_ASSERTIONS & friends (PR #98364)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jul 10 11:17:40 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Louis Dionne (ldionne)
<details>
<summary>Changes</summary>
In LLVM 19, the old xxx_ENABLE_ASSERTIONS settings should be deprecated with the goal of removing them entirely in LLVM 20.
---
Full diff: https://github.com/llvm/llvm-project/pull/98364.diff
3 Files Affected:
- (modified) libcxx/CMakeLists.txt (+1)
- (modified) libcxx/docs/ReleaseNotes/19.rst (+1-1)
- (modified) libcxx/include/__config (+2-2)
``````````diff
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index e098bd574eec7..7d0b8d12674bd 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -786,6 +786,7 @@ config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_N
# TODO(LLVM 19): Produce a deprecation warning.
if (LIBCXX_ENABLE_ASSERTIONS)
+ message(DEPRECATION "LIBCXX_ENABLE_ASSERTIONS is deprecated and will be removed in LLVM 20. Please use LIBCXX_HARDENING_MODE instead.")
set(LIBCXX_HARDENING_MODE "extensive")
endif()
if (LIBCXX_HARDENING_MODE STREQUAL "none")
diff --git a/libcxx/docs/ReleaseNotes/19.rst b/libcxx/docs/ReleaseNotes/19.rst
index 893e418d32d1d..a72a583ffb0be 100644
--- a/libcxx/docs/ReleaseNotes/19.rst
+++ b/libcxx/docs/ReleaseNotes/19.rst
@@ -85,7 +85,7 @@ Deprecations and Removals
This decision is based on LEWGs discussion on `P3122 <https://wg21.link/P3122>` and `P3162 <https://wg21.link/P3162>`
to not use ``[[nodiscard]]`` in the standard.
-- TODO: The ``LIBCXX_ENABLE_ASSERTIONS`` CMake variable that was used to enable the safe mode has been deprecated and setting
+- The ``LIBCXX_ENABLE_ASSERTIONS`` CMake variable that was used to enable the safe mode has been deprecated and setting
it triggers an error; use the ``LIBCXX_HARDENING_MODE`` CMake variable with the value ``extensive`` instead. Similarly,
the ``_LIBCPP_ENABLE_ASSERTIONS`` macro has been deprecated (setting it to ``1`` still enables the extensive mode in
the LLVM 19 release while also issuing a deprecation warning). See :ref:`the hardening documentation
diff --git a/libcxx/include/__config b/libcxx/include/__config
index dfb14fd6a380c..91bc6fc21df8e 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -38,10 +38,10 @@
// HARDENING {
-// TODO(hardening): deprecate this in LLVM 19.
// This is for backward compatibility -- make enabling `_LIBCPP_ENABLE_ASSERTIONS` (which predates hardening modes)
-// equivalent to setting the extensive mode.
+// equivalent to setting the extensive mode. This is deprecated and will be removed in LLVM 20.
# ifdef _LIBCPP_ENABLE_ASSERTIONS
+# warning "_LIBCPP_ENABLE_ASSERTIONS is deprecated, please use _LIBCPP_HARDENING_MODE instead"
# if _LIBCPP_ENABLE_ASSERTIONS != 0 && _LIBCPP_ENABLE_ASSERTIONS != 1
# error "_LIBCPP_ENABLE_ASSERTIONS must be set to 0 or 1"
# endif
``````````
</details>
https://github.com/llvm/llvm-project/pull/98364
More information about the libcxx-commits
mailing list