diff --git a/cmake/tests/cxx11_std_atomic.cpp b/cmake/tests/cxx11_std_atomic.cpp index c277031c5..c2b146873 100644 --- a/cmake/tests/cxx11_std_atomic.cpp +++ b/cmake/tests/cxx11_std_atomic.cpp @@ -13,9 +13,34 @@ template void test_atomic() { std::atomic a; + a.store(T{}); - T i = a.load(); - (void) i; + + { + [[maybe_unused]] T i = a.load(); + } + + { + [[maybe_unused]] T i = a.exchange(T{}); + } + + { + T expected{}; + [[maybe_unused]] bool b = a.compare_exchange_weak(expected, T{}); + } + + { + T expected{}; + [[maybe_unused]] bool b = a.compare_exchange_strong(expected, T{}); + } + + { + [[maybe_unused]] T i = a.fetch_sub(T{1}); + } + + { + [[maybe_unused]] T i = a.fetch_add(T{1}); + } } int main() diff --git a/cmake/tests/cxx11_std_atomic_128bit.cpp b/cmake/tests/cxx11_std_atomic_128bit.cpp index 9ceb98228..346d8ca7b 100644 --- a/cmake/tests/cxx11_std_atomic_128bit.cpp +++ b/cmake/tests/cxx11_std_atomic_128bit.cpp @@ -13,9 +13,26 @@ template void test_atomic() { std::atomic a; + a.store(T{}); - T i = a.load(); - (void) i; + + { + [[maybe_unused]] T i = a.load(); + } + + { + [[maybe_unused]] T i = a.exchange(T{}); + } + + { + T expected{}; + [[maybe_unused]] bool b = a.compare_exchange_weak(expected, T{}); + } + + { + T expected{}; + [[maybe_unused]] bool b = a.compare_exchange_strong(expected, T{}); + } } struct uint128_type