gatomic.h: Make glib_typeof API break opt in.

The changes in 4273c43902 did not guard
macros in `gatomic.h` which use `glib_typeof`. This meant that when
552b8fd862 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.
This commit is contained in:
Iain Lane 2021-03-01 09:18:03 +00:00
parent d799d27808
commit 5b3e4f94b0
No known key found for this signature in database
GPG Key ID: E352D5C51C5041D4

View File

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