From 6a4146fe74fc90109915a5bbde8eb215ad54f3db Mon Sep 17 00:00:00 2001 From: Yongrong Wang Date: Fri, 19 Jul 2024 17:40:51 +0800 Subject: [PATCH] atomic.h: fix conflicting type qualifiers compiler error fix compiler error: nuttx/include/metal/compiler/gcc/atomic.h:19:13: error: conflicting type qualifiers for 'atomic_flag' 19 | typedef int atomic_flag; | ^~~~~~~~~~~ In file included from nuttx/include/nuttx/net/netdev_lowerhalf.h:38, from virtio/virtio-net.c:33: prebuilts/gcc/linux/arm/lib/gcc/arm-none-eabi/13.2.1/include/ stdatomic.h:233:3: note: previous declaration of 'atomic_flag' with type 'atomic_flag' 233 | } atomic_flag; | ^~~~~~~~~~~ nuttx/include/metal/compiler/gcc/atomic.h:20:14: error: conflicting type qualifiers for 'atomic_char' 20 | typedef char atomic_char; ^~~~~~~~~~~ Signed-off-by: Yongrong Wang --- lib/atomic.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/atomic.h b/lib/atomic.h index 2f4ab045..fe2c1e0d 100644 --- a/lib/atomic.h +++ b/lib/atomic.h @@ -100,8 +100,8 @@ using std::atomic_fetch_and_explicit; using std::atomic_thread_fence; using std::atomic_signal_fence; -#elif defined(HAVE_STDATOMIC_H) && !defined(__CC_ARM) && !defined(__arm__) && \ - !defined(__STDC_NO_ATOMICS__) +#elif defined(HAVE_STDATOMIC_H) && !defined(__STDC_NO_ATOMICS__) && \ + ((!defined(__CC_ARM) && !defined(__arm__)) || defined(__GNUC__)) # include # include #elif defined(__GNUC__)