[libc++] Ensure that all public C++ headers include <__assert>
This patch changes the requirement for getting the declaration of the
assertion handler from including <__assert> to including any public
C++ header of the library. Note that C compatibility headers are
excluded because we don't implement all the C headers ourselves --
some of them are taken straight from the C library, like assert.h.
It also adds a generated test to check it. Furthermore, this new
generated test is designed in a way that will make it possible to
replace almost all the existing test-generation scripts with this
system in upcoming patches.
Differential Revision: https://reviews.llvm.org/D122506
NOKEYCHECK=True
GitOrigin-RevId: 385cc25a531a72c393cee44689e2c3194615bcec
diff --git a/docs/UsingLibcxx.rst b/docs/UsingLibcxx.rst
index 3eab44a..0d7e3a9 100644
--- a/docs/UsingLibcxx.rst
+++ b/docs/UsingLibcxx.rst
@@ -169,7 +169,7 @@
.. code-block:: cpp
// In HelloWorldHandler.cpp
- #include <__assert> // must include <__assert> before defining the handler
+ #include <version> // must include any libc++ header before defining the handler (C compatibility headers excluded)
void std::__libcpp_assertion_handler(char const* file, int line, char const* expression, char const* message) {
std::printf("Assertion %s failed at %s:%d, more info: %s", expression, file, line, message);