Skip to content

Commit d80dd85

Browse files
PS-9621: Initialization of std::atomic_flag caller_active_ in Percona Telemetry component is not compliant with the standard
https://perconadev.atlassian.net/browse/PS-9621 Initialization of std::atomic_flag in the constructor's initializer list is not compliant with the standard. Gcc allows it, however clang issues a compilation warning which turns into error in maintainer mode build. (error: braces around scalar initializer [-Werror,-Wbraced-scalar-init])
1 parent f01c613 commit d80dd85

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

components/percona_telemetry/worker.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ Worker::Worker(Config &config, Storage &storage, DataProvider &data_provider,
2525
storage_(storage),
2626
data_provider_(data_provider),
2727
logger_(logger),
28-
stop_worker_thd_(false),
29-
caller_active_(ATOMIC_FLAG_INIT) {}
28+
stop_worker_thd_(false) {}
3029

3130
bool Worker::start() {
3231
std::thread thd(&Worker::worker_thd_fn, this);

components/percona_telemetry/worker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Worker {
4444
DataProvider &data_provider_;
4545
Logger &logger_;
4646
std::atomic_bool stop_worker_thd_;
47-
std::atomic_flag caller_active_;
47+
std::atomic_flag caller_active_ = ATOMIC_FLAG_INIT;
4848
std::condition_variable cv_;
4949

5050
std::thread thd_;

0 commit comments

Comments
 (0)