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 759b77b975 nuttx/atomic.h:Add use condition for using stdatomic.h
759b77b975 is described below
commit 759b77b975780fc4a5c26414e4762e9e9d5e5f17
Author: chenrun1 <[email protected]>
AuthorDate: Wed Oct 23 14:43:31 2024 +0800
nuttx/atomic.h:Add use condition for using stdatomic.h
Summary:
add check !defined(__STDC_NO_ATOMICS__)
If the macro constant __STDC_NO_ATOMICS__(C11) is defined by the
compiler, the header <stdatomic.h>, the keyword _Atomic, and all of the names
listed here are not provided.
refer to:https://en.cppreference.com/w/c/atomic
Signed-off-by: chenrun1 <[email protected]>
---
include/nuttx/atomic.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/nuttx/atomic.h b/include/nuttx/atomic.h
index 6cdef92754..1c430f963f 100644
--- a/include/nuttx/atomic.h
+++ b/include/nuttx/atomic.h
@@ -76,7 +76,8 @@ extern "C++"
}
# elif __has_include(<stdatomic.h>) && \
((defined(__cplusplus) && __cplusplus >= 201103L) || \
- (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L))
+ (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)) && \
+ !defined(__STDC_NO_ATOMICS__)
# if !(__clang__) && defined(__cplusplus)
# define _Atomic
# endif