From bef76d4c1833153e1f10f89897a8a5d2592b5ddd Mon Sep 17 00:00:00 2001 From: Eric Tamme Date: Mon, 31 Aug 2015 11:27:43 -0600 Subject: [PATCH] add macros that get older versions of glib to compile if gcc is being used - credit to paulandrewhughes --- daemon/aux.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/daemon/aux.h b/daemon/aux.h index 615a4474d..c155ee8e9 100644 --- a/daemon/aux.h +++ b/daemon/aux.h @@ -20,6 +20,28 @@ #include "compat.h" #include +#if !(GLIB_CHECK_VERSION(2,30,0)) +#define g_atomic_int_and(atomic, val) \ +(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) \ +(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_pointer_add(atomic, val) \ +(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)); \ +})) +#endif + #if 0 && defined(__DEBUG) #define __THREAD_DEBUG 1 #endif