[glib: 1/2] gatomic.h: Make `glib_typeof` API break opt in.
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] gatomic.h: Make `glib_typeof` API break opt in.
- Date: Mon, 1 Mar 2021 13:19:09 +0000 (UTC)
commit 5b3e4f94b0514d0af605a4f6557def5a023a85f1
Author: Iain Lane <iainl gnome org>
Date: Mon Mar 1 09:18:03 2021 +0000
gatomic.h: Make `glib_typeof` API break opt in.
The changes in 4273c43902a7e6b22cea0041436ee5715c93be76 did not guard
macros in `gatomic.h` which use `glib_typeof`. This meant that when
552b8fd862061e74b5ad2ffe6a700f850a76f797 was committed, moving the
include of `<type_traits>` under such a guard, these macros were still
trying to use it. This broke the build of at least vte.
Fix this by guarding the API break in `gatomic.h` too.
glib/gatomic.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/glib/gatomic.h b/glib/gatomic.h
index a1545beb0..2ad648aad 100644
--- a/glib/gatomic.h
+++ b/glib/gatomic.h
@@ -108,7 +108,7 @@ G_END_DECLS
__atomic_store ((gint *)(atomic), &gais_temp, __ATOMIC_SEQ_CST); \
}))
-#if defined(glib_typeof)
+#if defined(glib_typeof) && (!defined(glib_typeof_2_68) || GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68)
#define g_atomic_pointer_get(atomic) \
(G_GNUC_EXTENSION ({ \
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
@@ -125,7 +125,7 @@ G_END_DECLS
(void) (0 ? (gpointer) * (atomic) : NULL); \
__atomic_store (gaps_temp_atomic, &gaps_temp_newval, __ATOMIC_SEQ_CST); \
}))
-#else /* if !defined(glib_typeof) */
+#else /* if !(defined(glib_typeof) && (!defined(glib_typeof_2_68) || GLIB_VERSION_MIN_REQUIRED >=
GLIB_VERSION_2_68)) */
#define g_atomic_pointer_get(atomic) \
(G_GNUC_EXTENSION ({ \
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
@@ -142,7 +142,7 @@ G_END_DECLS
(void) (0 ? (gpointer) *(atomic) : NULL); \
__atomic_store (gaps_temp_atomic, &gaps_temp_newval, __ATOMIC_SEQ_CST); \
}))
-#endif /* !defined(glib_typeof) */
+#endif /* if defined(glib_typeof) && (!defined(glib_typeof_2_68) || GLIB_VERSION_MIN_REQUIRED >=
GLIB_VERSION_2_68) */
#define g_atomic_int_inc(atomic) \
(G_GNUC_EXTENSION ({ \
@@ -307,7 +307,7 @@ G_END_DECLS
__asm__ __volatile__ ("" : : : "memory"); \
gapg_result; \
}))
-#if defined(glib_typeof)
+#if defined(glib_typeof) && (!defined(glib_typeof_2_68) || GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68)
#define g_atomic_pointer_set(atomic, newval) \
(G_GNUC_EXTENSION ({ \
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
@@ -316,7 +316,7 @@ G_END_DECLS
__asm__ __volatile__ ("" : : : "memory"); \
*(atomic) = (glib_typeof (*(atomic))) (gsize) (newval); \
}))
-#else /* if !defined(glib_typeof) */
+#else /* if !(defined(glib_typeof) && (!defined(glib_typeof_2_68) || GLIB_VERSION_MIN_REQUIRED >=
GLIB_VERSION_2_68)) */
#define g_atomic_pointer_set(atomic, newval) \
(G_GNUC_EXTENSION ({ \
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
@@ -325,7 +325,7 @@ G_END_DECLS
__asm__ __volatile__ ("" : : : "memory"); \
*(atomic) = (gpointer) (gsize) (newval); \
}))
-#endif /* defined(glib_typeof) */
+#endif /* if defined(glib_typeof) && (!defined(glib_typeof_2_68) || GLIB_VERSION_MIN_REQUIRED >=
GLIB_VERSION_2_68) */
#define g_atomic_int_inc(atomic) \
(G_GNUC_EXTENSION ({ \
@@ -428,7 +428,7 @@ G_END_DECLS
#define g_atomic_int_dec_and_test(atomic) \
(g_atomic_int_dec_and_test ((gint *) (atomic)))
-#if defined(glib_typeof)
+#if defined(glib_typeof) && (!defined(glib_typeof_2_68) || GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68)
/* The (void *) cast in the middle *looks* redundant, because
* g_atomic_pointer_get returns void * already, but it's to silence
* -Werror=bad-function-cast when we're doing something like:
@@ -438,7 +438,7 @@ G_END_DECLS
* non-pointer-typed result. */
#define g_atomic_pointer_get(atomic) \
(glib_typeof (*(atomic))) (void *) ((g_atomic_pointer_get) ((void *) atomic))
-#else /* !defined(glib_typeof) */
+#else /* !(defined(glib_typeof) && (!defined(glib_typeof_2_68) || GLIB_VERSION_MIN_REQUIRED >=
GLIB_VERSION_2_68)) */
#define g_atomic_pointer_get(atomic) \
(g_atomic_pointer_get (atomic))
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]