zyfeier commented on code in PR #14827:
URL: https://github.com/apache/nuttx/pull/14827#discussion_r1848189426


##########
include/nuttx/atomic.h:
##########
@@ -86,13 +86,149 @@ extern "C++"
 #    ifndef ATOMIC_VAR_INIT
 #      define ATOMIC_VAR_INIT(value) (value)
 #    endif
-#  else
-#    include <nuttx/lib/stdatomic.h>
 #  endif
-#else
-#  include <nuttx/lib/stdatomic.h>
 #endif
 
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#ifndef __ATOMIC_RELAXED
+#  define __ATOMIC_RELAXED 0
+#endif
+
+#ifndef __ATOMIC_CONSUME
+#  define __ATOMIC_CONSUME 1
+#endif
+
+#ifndef __ATOMIC_ACQUIRE
+#  define __ATOMIC_ACQUIRE 2
+#endif
+
+#ifndef __ATOMIC_RELEASE
+#  define __ATOMIC_RELEASE 3
+#endif
+
+#ifndef __ATOMIC_ACQ_REL
+#  define __ATOMIC_ACQ_REL 4
+#endif
+
+#ifndef __ATOMIC_SEQ_CST
+#  define __ATOMIC_SEQ_CST 5
+#endif
+
+#define atomic_set_explicit(obj, val, type) \
+  __atomic_store_4(obj, val, type)
+#define atomic_set(obj, val) \
+  atomic_set_explicit(obj, val, __ATOMIC_RELAXED)
+#define atomic_set_release(obj, val) \
+  atomic_set_explicit(obj, val, __ATOMIC_RELEASE)
+
+#define atomic_read_explicit(obj, type) \
+  (int)__atomic_load_4(obj, type)

Review Comment:
   built-in is unsigned int type.
   
    error: new declaration 'int64_t __atomic_fetch_and_8(volatile void*, 
int64_t, int)' ambiguates built-in declaration 'long unsigned int 
__atomic_fetch_and_8(volatile void*, long unsigned int, int)' [-fpermissive]
     104 | int64_t __atomic_fetch_and_8(FAR volatile void *ptr, int64_t value,



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to