mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
Consistently use G_GNUC_EXTENSION instead of __extension__
g-ir-scanner doesn't like __extension__, and while I can add it, since we have this macro, we should be using it consistently.
This commit is contained in:
parent
a84e6f982f
commit
2300be5be3
@ -72,104 +72,104 @@ G_END_DECLS
|
||||
#if defined(__GNUC__) && defined(G_ATOMIC_OP_USE_GCC_BUILTINS)
|
||||
|
||||
#define g_atomic_int_get(atomic) \
|
||||
(__extension__ ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
|
||||
(void) (0 ? *(atomic) ^ *(atomic) : 0); \
|
||||
__sync_synchronize (); \
|
||||
(gint) *(atomic); \
|
||||
}))
|
||||
#define g_atomic_int_set(atomic, newval) \
|
||||
(__extension__ ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
|
||||
(void) (0 ? *(atomic) ^ (newval) : 0); \
|
||||
*(atomic) = (newval); \
|
||||
__sync_synchronize (); \
|
||||
}))
|
||||
#define g_atomic_int_inc(atomic) \
|
||||
(__extension__ ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
|
||||
(void) (0 ? *(atomic) ^ *(atomic) : 0); \
|
||||
(void) __sync_fetch_and_add ((atomic), 1); \
|
||||
}))
|
||||
#define g_atomic_int_dec_and_test(atomic) \
|
||||
(__extension__ ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
|
||||
(void) (0 ? *(atomic) ^ *(atomic) : 0); \
|
||||
__sync_fetch_and_sub ((atomic), 1) == 1; \
|
||||
}))
|
||||
#define g_atomic_int_compare_and_exchange(atomic, oldval, newval) \
|
||||
(__extension__ ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
|
||||
(void) (0 ? *(atomic) ^ (newval) ^ (oldval) : 0); \
|
||||
(gboolean) __sync_bool_compare_and_swap ((atomic), (oldval), (newval)); \
|
||||
}))
|
||||
#define g_atomic_int_add(atomic, val) \
|
||||
(__extension__ ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
|
||||
(void) (0 ? *(atomic) ^ (val) : 0); \
|
||||
(gint) __sync_fetch_and_add ((atomic), (val)); \
|
||||
}))
|
||||
#define g_atomic_int_and(atomic, val) \
|
||||
(__extension__ ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
|
||||
(void) (0 ? *(atomic) ^ (val) : 0); \
|
||||
(guint) __sync_fetch_and_and ((atomic), (val)); \
|
||||
}))
|
||||
#define g_atomic_int_or(atomic, val) \
|
||||
(__extension__ ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
|
||||
(void) (0 ? *(atomic) ^ (val) : 0); \
|
||||
(guint) __sync_fetch_and_or ((atomic), (val)); \
|
||||
}))
|
||||
#define g_atomic_int_xor(atomic, val) \
|
||||
(__extension__ ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
|
||||
(void) (0 ? *(atomic) ^ (val) : 0); \
|
||||
(guint) __sync_fetch_and_xor ((atomic), (val)); \
|
||||
}))
|
||||
|
||||
#define g_atomic_pointer_get(atomic) \
|
||||
(__extension__ ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
|
||||
__sync_synchronize (); \
|
||||
(gpointer) *(atomic); \
|
||||
}))
|
||||
#define g_atomic_pointer_set(atomic, newval) \
|
||||
(__extension__ ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
|
||||
(void) (0 ? (gpointer) *(atomic) : 0); \
|
||||
*(atomic) = (__typeof__ (*(atomic))) (gsize) (newval); \
|
||||
__sync_synchronize (); \
|
||||
}))
|
||||
#define g_atomic_pointer_compare_and_exchange(atomic, oldval, newval) \
|
||||
(__extension__ ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
|
||||
(void) (0 ? (gpointer) *(atomic) : 0); \
|
||||
(gboolean) __sync_bool_compare_and_swap ((atomic), (oldval), (newval)); \
|
||||
}))
|
||||
#define g_atomic_pointer_add(atomic, val) \
|
||||
(__extension__ ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
|
||||
(void) (0 ? (gpointer) *(atomic) : 0); \
|
||||
(void) (0 ? (val) ^ (val) : 0); \
|
||||
(gssize) __sync_fetch_and_add ((atomic), (val)); \
|
||||
}))
|
||||
#define g_atomic_pointer_and(atomic, val) \
|
||||
(__extension__ ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
|
||||
(void) (0 ? (gpointer) *(atomic) : 0); \
|
||||
(void) (0 ? (val) ^ (val) : 0); \
|
||||
(gsize) __sync_fetch_and_and ((atomic), (val)); \
|
||||
}))
|
||||
#define g_atomic_pointer_or(atomic, val) \
|
||||
(__extension__ ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
|
||||
(void) (0 ? (gpointer) *(atomic) : 0); \
|
||||
(void) (0 ? (val) ^ (val) : 0); \
|
||||
(gsize) __sync_fetch_and_or ((atomic), (val)); \
|
||||
}))
|
||||
#define g_atomic_pointer_xor(atomic, val) \
|
||||
(__extension__ ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
|
||||
(void) (0 ? (gpointer) *(atomic) : 0); \
|
||||
(void) (0 ? (val) ^ (val) : 0); \
|
||||
|
@ -267,7 +267,7 @@
|
||||
*/
|
||||
#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
|
||||
#define _G_BOOLEAN_EXPR(expr) \
|
||||
__extension__ ({ \
|
||||
G_GNUC_EXTENSION ({ \
|
||||
int _g_boolean_var_; \
|
||||
if (expr) \
|
||||
_g_boolean_var_ = 1; \
|
||||
|
@ -100,7 +100,7 @@ gpointer g_try_realloc_n (gpointer mem,
|
||||
*/
|
||||
#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__)
|
||||
# define _G_NEW(struct_type, n_structs, func) \
|
||||
(struct_type *) (__extension__ ({ \
|
||||
(struct_type *) (G_GNUC_EXTENSION ({ \
|
||||
gsize __n = (gsize) (n_structs); \
|
||||
gsize __s = sizeof (struct_type); \
|
||||
gpointer __p; \
|
||||
@ -114,7 +114,7 @@ gpointer g_try_realloc_n (gpointer mem,
|
||||
__p; \
|
||||
}))
|
||||
# define _G_RENEW(struct_type, mem, n_structs, func) \
|
||||
(struct_type *) (__extension__ ({ \
|
||||
(struct_type *) (G_GNUC_EXTENSION ({ \
|
||||
gsize __n = (gsize) (n_structs); \
|
||||
gsize __s = sizeof (struct_type); \
|
||||
gpointer __p = (gpointer) (mem); \
|
||||
|
@ -173,7 +173,7 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
|
||||
#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__)
|
||||
# if defined (__i386__)
|
||||
# define GUINT16_SWAP_LE_BE_IA32(val) \
|
||||
(__extension__ \
|
||||
(G_GNUC_EXTENSION \
|
||||
({ register guint16 __v, __x = ((guint16) (val)); \
|
||||
if (__builtin_constant_p (__x)) \
|
||||
__v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \
|
||||
@ -187,7 +187,7 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
|
||||
&& !defined (__pentium__) && !defined (__i686__) \
|
||||
&& !defined (__pentiumpro__) && !defined (__pentium4__)
|
||||
# define GUINT32_SWAP_LE_BE_IA32(val) \
|
||||
(__extension__ \
|
||||
(G_GNUC_EXTENSION \
|
||||
({ register guint32 __v, __x = ((guint32) (val)); \
|
||||
if (__builtin_constant_p (__x)) \
|
||||
__v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
|
||||
@ -201,7 +201,7 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
|
||||
__v; }))
|
||||
# else /* 486 and higher has bswap */
|
||||
# define GUINT32_SWAP_LE_BE_IA32(val) \
|
||||
(__extension__ \
|
||||
(G_GNUC_EXTENSION \
|
||||
({ register guint32 __v, __x = ((guint32) (val)); \
|
||||
if (__builtin_constant_p (__x)) \
|
||||
__v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
|
||||
@ -212,7 +212,7 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
|
||||
__v; }))
|
||||
# endif /* processor specific 32-bit stuff */
|
||||
# define GUINT64_SWAP_LE_BE_IA32(val) \
|
||||
(__extension__ \
|
||||
(G_GNUC_EXTENSION \
|
||||
({ union { guint64 __ll; \
|
||||
guint32 __l[2]; } __w, __r; \
|
||||
__w.__ll = ((guint64) (val)); \
|
||||
@ -230,7 +230,7 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
|
||||
# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA32 (val))
|
||||
# elif defined (__ia64__)
|
||||
# define GUINT16_SWAP_LE_BE_IA64(val) \
|
||||
(__extension__ \
|
||||
(G_GNUC_EXTENSION \
|
||||
({ register guint16 __v, __x = ((guint16) (val)); \
|
||||
if (__builtin_constant_p (__x)) \
|
||||
__v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \
|
||||
@ -241,7 +241,7 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
|
||||
: "r" (__x)); \
|
||||
__v; }))
|
||||
# define GUINT32_SWAP_LE_BE_IA64(val) \
|
||||
(__extension__ \
|
||||
(G_GNUC_EXTENSION \
|
||||
({ register guint32 __v, __x = ((guint32) (val)); \
|
||||
if (__builtin_constant_p (__x)) \
|
||||
__v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
|
||||
@ -252,7 +252,7 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
|
||||
: "r" (__x)); \
|
||||
__v; }))
|
||||
# define GUINT64_SWAP_LE_BE_IA64(val) \
|
||||
(__extension__ \
|
||||
(G_GNUC_EXTENSION \
|
||||
({ register guint64 __v, __x = ((guint64) (val)); \
|
||||
if (__builtin_constant_p (__x)) \
|
||||
__v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \
|
||||
@ -266,7 +266,7 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
|
||||
# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA64 (val))
|
||||
# elif defined (__x86_64__)
|
||||
# define GUINT32_SWAP_LE_BE_X86_64(val) \
|
||||
(__extension__ \
|
||||
(G_GNUC_EXTENSION \
|
||||
({ register guint32 __v, __x = ((guint32) (val)); \
|
||||
if (__builtin_constant_p (__x)) \
|
||||
__v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
|
||||
@ -276,7 +276,7 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
|
||||
: "0" (__x)); \
|
||||
__v; }))
|
||||
# define GUINT64_SWAP_LE_BE_X86_64(val) \
|
||||
(__extension__ \
|
||||
(G_GNUC_EXTENSION \
|
||||
({ register guint64 __v, __x = ((guint64) (val)); \
|
||||
if (__builtin_constant_p (__x)) \
|
||||
__v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \
|
||||
|
Loading…
Reference in New Issue
Block a user