From 7f351a5158dbfeca62f3b2113702fc443a560f26 Mon Sep 17 00:00:00 2001 From: Yongrong Wang Date: Tue, 2 Jul 2024 10:27:44 +0800 Subject: [PATCH] lib: fix compile error lib/errno.h: defined(__ARMCC_VERSION) for use GCC compile lib/autmoic: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 ++-- lib/compiler.h | 2 +- lib/errno.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/atomic.h b/lib/atomic.h index 2f4ab045..d49f1337 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(__ARMCC_VERSION) && \ +!defined(__STDC_NO_ATOMICS__) # include # include #elif defined(__GNUC__) diff --git a/lib/compiler.h b/lib/compiler.h index b2801191..b1728246 100644 --- a/lib/compiler.h +++ b/lib/compiler.h @@ -16,7 +16,7 @@ # include #elif defined(__ICCARM__) # include -#elif defined(__CC_ARM) || defined(__arm__) +#elif defined(__ARMCC_VERSION) # error "MDK-ARM ARMCC compiler requires the GNU extensions to work correctly" #else # error "Missing compiler support" diff --git a/lib/errno.h b/lib/errno.h index 2fc4f77a..fa8270db 100644 --- a/lib/errno.h +++ b/lib/errno.h @@ -14,7 +14,7 @@ #if defined(__ICCARM__) # include -#elif defined(__CC_ARM) || defined(__arm__) +#elif defined(__ARMCC_VERSION) # include #else # include