--- glib-2.18.4-orig/glib/gatomic.c 2009-04-02 15:20:51.000000000 -0400 +++ glib-2.18.4-orig/glib/gatomic.c 2009-04-02 15:36:21.000000000 -0400 @@ -36,7 +36,7 @@ /* Adapted from CVS version 1.10 of glibc's sysdeps/i386/i486/bits/atomic.h */ gint -g_atomic_int_exchange_and_add (volatile gint *atomic, +g_atomic_int_exchange_and_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val) { gint result; @@ -48,7 +48,7 @@ } void -g_atomic_int_add (volatile gint *atomic, +g_atomic_int_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val) { __asm__ __volatile__ ("lock; addl %1,%0" @@ -57,7 +57,7 @@ } gboolean -g_atomic_int_compare_and_exchange (volatile gint *atomic, +g_atomic_int_compare_and_exchange (volatile gint G_GNUC_MAY_ALIAS *atomic, gint oldval, gint newval) { @@ -75,7 +75,7 @@ * arguments and calling the former function */ gboolean -g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic, +g_atomic_pointer_compare_and_exchange (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer oldval, gpointer newval) { @@ -103,7 +103,7 @@ # if GLIB_SIZEOF_VOID_P == 4 /* 32-bit system */ gboolean -g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic, +g_atomic_pointer_compare_and_exchange (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer oldval, gpointer newval) { @@ -116,7 +116,7 @@ } # elif GLIB_SIZEOF_VOID_P == 8 /* 64-bit system */ gboolean -g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic, +g_atomic_pointer_compare_and_exchange (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer oldval, gpointer newval) { @@ -162,7 +162,7 @@ }) # if GLIB_SIZEOF_VOID_P == 4 /* 32-bit system */ gboolean -g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic, +g_atomic_pointer_compare_and_exchange (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer oldval, gpointer newval) { @@ -188,7 +188,7 @@ } # elif GLIB_SIZEOF_VOID_P == 8 /* 64-bit system */ gboolean -g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic, +g_atomic_pointer_compare_and_exchange (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer oldval, gpointer newval) { @@ -220,7 +220,7 @@ /* Adapted from CVS version 1.9 of glibc's sysdeps/x86_64/bits/atomic.h */ gint -g_atomic_int_exchange_and_add (volatile gint *atomic, +g_atomic_int_exchange_and_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val) { gint result; @@ -232,7 +232,7 @@ } void -g_atomic_int_add (volatile gint *atomic, +g_atomic_int_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val) { __asm__ __volatile__ ("lock; addl %1,%0" @@ -241,7 +241,7 @@ } gboolean -g_atomic_int_compare_and_exchange (volatile gint *atomic, +g_atomic_int_compare_and_exchange (volatile gint G_GNUC_MAY_ALIAS *atomic, gint oldval, gint newval) { @@ -255,7 +255,7 @@ } gboolean -g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic, +g_atomic_pointer_compare_and_exchange (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer oldval, gpointer newval) { @@ -277,7 +277,7 @@ /* Non-optimizing compile bails on the following two asm statements * for reasons unknown to the author */ gint -g_atomic_int_exchange_and_add (volatile gint *atomic, +g_atomic_int_exchange_and_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val) { gint result, temp; @@ -303,7 +303,7 @@ /* The same as above, to save a function call repeated here */ void -g_atomic_int_add (volatile gint *atomic, +g_atomic_int_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val) { gint result, temp; @@ -327,7 +327,7 @@ } # else /* !__OPTIMIZE__ */ gint -g_atomic_int_exchange_and_add (volatile gint *atomic, +g_atomic_int_exchange_and_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val) { gint result; @@ -339,7 +339,7 @@ } void -g_atomic_int_add (volatile gint *atomic, +g_atomic_int_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val) { gint result; @@ -351,7 +351,7 @@ # if GLIB_SIZEOF_VOID_P == 4 /* 32-bit system */ gboolean -g_atomic_int_compare_and_exchange (volatile gint *atomic, +g_atomic_int_compare_and_exchange (volatile gint G_GNUC_MAY_ALIAS *atomic, gint oldval, gint newval) { @@ -383,7 +383,7 @@ } gboolean -g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic, +g_atomic_pointer_compare_and_exchange (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer oldval, gpointer newval) { @@ -415,7 +415,7 @@ } # elif GLIB_SIZEOF_VOID_P == 8 /* 64-bit system */ gboolean -g_atomic_int_compare_and_exchange (volatile gint *atomic, +g_atomic_int_compare_and_exchange (volatile gint G_GNUC_MAY_ALIAS *atomic, gint oldval, gint newval) { @@ -449,7 +449,7 @@ } gboolean -g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic, +g_atomic_pointer_compare_and_exchange (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer oldval, gpointer newval) { @@ -489,7 +489,7 @@ /* Adapted from CVS version 1.8 of glibc's sysdeps/ia64/bits/atomic.h */ gint -g_atomic_int_exchange_and_add (volatile gint *atomic, +g_atomic_int_exchange_and_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val) { return __sync_fetch_and_add (atomic, val); @@ -503,7 +503,7 @@ } gboolean -g_atomic_int_compare_and_exchange (volatile gint *atomic, +g_atomic_int_compare_and_exchange (volatile gint G_GNUC_MAY_ALIAS *atomic, gint oldval, gint newval) { @@ -511,7 +511,7 @@ } gboolean -g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic, +g_atomic_pointer_compare_and_exchange (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer oldval, gpointer newval) { @@ -534,7 +534,7 @@ # if GLIB_SIZEOF_VOID_P == 4 /* 32-bit system */ gboolean -g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic, +g_atomic_pointer_compare_and_exchange (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer oldval, gpointer newval) { @@ -546,7 +546,7 @@ } # elif GLIB_SIZEOF_VOID_P == 8 /* 64-bit system */ gboolean -g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic, +g_atomic_pointer_compare_and_exchange (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer oldval, gpointer newval) { @@ -590,7 +590,7 @@ } gint -g_atomic_int_exchange_and_add (volatile gint *atomic, +g_atomic_int_exchange_and_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val) { gint result; @@ -604,7 +604,7 @@ } void -g_atomic_int_add (volatile gint *atomic, +g_atomic_int_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val) { atomic_spin_lock(); @@ -613,7 +613,7 @@ } gboolean -g_atomic_int_compare_and_exchange (volatile gint *atomic, +g_atomic_int_compare_and_exchange (volatile gint G_GNUC_MAY_ALIAS *atomic, gint oldval, gint newval) { @@ -633,7 +633,7 @@ } gboolean -g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic, +g_atomic_pointer_compare_and_exchange (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer oldval, gpointer newval) { @@ -675,21 +675,21 @@ # endif gint32 -g_atomic_int_exchange_and_add (volatile gint32 *atomic, +g_atomic_int_exchange_and_add (volatile gint32 G_GNUC_MAY_ALIAS *atomic, gint32 val) { return InterlockedExchangeAdd (atomic, val); } void -g_atomic_int_add (volatile gint32 *atomic, +g_atomic_int_add (volatile gint32 G_GNUC_MAY_ALIAS *atomic, gint32 val) { InterlockedExchangeAdd (atomic, val); } gboolean -g_atomic_int_compare_and_exchange (volatile gint32 *atomic, +g_atomic_int_compare_and_exchange (volatile gint32 G_GNUC_MAY_ALIAS *atomic, gint32 oldval, gint32 newval) { @@ -705,7 +705,7 @@ } gboolean -g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic, +g_atomic_pointer_compare_and_exchange (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer oldval, gpointer newval) { @@ -726,7 +726,7 @@ static GMutex *g_atomic_mutex; gint -g_atomic_int_exchange_and_add (volatile gint *atomic, +g_atomic_int_exchange_and_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val) { gint result; @@ -741,7 +741,7 @@ void -g_atomic_int_add (volatile gint *atomic, +g_atomic_int_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val) { g_mutex_lock (g_atomic_mutex); @@ -750,7 +750,7 @@ } gboolean -g_atomic_int_compare_and_exchange (volatile gint *atomic, +g_atomic_int_compare_and_exchange (volatile gint G_GNUC_MAY_ALIAS *atomic, gint oldval, gint newval) { @@ -770,7 +770,7 @@ } gboolean -g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic, +g_atomic_pointer_compare_and_exchange (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer oldval, gpointer newval) { @@ -791,7 +791,7 @@ #ifdef G_ATOMIC_OP_MEMORY_BARRIER_NEEDED gint -g_atomic_int_get (volatile gint *atomic) +g_atomic_int_get (volatile gint G_GNUC_MAY_ALIAS *atomic) { gint result; @@ -803,7 +803,7 @@ } void -g_atomic_int_set (volatile gint *atomic, +g_atomic_int_set (volatile gint G_GNUC_MAY_ALIAS *atomic, gint newval) { g_mutex_lock (g_atomic_mutex); @@ -812,7 +812,7 @@ } gpointer -g_atomic_pointer_get (volatile gpointer *atomic) +g_atomic_pointer_get (volatile gpointer G_GNUC_MAY_ALIAS *atomic) { gpointer result; @@ -824,7 +824,7 @@ } void -g_atomic_pointer_set (volatile gpointer *atomic, +g_atomic_pointer_set (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer newval) { g_mutex_lock (g_atomic_mutex); @@ -834,14 +834,14 @@ #endif /* G_ATOMIC_OP_MEMORY_BARRIER_NEEDED */ #elif defined (G_ATOMIC_OP_MEMORY_BARRIER_NEEDED) gint -g_atomic_int_get (volatile gint *atomic) +g_atomic_int_get (volatile gint G_GNUC_MAY_ALIAS *atomic) { G_ATOMIC_MEMORY_BARRIER; return *atomic; } void -g_atomic_int_set (volatile gint *atomic, +g_atomic_int_set (volatile gint G_GNUC_MAY_ALIAS *atomic, gint newval) { *atomic = newval; @@ -849,14 +849,14 @@ } gpointer -g_atomic_pointer_get (volatile gpointer *atomic) +g_atomic_pointer_get (volatile gpointer G_GNUC_MAY_ALIAS *atomic) { G_ATOMIC_MEMORY_BARRIER; return *atomic; } void -g_atomic_pointer_set (volatile gpointer *atomic, +g_atomic_pointer_set (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer newval) { *atomic = newval; @@ -866,7 +866,7 @@ #ifdef ATOMIC_INT_CMP_XCHG gboolean -g_atomic_int_compare_and_exchange (volatile gint *atomic, +g_atomic_int_compare_and_exchange (volatile gint G_GNUC_MAY_ALIAS *atomic, gint oldval, gint newval) { @@ -874,7 +874,7 @@ } gint -g_atomic_int_exchange_and_add (volatile gint *atomic, +g_atomic_int_exchange_and_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val) { gint result; @@ -886,7 +886,7 @@ } void -g_atomic_int_add (volatile gint *atomic, +g_atomic_int_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val) { gint result; @@ -906,26 +906,26 @@ #ifndef G_ATOMIC_OP_MEMORY_BARRIER_NEEDED gint -(g_atomic_int_get) (volatile gint *atomic) +(g_atomic_int_get) (volatile gint G_GNUC_MAY_ALIAS *atomic) { return g_atomic_int_get (atomic); } void -(g_atomic_int_set) (volatile gint *atomic, +(g_atomic_int_set) (volatile gint G_GNUC_MAY_ALIAS *atomic, gint newval) { g_atomic_int_set (atomic, newval); } gpointer -(g_atomic_pointer_get) (volatile gpointer *atomic) +(g_atomic_pointer_get) (volatile gpointer G_GNUC_MAY_ALIAS *atomic) { return g_atomic_pointer_get (atomic); } void -(g_atomic_pointer_set) (volatile gpointer *atomic, +(g_atomic_pointer_set) (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer newval) { g_atomic_pointer_set (atomic, newval); --- glib-2.18.4-orig/glib/gatomic.h 2009-04-02 15:20:51.000000000 -0400 +++ glib-2.18.4-orig/glib/gatomic.h 2009-04-02 15:40:20.000000000 -0400 @@ -38,29 +38,42 @@ G_BEGIN_DECLS -gint g_atomic_int_exchange_and_add (volatile gint *atomic, +gint g_atomic_int_exchange_and_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val); -void g_atomic_int_add (volatile gint *atomic, +void g_atomic_int_add (volatile gint G_GNUC_MAY_ALIAS *atomic, gint val); -gboolean g_atomic_int_compare_and_exchange (volatile gint *atomic, +gboolean g_atomic_int_compare_and_exchange (volatile gint G_GNUC_MAY_ALIAS *atomic, gint oldval, gint newval); -gboolean g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic, +gboolean g_atomic_pointer_compare_and_exchange (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer oldval, gpointer newval); -gint g_atomic_int_get (volatile gint *atomic); -void g_atomic_int_set (volatile gint *atomic, +gint g_atomic_int_get (volatile gint G_GNUC_MAY_ALIAS *atomic); +void g_atomic_int_set (volatile gint G_GNUC_MAY_ALIAS *atomic, gint newval); -gpointer g_atomic_pointer_get (volatile gpointer *atomic); -void g_atomic_pointer_set (volatile gpointer *atomic, +gpointer g_atomic_pointer_get (volatile gpointer G_GNUC_MAY_ALIAS *atomic); +void g_atomic_pointer_set (volatile gpointer G_GNUC_MAY_ALIAS *atomic, gpointer newval); #ifndef G_ATOMIC_OP_MEMORY_BARRIER_NEEDED -# define g_atomic_int_get(atomic) (*(atomic)) +# define g_atomic_int_get(atomic) ((gint)*(atomic)) # define g_atomic_int_set(atomic, newval) ((void) (*(atomic) = (newval))) -# define g_atomic_pointer_get(atomic) (*(atomic)) +# define g_atomic_pointer_get(atomic) ((gpointer)*(atomic)) # define g_atomic_pointer_set(atomic, newval) ((void) (*(atomic) = (newval))) +#else +# define g_atomic_int_get(atomic) \ + ((void) sizeof (gchar [sizeof (*(atomic)) == sizeof (gint) ? 1 : -1]), \ + (g_atomic_int_get) ((volatile gint G_GNUC_MAY_ALIAS *) (void *) (atomic))) +# define g_atomic_int_set(atomic, newval) \ + ((void) sizeof (gchar [sizeof (*(atomic)) == sizeof (gint) ? 1 : -1]), \ + (g_atomic_int_set) ((volatile gint G_GNUC_MAY_ALIAS *) (void *) (atomic), (newval))) +# define g_atomic_pointer_get(atomic) \ + ((void) sizeof (gchar [sizeof (*(atomic)) == sizeof (gpointer) ? 1 : -1]), \ + (g_atomic_pointer_get) ((volatile gpointer G_GNUC_MAY_ALIAS *) (void *) (atomic))) +# define g_atomic_pointer_set(atomic, newval) \ + ((void) sizeof (gchar [sizeof (*(atomic)) == sizeof (gpointer) ? 1 : -1]), \ + (g_atomic_pointer_set) ((volatile gpointer G_GNUC_MAY_ALIAS *) (void *) (atomic), (newval))) #endif /* G_ATOMIC_OP_MEMORY_BARRIER_NEEDED */ #define g_atomic_int_inc(atomic) (g_atomic_int_add ((atomic), 1)) --- glib-2.18.4-orig/glib/gdataset.c 2009-04-02 15:20:51.000000000 -0400 +++ glib-2.18.4-orig/glib/gdataset.c 2009-04-02 15:40:38.000000000 -0400 @@ -44,7 +44,7 @@ /* datalist pointer accesses have to be carried out atomically */ #define G_DATALIST_GET_POINTER(datalist) \ - ((GData*) ((gsize) g_atomic_pointer_get ((gpointer*) datalist) & ~(gsize) G_DATALIST_FLAGS_MASK)) + ((GData*) ((gsize) g_atomic_pointer_get (datalist) & ~(gsize) G_DATALIST_FLAGS_MASK)) #define G_DATALIST_SET_POINTER(datalist, pointer) G_STMT_START { \ gpointer _oldv, _newv; \ @@ -505,7 +505,7 @@ { g_return_if_fail (datalist != NULL); - g_atomic_pointer_set ((gpointer*) datalist, NULL); + g_atomic_pointer_set (datalist, NULL); } /** --- glib-2.18.4-orig/glib/gdatasetprivate.h 2009-04-02 15:20:51.000000000 -0400 +++ glib-2.18.4-orig/glib/gdatasetprivate.h 2009-04-02 15:40:44.000000000 -0400 @@ -36,7 +36,7 @@ * barriers to take effect without acquiring the global dataset mutex. */ #define G_DATALIST_GET_FLAGS(datalist) \ - ((gsize) g_atomic_pointer_get ((gpointer*) datalist) & G_DATALIST_FLAGS_MASK) + ((gsize) g_atomic_pointer_get (datalist) & G_DATALIST_FLAGS_MASK) G_END_DECLS --- glib-2.18.4-orig/glib/gthread.c 2009-04-02 15:20:51.000000000 -0400 +++ glib-2.18.4-orig/glib/gthread.c 2009-04-02 15:40:51.000000000 -0400 @@ -204,7 +204,7 @@ { gboolean need_init = FALSE; g_mutex_lock (g_once_mutex); - if (g_atomic_pointer_get ((void**) value_location) == NULL) + if (g_atomic_pointer_get (value_location) == NULL) { if (!g_slist_find (g_once_init_list, (void*) value_location)) { @@ -224,11 +224,11 @@ g_once_init_leave (volatile gsize *value_location, gsize initialization_value) { - g_return_if_fail (g_atomic_pointer_get ((void**) value_location) == NULL); + g_return_if_fail (g_atomic_pointer_get (value_location) == NULL); g_return_if_fail (initialization_value != 0); g_return_if_fail (g_once_init_list != NULL); - g_atomic_pointer_set ((void**) value_location, (void*) initialization_value); + g_atomic_pointer_set (value_location, (void*) initialization_value); g_mutex_lock (g_once_mutex); g_once_init_list = g_slist_remove (g_once_init_list, (void*) value_location); g_cond_broadcast (g_once_cond); @@ -256,7 +256,7 @@ g_mutex_lock (g_once_mutex); if (!(*mutex)) - g_atomic_pointer_set ((void**) mutex, g_mutex_new()); + g_atomic_pointer_set (mutex, g_mutex_new()); g_mutex_unlock (g_once_mutex); --- glib-2.18.4-orig/glib/gthread.h 2009-04-02 15:20:51.000000000 -0400 +++ glib-2.18.4-orig/glib/gthread.h 2009-04-02 15:40:56.000000000 -0400 @@ -145,7 +145,7 @@ GMutex* g_static_mutex_get_mutex_impl (GMutex **mutex); #define g_static_mutex_get_mutex_impl_shortcut(mutex) \ - (g_atomic_pointer_get ((gpointer*)(void*)mutex) ? *(mutex) : \ + (g_atomic_pointer_get (mutex) ? *(mutex) : \ g_static_mutex_get_mutex_impl (mutex)) /* shorthands for conditional and unconditional function calls */ @@ -336,7 +336,7 @@ G_INLINE_FUNC gboolean g_once_init_enter (volatile gsize *value_location) { - if G_LIKELY (g_atomic_pointer_get ((void*volatile*) value_location) != NULL) + if G_LIKELY ((gpointer) g_atomic_pointer_get (value_location) != NULL) return FALSE; else return g_once_init_enter_impl (value_location);