diff options
author | Louis Dionne <ldionne.2@gmail.com> | 2023-04-18 12:46:49 +0000 |
---|---|---|
committer | Louis Dionne <ldionne.2@gmail.com> | 2023-04-19 16:18:14 -0400 |
commit | 59736ceb8d45ac2a0e7e8b67fa2e067c9f3070ef (patch) | |
tree | 16697d02a30fa376a0d5e7faed3515bc7c55a2ae /libcxxabi | |
parent | adbdef6a9f39058f390ba285624b0dfb24bad7e8 (diff) | |
download | llvm-59736ceb8d45ac2a0e7e8b67fa2e067c9f3070ef.tar.gz |
[libc++abi] Make the error message for recursive initialization of function-local statics more explicit
The new message is a bit verbose, but it makes it clearer that this isn't
a problem in libc++abi, but instead a problem in the user's code. Otherwise,
we get bugs sent down to libc++abi because people see this message in their
crash logs.
Differential Revision: https://reviews.llvm.org/D148630
Diffstat (limited to 'libcxxabi')
-rw-r--r-- | libcxxabi/src/cxa_guard_impl.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libcxxabi/src/cxa_guard_impl.h b/libcxxabi/src/cxa_guard_impl.h index 47fe2b20bd96..e00d54b3a731 100644 --- a/libcxxabi/src/cxa_guard_impl.h +++ b/libcxxabi/src/cxa_guard_impl.h @@ -255,7 +255,7 @@ struct InitByteNoThreads { if (*init_byte_address == COMPLETE_BIT) return true; if (*init_byte_address & PENDING_BIT) - ABORT_WITH_MESSAGE("__cxa_guard_acquire detected recursive initialization"); + ABORT_WITH_MESSAGE("__cxa_guard_acquire detected recursive initialization: do you have a function-local static variable whose initialization depends on that function?"); *init_byte_address = PENDING_BIT; return false; } @@ -325,7 +325,7 @@ public: // Check for possible recursive initialization. if (has_thread_id_support && (*init_byte_address & PENDING_BIT)) { if (*thread_id_address == current_thread_id.get()) - ABORT_WITH_MESSAGE("__cxa_guard_acquire detected recursive initialization"); + ABORT_WITH_MESSAGE("__cxa_guard_acquire detected recursive initialization: do you have a function-local static variable whose initialization depends on that function?"); } // Wait until the pending bit is not set. @@ -460,7 +460,7 @@ public: // Check for recursive initialization if (has_thread_id_support && thread_id.load(std::_AO_Relaxed) == current_thread_id.get()) { - ABORT_WITH_MESSAGE("__cxa_guard_acquire detected recursive initialization"); + ABORT_WITH_MESSAGE("__cxa_guard_acquire detected recursive initialization: do you have a function-local static variable whose initialization depends on that function?"); } if ((last_val & WAITING_BIT) == 0) { |