[libc++abi] Make once_flag constinit in cxa_exception_storage (#124627)

This makes it clearer that initialization of this global variable is
taking place at compile-time, reducing the likelihood of static
initialization order fiasco.
This commit is contained in:
Louis Dionne 2025-01-28 16:44:57 -05:00 committed by GitHub
parent e89e7c4685
commit a06c893876
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -56,7 +56,7 @@ extern "C" {
namespace __cxxabiv1 {
namespace {
std::__libcpp_tls_key key_;
std::__libcpp_exec_once_flag flag_ = _LIBCPP_EXEC_ONCE_INITIALIZER;
constinit std::__libcpp_exec_once_flag flag_ = _LIBCPP_EXEC_ONCE_INITIALIZER;
void _LIBCPP_TLS_DESTRUCTOR_CC destruct_(void *p) {
__free_with_fallback(p);