Fix: allow clang to build liburcu on RISC-V
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 18 Dec 2023 15:24:13 +0000 (10:24 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 18 Dec 2023 15:24:13 +0000 (10:24 -0500)
Clang also defines __GNUC__, so use URCU_GCC_VERSION to detect if built
with gcc.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic32a0cf64556f55ba4aa11141816fce1afcb0e90

include/urcu/uatomic/riscv.h

index a70ea25e107c04f2b2db371caee06243bfdbba7c..c1ba29e2dd1f711236c8ace982f3c75a49961c6d 100644 (file)
@@ -8,6 +8,12 @@
  * Let the compiler do it.
  */
 
+#ifndef _URCU_ARCH_UATOMIC_RISCV_H
+#define _URCU_ARCH_UATOMIC_RISCV_H
+
+#include <urcu/compiler.h>
+#include <urcu/system.h>
+
 /*
  * See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104831> for details.
  *
  *  - <https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=4990cf84c460f064d6281d0813f20b0ef20c7448>
  *  - <https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d199d2e56da2379004e7e0457150409c0c99d3e6>
  */
-#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 <urcu/compiler.h>
-#include <urcu/system.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
This page took 0.025777 seconds and 4 git commands to generate.