[glib: 2/4] atomic: Fix type error with clang++
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 2/4] atomic: Fix type error with clang++
- Date: Tue, 2 Feb 2021 10:51:51 +0000 (UTC)
commit d95885d91ead6569056fae08589606dff683d4bd
Author: Xavier Claessens <xavier claessens collabora com>
Date: Fri Oct 16 08:24:16 2020 -0400
atomic: Fix type error with clang++
clang++ checks the 2nd args of __atomic_compare_exchange_n() has the
same type as the first, which fails when 2nd arg is nullptr which is of
type nullptr_t.
Ideally it should do `glib_typeof (*(atomic)) gapcae_oldval = (oldval);`
to ensure oldval and atomic have compatible types but unfortunately that
does not work neither.
Since that function never has been typesafe, and it is not even
attempting to use glib_typeof in case __ATOMIC_SEQ_CST is not defined,
drop it in __atomic_ case too.
Fixes issue #2226.
glib/gatomic.h | 12 ------------
1 file changed, 12 deletions(-)
---
diff --git a/glib/gatomic.h b/glib/gatomic.h
index e6eccfada..12387df26 100644
--- a/glib/gatomic.h
+++ b/glib/gatomic.h
@@ -182,17 +182,6 @@ 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)); \
@@ -201,7 +190,6 @@ 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]