_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) _LIBCPP_HIDE_FROM_ABI inline
+_LIBCPP_NORETURN _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) _LIBCPP_HIDE_FROM_ABI inline
void __libcpp_verbose_abort(const char *, ...) {
- ::abort();
+ ::abort();
+ __builtin_unreachable(); // never reached, but needed to tell the compiler that the function never returns
}
_LIBCPP_END_NAMESPACE_STD
_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2)
+_LIBCPP_NORETURN _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2)
void __libcpp_verbose_abort(const char *__format, ...);
_LIBCPP_END_NAMESPACE_STD
// Make sure that we can enable assertions when we back-deploy to older platforms
// if we define _LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED.
//
-// Note that this test isn't really different from customize_handler.pass.cpp when
-// run outside of back-deployment scenarios, but we still run it all the time.
+// Note that this test isn't really different from customize_verbose_abort.pass.cpp when
+// run outside of back-deployment scenarios, but we always want to run this test.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 -D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED
-#include <cassert>
+#include <cstdlib>
-bool handler_called = false;
void std::__libcpp_verbose_abort(char const*, ...) {
- handler_called = true;
+ std::exit(EXIT_SUCCESS);
}
int main(int, char**) {
_LIBCPP_ASSERT(false, "message");
- assert(handler_called);
- return 0;
+ return EXIT_FAILURE;
}
// 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 <cassert>
+#include <cstdlib>
-bool handler_called = false;
void std::__libcpp_verbose_abort(char const*, ...) {
- handler_called = true;
+ std::exit(EXIT_SUCCESS);
}
int main(int, char**) {
_LIBCPP_ASSERT(false, "message");
- assert(handler_called);
- return 0;
+ return EXIT_FAILURE;
}
// 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 <cassert>
+#include <cstdlib>
-bool handler_called = false;
void std::__libcpp_verbose_abort(char const*, ...) {
- handler_called = true;
+ std::exit(EXIT_SUCCESS);
}
int main(int, char**) {
_LIBCPP_ASSERT(false, "message");
- assert(handler_called);
- return 0;
+ return EXIT_FAILURE;
}