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


##########
include/nuttx/atomic.h:
##########
@@ -27,72 +27,160 @@
  * Included Files
  ****************************************************************************/
 
+#include <stdbool.h>
+
 #ifdef __has_include
-#  if defined(__cplusplus) && __has_include(<atomic>)
+#  if __has_include(<atomic>) && defined(__cplusplus)
 extern "C++"
 {
 #    include <atomic>
+#    define _Atomic
+#    define ATOMIC_FUNC(f, n) atomic_##f##_explicit
 
-#    define ATOMIC_VAR_INIT(value) (value)
-
-  using std::memory_order;
-  using std::atomic_bool;
-  using std::atomic_char;
-  using std::atomic_schar;
-  using std::atomic_uchar;
-  using std::atomic_short;
-  using std::atomic_ushort;
-  using std::atomic_int;
-  using std::atomic_uint;
-  using std::atomic_long;
-  using std::atomic_ulong;
-  using std::atomic_llong;
-  using std::atomic_ullong;
-
-  using std::atomic_load;
   using std::atomic_load_explicit;
-  using std::atomic_store;
   using std::atomic_store_explicit;
-  using std::atomic_exchange;
   using std::atomic_exchange_explicit;
-  using std::atomic_compare_exchange_strong;
   using std::atomic_compare_exchange_strong_explicit;
-  using std::atomic_compare_exchange_weak;
   using std::atomic_compare_exchange_weak_explicit;
-  using std::atomic_flag_test_and_set;
-  using std::atomic_flag_test_and_set_explicit;
-  using std::atomic_flag_clear;
-  using std::atomic_flag_clear_explicit;
-  using std::atomic_fetch_add;
   using std::atomic_fetch_add_explicit;
-  using std::atomic_fetch_sub;
   using std::atomic_fetch_sub_explicit;
-  using std::atomic_fetch_and;
   using std::atomic_fetch_and_explicit;
-  using std::atomic_fetch_or;
   using std::atomic_fetch_or_explicit;
-  using std::atomic_fetch_xor;
   using std::atomic_fetch_xor_explicit;
 }
 #  elif __has_include(<stdatomic.h>) && \
         ((defined(__cplusplus) && __cplusplus >= 201103L) || \
          (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)) && \
          !defined(__STDC_NO_ATOMICS__)
-#    if !(__clang__) && defined(__cplusplus)
+#    if !defined(__clang__) && defined(__cplusplus)
 #      define _Atomic
 #    endif
-#    include <stdbool.h>
 #    include <stdatomic.h>
-#    ifndef ATOMIC_VAR_INIT
-#      define ATOMIC_VAR_INIT(value) (value)
-#    endif
-#  else
-#    include <nuttx/lib/stdatomic.h>
+#    define ATOMIC_FUNC(f, n) atomic_##f##_explicit
 #  endif
-#else
-#  include <nuttx/lib/stdatomic.h>
 #endif
 
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#ifndef ATOMIC_FUNC

Review Comment:
   there has two else block, first one #ifndef __has_include , second one 
#ifdef __has_include but not c++ and c block



-- 
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