xiaoxiang781216 commented on code in PR #14827: URL: https://github.com/apache/nuttx/pull/14827#discussion_r1846626875
########## 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: let's change the prototype to signed integer from: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html compiler expect a signed integer (e.g. __int128). -- 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