Commit 54022b0d by Andy Getzendanner Committed by Copybara-Service

Switch time_state to explicit default initialization instead of value initialization.

It looks to me like the language rules treat these the same for this type, but evidently GCC feels differently.

This only matters under TSAN where SpinLock has a non-trivial destructor, and under C++20 where ABSL_CONST_INIT is implemented (as constinit) by gcc.

Fixes #1253

PiperOrigin-RevId: 469806751
Change-Id: Ic01b0142101f361bc19c95f9f9474e635669c58d
parent c18bb215
...@@ -196,7 +196,7 @@ struct ABSL_CACHELINE_ALIGNED TimeState { ...@@ -196,7 +196,7 @@ struct ABSL_CACHELINE_ALIGNED TimeState {
absl::base_internal::SpinLock lock{absl::kConstInit, absl::base_internal::SpinLock lock{absl::kConstInit,
base_internal::SCHEDULE_KERNEL_ONLY}; base_internal::SCHEDULE_KERNEL_ONLY};
}; };
ABSL_CONST_INIT static TimeState time_state{}; ABSL_CONST_INIT static TimeState time_state;
// Return the time in ns as told by the kernel interface. Place in *cycleclock // Return the time in ns as told by the kernel interface. Place in *cycleclock
// the value of the cycleclock at about the time of the syscall. // the value of the cycleclock at about the time of the syscall.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment