Skip to content

Commit

Permalink
Switch time_state to explicit default initialization instead of value…
Browse files Browse the repository at this point in the history
… initialization. (#1261)

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
  • Loading branch information
suertreus authored Aug 31, 2022
1 parent 273292d commit 8c0b94e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion absl/base/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
// LTS releases can be obtained from
// https://github.com/abseil/abseil-cpp/releases.
#define ABSL_LTS_RELEASE_VERSION 20220623
#define ABSL_LTS_RELEASE_PATCH_LEVEL 0
#define ABSL_LTS_RELEASE_PATCH_LEVEL 1

// Helper macro to convert a CPP variable to a string literal.
#define ABSL_INTERNAL_DO_TOKEN_STR(x) #x
Expand Down
2 changes: 1 addition & 1 deletion absl/time/clock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 8c0b94e

Please sign in to comment.