From b3cebea81f58495f103f42fe5eba7d2feacf9e7c Mon Sep 17 00:00:00 2001 From: Eric Long Date: Fri, 29 Sep 2023 09:36:19 +0100 Subject: [PATCH] Fix CheckCxxAtomic to detect more accurately Last-Update: 2023-09-29 Some platforms like riscv64 does not have full support for atomic primitives, yet passes the test. Adding operator++ fixes this issue. Gbp-Pq: Name fix-CheckCxxAtomic-riscv64.patch --- cmake/modules/CheckCxxAtomic.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/modules/CheckCxxAtomic.cmake b/cmake/modules/CheckCxxAtomic.cmake index 833977b75..2a4154e3d 100644 --- a/cmake/modules/CheckCxxAtomic.cmake +++ b/cmake/modules/CheckCxxAtomic.cmake @@ -11,7 +11,8 @@ function(check_cxx_atomics var) #include #include -#if defined(__s390x__) || (defined(__mips__) && _MIPS_SIM ==_ABI64 ) +#if defined(__s390x__) || (defined(__mips__) && _MIPS_SIM ==_ABI64 ) \ + || (defined __riscv && __riscv_xlen == 64) // Boost needs 16-byte atomics for tagged pointers. // These are implemented via inline instructions on the platform // if 16-byte alignment can be proven, and are delegated to libatomic @@ -32,7 +33,7 @@ int main() { std::atomic w2; std::atomic w4; std::atomic w8; - return w1 + w2 + w4 + w8; + return ++w1 + ++w2 + ++w4 + ++w8; } " ${var}) endfunction(check_cxx_atomics) -- 2.30.2