diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -97,6 +97,9 @@ Please migrate to ```` instead. Per libc++'s TS deprecation policy, ```` will be removed in LLVM 18. +- The ``_LIBCPP_DEBUG`` macro is not honored anymore, and it is an error to try to use it. Please migrate to + ``_LIBCPP_ENABLE_DEBUG_MODE`` instead. + Upcoming Deprecations and Removals ---------------------------------- diff --git a/libcxx/include/__assert b/libcxx/include/__assert --- a/libcxx/include/__assert +++ b/libcxx/include/__assert @@ -17,13 +17,9 @@ # pragma GCC system_header #endif -// This is for backwards compatibility with code that might have been enabling -// assertions through the Debug mode previously. -// TODO: In LLVM 16, make it an error to define _LIBCPP_DEBUG +// TODO: Remove in LLVM 17. #if defined(_LIBCPP_DEBUG) -# ifndef _LIBCPP_ENABLE_ASSERTIONS -# define _LIBCPP_ENABLE_ASSERTIONS 1 -# endif +# error "Defining _LIBCPP_DEBUG is not supported anymore. Please use _LIBCPP_ENABLE_DEBUG_MODE instead." #endif // Automatically enable assertions when the debug mode is enabled. diff --git a/libcxx/include/__debug b/libcxx/include/__debug --- a/libcxx/include/__debug +++ b/libcxx/include/__debug @@ -19,11 +19,6 @@ # pragma GCC system_header #endif -// Catch invalid uses of the legacy _LIBCPP_DEBUG toggle. -#if defined(_LIBCPP_DEBUG) && _LIBCPP_DEBUG != 0 && !defined(_LIBCPP_ENABLE_DEBUG_MODE) -# error "Enabling the debug mode now requires having configured the library with support for the debug mode" -#endif - #if defined(_LIBCPP_ENABLE_DEBUG_MODE) && !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY) # define _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY #endif diff --git a/libcxx/test/libcxx/assertions/debug_mode_compatibility.pass.cpp b/libcxx/test/libcxx/assertions/debug_mode_compatibility.pass.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/assertions/debug_mode_compatibility.pass.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// This test ensures that assertions are still enabled when _LIBCPP_DEBUG=0 is -// defined, for backwards compatibility with code that might have been using -// it to enable assertions previously. - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0 - -// We flag uses of the assertion handler in older dylibs at compile-time to avoid runtime -// failures when back-deploying. -// XFAIL: use_system_cxx_lib && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0|12.0}} - -#include - -void std::__libcpp_verbose_abort(char const*, ...) { - std::exit(EXIT_SUCCESS); -} - -int main(int, char**) { - _LIBCPP_ASSERT(false, "message"); - return EXIT_FAILURE; -} diff --git a/libcxx/test/libcxx/debug/debug.catch-legacy-macro.verify.cpp b/libcxx/test/libcxx/debug/debug.catch-legacy-macro.verify.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/debug/debug.catch-legacy-macro.verify.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// This test ensures that we issue an error if we try to enable the debug mode with -// a library that was not built with support for the debug mode. - -// REQUIRES: !libcpp-has-debug-mode -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 - -// This test fails when modules are enabled because we fail to build module 'std' instead of -// issuing the preprocessor error. -// UNSUPPORTED: modules-build - -#include <__debug> - -// expected-error@*:* {{Enabling the debug mode now requires having configured the library with support for the debug mode}}