[libcxx-commits] [PATCH] D130562: [libc++] Rename __libcpp_assertion_handler to __libcpp_verbose_abort

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 26 14:44:35 PDT 2022


Mordante added a comment.

In general LGTM!

I like the idea of using one function for all these ways to terminate the application.

However I'm not thrilled by the name, especially the verbose part. How do you feel about `__libcpp_terminate_handler`? (I know it's somewhat close to `std::terminate`.) Another suggestion `__libcpp_fatal_error_handler`.
However I don't want to make this a bikeshed, so when no better name is found I won't object against the proposed name.



================
Comment at: libcxx/docs/UsingLibcxx.rst:193
 
-Also note that the assertion handler should usually not return. Since the assertions in libc++
-catch undefined behavior, your code will proceed with undefined behavior if your assertion
-handler is called and does return.
-
-Furthermore, throwing an exception from the assertion handler is not recommended. Indeed, many
-functions in the library are ``noexcept``, and any exception thrown from the assertion handler
-will result in ``std::terminate`` being called.
-
-Back-deploying with a custom assertion handler
-----------------------------------------------
-When deploying to an older platform that does not provide a default assertion handler, the
-compiler will diagnose the usage of ``std::__libcpp_assertion_handler`` with an error. This
-is done to avoid the load-time error that would otherwise happen if the code was being deployed
-on the older system.
-
-If you are providing a custom assertion handler, this error is effectively a false positive.
-To let the library know that you are providing a custom assertion handler in back-deployment
-scenarios, you must define the ``_LIBCPP_AVAILABILITY_CUSTOM_ASSERTION_HANDLER_PROVIDED`` macro,
-and the library will assume that you are providing your own definition. If no definition is
-provided and the code is back-deployed to the older platform, it will fail to load when the
-dynamic linker fails to find a definition for ``std::__libcpp_assertion_handler``, so you
-should only remove the guard rails if you really mean it!
+Also note that the abort handler should never return. Since the assertions in libc++ catch
+undefined behavior, your code will proceed with undefined behavior if your handler is called
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130562/new/

https://reviews.llvm.org/D130562



More information about the libcxx-commits mailing list