Skip to content

Commit c9d9dc9

Browse files
authored
[libc++] Remove _LIBCPP_ENABLE_ASSERTIONS, which had been deprecated (#113592)
1 parent 80a0973 commit c9d9dc9

File tree

4 files changed

+7
-58
lines changed

4 files changed

+7
-58
lines changed

libcxx/CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ include(CMakeDependentOption)
4545
include(HandleCompilerRT)
4646

4747
# Basic options ---------------------------------------------------------------
48-
option(LIBCXX_ENABLE_ASSERTIONS
49-
"Enable assertions inside the compiled library, and at the same time make it the
50-
default when compiling user code. Note that assertions can be enabled or disabled
51-
by users in their own code regardless of this option." OFF)
5248
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
5349
option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON)
5450
option(LIBCXX_ENABLE_FILESYSTEM
@@ -759,9 +755,9 @@ config_define_if_not(LIBCXX_ENABLE_WIDE_CHARACTERS _LIBCPP_HAS_NO_WIDE_CHARACTER
759755
config_define_if_not(LIBCXX_ENABLE_TIME_ZONE_DATABASE _LIBCPP_HAS_NO_TIME_ZONE_DATABASE)
760756
config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
761757

758+
# TODO: Remove in LLVM 21. We're leaving an error to make this fail explicitly.
762759
if (LIBCXX_ENABLE_ASSERTIONS)
763-
message(DEPRECATION "LIBCXX_ENABLE_ASSERTIONS is deprecated and will be removed in LLVM 20. Please use LIBCXX_HARDENING_MODE instead.")
764-
set(LIBCXX_HARDENING_MODE "extensive")
760+
message(FATAL_ERROR "LIBCXX_ENABLE_ASSERTIONS has been removed. Please use LIBCXX_HARDENING_MODE instead.")
765761
endif()
766762
if (LIBCXX_HARDENING_MODE STREQUAL "none")
767763
config_define(2 _LIBCPP_HARDENING_MODE_DEFAULT)

libcxx/docs/ReleaseNotes/20.rst

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ Improvements and New Features
6464
Deprecations and Removals
6565
-------------------------
6666

67-
- TODO: The ``LIBCXX_ENABLE_ASSERTIONS`` CMake variable and the ``_LIBCPP_ENABLE_ASSERTIONS`` macro that were used to
68-
enable the safe mode will be removed in LLVM 20.
67+
- The ``LIBCXX_ENABLE_ASSERTIONS`` CMake variable and the ``_LIBCPP_ENABLE_ASSERTIONS`` macro that were used to
68+
enable the safe mode have been removed in LLVM 20. Please use :ref:`support for hardening <using-hardening-modes>`
69+
instead.
6970

7071
- Support for the C++20 synchronization library (``<barrier>``, ``<latch>``, ``atomic::wait``, etc.) has been
7172
removed in language modes prior to C++20. If you are using these features prior to C++20, you will need to
@@ -91,12 +92,6 @@ Deprecations and Removals
9192
Upcoming Deprecations and Removals
9293
----------------------------------
9394

94-
LLVM 20
95-
~~~~~~~
96-
97-
- TODO
98-
99-
10095
LLVM 21
10196
~~~~~~~
10297

libcxx/include/__config

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,9 @@
3939

4040
// HARDENING {
4141

42-
// This is for backward compatibility -- make enabling `_LIBCPP_ENABLE_ASSERTIONS` (which predates hardening modes)
43-
// equivalent to setting the extensive mode. This is deprecated and will be removed in LLVM 20.
42+
// TODO: Remove in LLVM 21. We're making this an error to catch folks who might not have migrated.
4443
# ifdef _LIBCPP_ENABLE_ASSERTIONS
45-
# warning "_LIBCPP_ENABLE_ASSERTIONS is deprecated, please use _LIBCPP_HARDENING_MODE instead"
46-
# if _LIBCPP_ENABLE_ASSERTIONS != 0 && _LIBCPP_ENABLE_ASSERTIONS != 1
47-
# error "_LIBCPP_ENABLE_ASSERTIONS must be set to 0 or 1"
48-
# endif
49-
# if _LIBCPP_ENABLE_ASSERTIONS
50-
# define _LIBCPP_HARDENING_MODE _LIBCPP_HARDENING_MODE_EXTENSIVE
51-
# endif
44+
# error "_LIBCPP_ENABLE_ASSERTIONS has been removed, please use _LIBCPP_HARDENING_MODE instead"
5245
# endif
5346

5447
// The library provides the macro `_LIBCPP_HARDENING_MODE` which can be set to one of the following values:

libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)