In C++20, atomics are value-initialized by default.

ATOMIC_FLAG_INIT is thus deprecated.  Feature-test for this.

Bug: chromium:1284275
Change-Id: I000d9d8ba5248bf72390b25b2165094faf5aa3db
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3629949
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Peter Kasting 2022-05-05 15:19:17 -07:00 committed by Crashpad LUCI CQ
parent 55cee0127e
commit dfb3b59660

View File

@ -287,7 +287,12 @@ bool AddKeyValueToMap(std::map<std::string, std::string>* map,
// a normal exit, or if a CallMetricsRecordNormalExit object is destroyed after
// something else logs an exit event.
void MetricsRecordExit(Metrics::LifetimeMilestone milestone) {
#if !defined(__cpp_lib_atomic_value_initialization) || \
__cpp_lib_atomic_value_initialization < 201911L
static std::atomic_flag metrics_exit_recorded = ATOMIC_FLAG_INIT;
#else
static std::atomic_flag metrics_exit_recorded;
#endif
if (!metrics_exit_recorded.test_and_set()) {
Metrics::HandlerLifetimeMilestone(milestone);
}