forked from OSchip/llvm-project
[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
This commit is contained in:
parent
cfb0d628a7
commit
13ea134323
|
@ -97,6 +97,9 @@ Deprecations and Removals
|
|||
Please migrate to ``<memory_resource>`` instead. Per libc++'s TS deprecation policy,
|
||||
``<experimental/memory_resource>`` 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
|
||||
----------------------------------
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <cstdlib>
|
||||
|
||||
void std::__libcpp_verbose_abort(char const*, ...) {
|
||||
std::exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
_LIBCPP_ASSERT(false, "message");
|
||||
return EXIT_FAILURE;
|
||||
}
|
|
@ -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}}
|
Loading…
Reference in New Issue