summaryrefslogtreecommitdiff
path: root/AK/Atomic.h
diff options
context:
space:
mode:
authorAndrew Kaster <akaster@serenityos.org>2021-10-31 14:52:26 -0600
committerAndreas Kling <kling@serenityos.org>2021-11-14 22:52:35 +0100
commit163367da397e8597eebb732a02c10b2949d166a2 (patch)
treed5cc553edc1ac5e761f596d901aa6f8cb69b20d7 /AK/Atomic.h
parent22feb9d47b9c6d6fcd73ed90243c3e30cea7842a (diff)
downloadserenity-163367da397e8597eebb732a02c10b2949d166a2.zip
AK: Resolve clang-tidy warnings about unusual assignment operators
Either not returning *this, or in the case of Variant, not checking for self assignment. In AK::Atomic, we can't return *this due to the wrapper semantics Atomic implements.
Diffstat (limited to 'AK/Atomic.h')
-rw-r--r--AK/Atomic.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/AK/Atomic.h b/AK/Atomic.h
index e1a1007b2e..70ae6d1399 100644
--- a/AK/Atomic.h
+++ b/AK/Atomic.h
@@ -187,6 +187,7 @@ public:
return *ret;
}
+ // NOLINTNEXTLINE(misc-unconventional-assign-operator) We want operator= to exchange the value, so returning an object of type Atomic& here does not make sense
ALWAYS_INLINE T operator=(T desired) volatile noexcept
{
store(desired);
@@ -317,6 +318,7 @@ public:
return __atomic_load_n(&m_value, order);
}
+ // NOLINTNEXTLINE(misc-unconventional-assign-operator) We want operator= to exchange the value, so returning an object of type Atomic& here does not make sense
ALWAYS_INLINE T operator=(T desired) volatile noexcept
{
store(desired);
@@ -417,6 +419,7 @@ public:
return __atomic_load_n(&m_value, order);
}
+ // NOLINTNEXTLINE(misc-unconventional-assign-operator) We want operator= to exchange the value, so returning an object of type Atomic& here does not make sense
T* operator=(T* desired) volatile noexcept
{
store(desired);