Skip to content

Simplify the __assertion_handler build logic. Be friendly to IDEs. #93333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libcxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ if (NOT "${LIBCXX_HARDENING_MODE}" IN_LIST LIBCXX_SUPPORTED_HARDENING_MODES)
"Unsupported hardening mode: '${LIBCXX_HARDENING_MODE}'. Supported values are ${LIBCXX_SUPPORTED_HARDENING_MODES}.")
endif()
set(LIBCXX_ASSERTION_HANDLER_FILE
"${CMAKE_CURRENT_SOURCE_DIR}/vendor/llvm/default_assertion_handler.in"
"${CMAKE_CURRENT_SOURCE_DIR}/include/__assertion_handler"
CACHE STRING
"Specify the path to a header that contains a custom implementation of the
assertion handler that gets invoked when a hardening assertion fails. If
Expand Down
13 changes: 7 additions & 6 deletions libcxx/docs/BuildingLibcxx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ libc++ Feature Options

.. option:: LIBCXX_ASSERTION_HANDLER_FILE:PATH

**Default**:: ``"${CMAKE_CURRENT_SOURCE_DIR}/vendor/llvm/default_assertion_handler.in"``
**Default**:: ``"${CMAKE_CURRENT_SOURCE_DIR}/include/__assertion_handler"``

Specify the path to a header that contains a custom implementation of the
assertion handler that gets invoked when a hardening assertion fails. If
Expand Down Expand Up @@ -505,11 +505,12 @@ Under the hood, a hardening assertion will invoke the
that contains a custom definition of this macro and specify the path to the
header via the ``LIBCXX_ASSERTION_HANDLER_FILE`` CMake variable. If provided,
this header will be included by the library and replace the default
implementation. The header must not include any standard library headers
(directly or transitively) because doing so will almost always create a circular
dependency. The ``_LIBCPP_ASSERTION_HANDLER(message)`` macro takes a single
parameter that contains an error message explaining the hardening failure and
some details about the source location that triggered it.
implementation. The header may only include `__config`, `__config_site`,
and `__verbose_abort`, The custom header must not include any other standard
library headers (directly or transitively) because doing so will almost always
create a circular dependency. The ``_LIBCPP_ASSERTION_HANDLER(message)`` macro
takes a single parameter that contains an error message explaining the hardening
failure and some details about the source location that triggered it.

When a hardening assertion fails, it means that the program is about to invoke
library undefined behavior. For this reason, the custom assertion handler is
Expand Down
1 change: 1 addition & 0 deletions libcxx/include/module.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ module std [system] {
// must not be directly imported.
module std_private_assert [system] {
header "__assert"
header "__assertion_handler"
export *
}
module std_private_availability [system] {
Expand Down
Loading