diff options
author | Andy Getzendanner <durandal@google.com> | 2022-08-24 13:18:18 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-08-24 13:19:18 -0700 |
commit | 54022b0debdafa84faaef197f486fa83c68c22a4 (patch) | |
tree | 33c718e31a51f1fc18c439471683b73e99aae574 | |
parent | c18bb215786bfa8c51866445601ef9453b9b3888 (diff) | |
download | abseil-54022b0debdafa84faaef197f486fa83c68c22a4.tar.gz abseil-54022b0debdafa84faaef197f486fa83c68c22a4.tar.bz2 abseil-54022b0debdafa84faaef197f486fa83c68c22a4.zip |
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
-rw-r--r-- | absl/time/clock.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/absl/time/clock.cc b/absl/time/clock.cc index dba31611..2bf53d9c 100644 --- a/absl/time/clock.cc +++ b/absl/time/clock.cc @@ -196,7 +196,7 @@ struct ABSL_CACHELINE_ALIGNED TimeState { absl::base_internal::SpinLock lock{absl::kConstInit, 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 // the value of the cycleclock at about the time of the syscall. |