[glib: 2/3] build: Use _GLIB prefix for GCC features we detected at build time




commit 922bc1d995aaa3f28a879412297d8b95f5954a5d
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Wed Jun 22 22:54:03 2022 +0200

    build: Use _GLIB prefix for GCC features we detected at build time
    
    We used a _GCC prefix that is not our namesapce, so even if such value
    is not provided by the compiler, let's just use a better name.

 glib/gatomic.h | 10 +++++-----
 meson.build    |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/glib/gatomic.h b/glib/gatomic.h
index 6a4930cddc..11d319edcc 100644
--- a/glib/gatomic.h
+++ b/glib/gatomic.h
@@ -412,14 +412,14 @@ G_END_DECLS
     *(preval) = __sync_val_compare_and_swap ((atomic), (oldval), (newval));    \
     (*(preval) == (oldval)) ? TRUE : FALSE;                                    \
   }))
-#if defined(__GCC_HAVE_SYNC_SWAP)
+#if defined(_GLIB_GCC_HAVE_SYNC_SWAP)
 #define g_atomic_int_exchange(atomic, newval) \
   (G_GNUC_EXTENSION ({                                                       \
     G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint));                     \
     (void) (0 ? *(atomic) ^ (newval) : 1);                                   \
     (gint) __sync_swap ((atomic), (newval));                                 \
   }))
-#else /* defined(__GCC_HAVE_SYNC_SWAP) */
+#else /* defined(_GLIB_GCC_HAVE_SYNC_SWAP) */
   #define g_atomic_int_exchange(atomic, newval) \
   (G_GNUC_EXTENSION ({                                                       \
     gint oldval;                                                             \
@@ -431,7 +431,7 @@ G_END_DECLS
       } while (!__sync_bool_compare_and_swap (atomic, oldval, newval));      \
     oldval;                                                                  \
   }))
-#endif /* defined(__GCC_HAVE_SYNC_SWAP) */
+#endif /* defined(_GLIB_GCC_HAVE_SYNC_SWAP) */
 #define g_atomic_int_add(atomic, val) \
   (G_GNUC_EXTENSION ({                                                       \
     G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint));                     \
@@ -472,7 +472,7 @@ G_END_DECLS
     *(preval) = __sync_val_compare_and_swap ((atomic), (oldval), (newval));        \
     (*(preval) == (oldval)) ? TRUE : FALSE;                                        \
   }))
-#if defined(__GCC_HAVE_SYNC_SWAP)
+#if defined(_GLIB_GCC_HAVE_SYNC_SWAP)
 #define g_atomic_pointer_exchange(atomic, newval) \
   (G_GNUC_EXTENSION ({                                                       \
     G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer));                 \
@@ -491,7 +491,7 @@ G_END_DECLS
       } while (!__sync_bool_compare_and_swap (atomic, oldval, newval));      \
     oldval;                                                                  \
   }))
-#endif /* defined(__GCC_HAVE_SYNC_SWAP) */
+#endif /* defined(_GLIB_GCC_HAVE_SYNC_SWAP) */
 #define g_atomic_pointer_add(atomic, val) \
   (G_GNUC_EXTENSION ({                                                       \
     G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer));                 \
diff --git a/meson.build b/meson.build
index d886e4e48b..4147d3a03b 100644
--- a/meson.build
+++ b/meson.build
@@ -1874,7 +1874,7 @@ if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl' or cc.links(atomictest, na
       }
     '''
 
-    glib_conf.set('__GCC_HAVE_SYNC_SWAP', cc.links(sync_swap_test, name : 'sync swap'))
+    glib_conf.set('_GLIB_GCC_HAVE_SYNC_SWAP', cc.links(sync_swap_test, name : 'sync swap'))
   endif
 else
   have_atomic_lock_free = false


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