[glib/wip/atomic-take2: 1/2] Revert "atomic: Fix type error with clang++"




commit 70fc64e4207b984ceeaaed00d73be5bab4484a05
Author: Xavier Claessens <xavier claessens collabora com>
Date:   Tue Feb 2 13:16:39 2021 -0500

    Revert "atomic: Fix type error with clang++"
    
    This reverts commit d95885d91ead6569056fae08589606dff683d4bd.

 glib/gatomic.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/glib/gatomic.h b/glib/gatomic.h
index 12387df26..e6eccfada 100644
--- a/glib/gatomic.h
+++ b/glib/gatomic.h
@@ -182,6 +182,17 @@ G_END_DECLS
     (void) (0 ? *(atomic) ^ (val) : 1);                                      \
     (guint) __atomic_fetch_xor ((atomic), (val), __ATOMIC_SEQ_CST);          \
   }))
+
+#if defined(glib_typeof)
+#define g_atomic_pointer_compare_and_exchange(atomic, oldval, newval) \
+  (G_GNUC_EXTENSION ({                                                       \
+    G_STATIC_ASSERT (sizeof (oldval) == sizeof (gpointer));                  \
+    glib_typeof ((oldval)) gapcae_oldval = (oldval);                         \
+    G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer));                 \
+    (void) (0 ? (gpointer) *(atomic) : NULL);                                \
+    __atomic_compare_exchange_n ((atomic), &gapcae_oldval, (newval), FALSE, __ATOMIC_SEQ_CST, 
__ATOMIC_SEQ_CST) ? TRUE : FALSE; \
+  }))
+#else /* if !defined(glib_typeof) */
 #define g_atomic_pointer_compare_and_exchange(atomic, oldval, newval) \
   (G_GNUC_EXTENSION ({                                                       \
     G_STATIC_ASSERT (sizeof (oldval) == sizeof (gpointer));                  \
@@ -190,6 +201,7 @@ G_END_DECLS
     (void) (0 ? (gpointer) *(atomic) : NULL);                                \
     __atomic_compare_exchange_n ((atomic), &gapcae_oldval, (newval), FALSE, __ATOMIC_SEQ_CST, 
__ATOMIC_SEQ_CST) ? TRUE : FALSE; \
   }))
+#endif /* defined(glib_typeof) */
 #define g_atomic_pointer_add(atomic, val) \
   (G_GNUC_EXTENSION ({                                                       \
     G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer));                 \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]