Skip to content

Commit 13ea134

Browse files
committed
[libc++] Make it an error to define _LIBCPP_DEBUG
We have been transitioning off of that macro since LLVM 15. Differential Revision: https://reviews.llvm.org/D137975
1 parent cfb0d62 commit 13ea134

File tree

5 files changed

+5
-60
lines changed

5 files changed

+5
-60
lines changed

libcxx/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ Deprecations and Removals
9797
Please migrate to ``<memory_resource>`` instead. Per libc++'s TS deprecation policy,
9898
``<experimental/memory_resource>`` will be removed in LLVM 18.
9999

100+
- The ``_LIBCPP_DEBUG`` macro is not honored anymore, and it is an error to try to use it. Please migrate to
101+
``_LIBCPP_ENABLE_DEBUG_MODE`` instead.
102+
100103
Upcoming Deprecations and Removals
101104
----------------------------------
102105

libcxx/include/__assert

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,9 @@
1717
# pragma GCC system_header
1818
#endif
1919

20-
// This is for backwards compatibility with code that might have been enabling
21-
// assertions through the Debug mode previously.
22-
// TODO: In LLVM 16, make it an error to define _LIBCPP_DEBUG
20+
// TODO: Remove in LLVM 17.
2321
#if defined(_LIBCPP_DEBUG)
24-
# ifndef _LIBCPP_ENABLE_ASSERTIONS
25-
# define _LIBCPP_ENABLE_ASSERTIONS 1
26-
# endif
22+
# error "Defining _LIBCPP_DEBUG is not supported anymore. Please use _LIBCPP_ENABLE_DEBUG_MODE instead."
2723
#endif
2824

2925
// Automatically enable assertions when the debug mode is enabled.

libcxx/include/__debug

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919
# pragma GCC system_header
2020
#endif
2121

22-
// Catch invalid uses of the legacy _LIBCPP_DEBUG toggle.
23-
#if defined(_LIBCPP_DEBUG) && _LIBCPP_DEBUG != 0 && !defined(_LIBCPP_ENABLE_DEBUG_MODE)
24-
# error "Enabling the debug mode now requires having configured the library with support for the debug mode"
25-
#endif
26-
2722
#if defined(_LIBCPP_ENABLE_DEBUG_MODE) && !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY)
2823
# define _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
2924
#endif

libcxx/test/libcxx/assertions/debug_mode_compatibility.pass.cpp

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

libcxx/test/libcxx/debug/debug.catch-legacy-macro.verify.cpp

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

0 commit comments

Comments
 (0)