1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-02-12 11:12:16 +00:00

Suppress clang warning "ATOMIC_FLAG_INIT marked deprecated" (#1502)

In C++20, macro 'ATOMIC_FLAG_INIT' has been marked as deprecated.
We need still to use it to be able to compile for C++17.
For now, just suppress this warning.
This commit is contained in:
tolk-vm 2025-01-27 17:09:21 +03:00 committed by GitHub
parent c720204199
commit b1c9466df4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 0 deletions

View file

@ -63,7 +63,10 @@ class SpinLock {
}
private:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-pragma"
std::atomic_flag flag_ = ATOMIC_FLAG_INIT;
#pragma clang diagnostic pop
void unlock() {
flag_.clear(std::memory_order_release);
}

View file

@ -176,7 +176,10 @@ void TsCerr::enterCritical() {
void TsCerr::exitCritical() {
lock_.clear(std::memory_order_release);
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-pragma"
TsCerr::Lock TsCerr::lock_ = ATOMIC_FLAG_INIT;
#pragma clang diagnostic pop
class DefaultLog : public LogInterface {
public:

View file

@ -343,7 +343,10 @@ class TsLog : public LogInterface {
private:
LogInterface *log_ = nullptr;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-pragma"
std::atomic_flag lock_ = ATOMIC_FLAG_INIT;
#pragma clang diagnostic pop
void enter_critical() {
while (lock_.test_and_set(std::memory_order_acquire)) {
// spin

View file

@ -149,7 +149,10 @@ class PollableFdInfo : private ListNode {
private:
NativeFd fd_{};
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-pragma"
std::atomic_flag lock_ = ATOMIC_FLAG_INIT;
#pragma clang diagnostic pop
PollFlagsSet flags_;
#if TD_PORT_WINDOWS
SpinLock observer_lock_;