This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new fef52b11ee openamp/libmetal: Check CONFIG_HAVE_ATOMICS instead of
HAVE_STDATOMIC_H in atomic.h
fef52b11ee is described below
commit fef52b11eeb4a4be3a4b702c9d5a21a8bf93285d
Author: Zhe Weng <[email protected]>
AuthorDate: Mon Jul 10 14:16:58 2023 +0800
openamp/libmetal: Check CONFIG_HAVE_ATOMICS instead of HAVE_STDATOMIC_H in
atomic.h
When we use libmetal with other headers using stdatomic.h, we'll get
symbol conflict if we don't enable HAVE_STDATOMIC_H in libmetal. The
best solution might be using cmake to detect headers automatically, but
we can't. Fortunately we have CONFIG_HAVE_ATOMICS macro now, which can
replace HAVE_STDATOMIC_H when we're not using cmake.
Note: 2-Steps to use CONFIG_HAVE_ATOMICS
1. Include compiler.h for CONFIG_HAVE_ATOMICS definition
2. Check CONFIG_HAVE_ATOMICS instead of HAVE_STDATOMIC_H
Signed-off-by: Zhe Weng <[email protected]>
---
openamp/libmetal.defs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/openamp/libmetal.defs b/openamp/libmetal.defs
index 0dafbc5a13..d2df7b5b6a 100644
--- a/openamp/libmetal.defs
+++ b/openamp/libmetal.defs
@@ -67,6 +67,8 @@ LIBMETAL_HDRS_SEDEXP := \
s/@PROJECT_SYSTEM_UPPER@/nuttx/g; \
s/@PROJECT_PROCESSOR_UPPER@/$(LIBMETAL_ARCH)/g; \
s/@PROJECT_MACHINE_UPPER@/$(CONFIG_ARCH_CHIP)/g; \
+ s/cmakedefine HAVE_STDATOMIC_H/include <nuttx\/compiler.h>/g; \
+ s/defined(HAVE_STDATOMIC_H)/defined(CONFIG_HAVE_ATOMICS)/g; \
s/cmakedefine/undef/g"
ifeq ($(wildcard libmetal/.git),)