From 4e7b1f9943cbeec405ab1994315ad374071474fb Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 18 Dec 2023 10:24:13 -0500 Subject: [PATCH] Fix: allow clang to build liburcu on RISC-V Clang also defines __GNUC__, so use URCU_GCC_VERSION to detect if built with gcc. Signed-off-by: Mathieu Desnoyers Change-Id: Ic32a0cf64556f55ba4aa11141816fce1afcb0e90 --- include/urcu/uatomic/riscv.h | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/include/urcu/uatomic/riscv.h b/include/urcu/uatomic/riscv.h index a70ea25..c1ba29e 100644 --- a/include/urcu/uatomic/riscv.h +++ b/include/urcu/uatomic/riscv.h @@ -8,6 +8,12 @@ * Let the compiler do it. */ +#ifndef _URCU_ARCH_UATOMIC_RISCV_H +#define _URCU_ARCH_UATOMIC_RISCV_H + +#include +#include + /* * See for details. * @@ -18,19 +24,10 @@ * - * - */ -#if defined(__GNUC__) -# error "Implementations of some atomic operations of GCC for RISC-V \ - are insufficient for sequential consistency. For this reason \ - Userspace RCU is currently marked as 'broken' for RISC-V with \ - GCC. However, it is still possible to use other toolchains." +#ifdef URCU_GCC_VERSION +# error "Implementations of some atomic operations of GCC for RISC-V are insufficient for sequential consistency. For this reason Userspace RCU is currently marked as 'broken' for RISC-V with GCC. However, it is still possible to use other toolchains." #endif -#ifndef _URCU_ARCH_UATOMIC_RISCV_H -#define _URCU_ARCH_UATOMIC_RISCV_H - -#include -#include - #ifdef __cplusplus extern "C" { #endif -- 2.34.1