From: Eric Long Date: Mon, 9 Oct 2023 06:53:31 +0000 (+0100) Subject: Fix CheckCxxAtomic to detect more accurately X-Git-Tag: archive/raspbian/16.2.11+ds-5+rpi1^2~7 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d25d786c79700c0673a2db8d449aa57d4e626d67;p=ceph.git 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 --- 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)