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.
This commit is contained in:
Marco Trevisan (Treviño) 2022-06-22 22:54:03 +02:00
parent bfdeb37f6e
commit 922bc1d995
2 changed files with 6 additions and 6 deletions

View File

@ -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)); \

View File

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