/* 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;
}
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"
}
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)
{
* 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)
{
# 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)
{
}
# 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)
{
})
# 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)
{
}
# 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)
{
/* 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;
}
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"
}
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)
{
}
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)
{
/* 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;
/* 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;
}
# 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;
}
void
-g_atomic_int_add (volatile gint *atomic,
+g_atomic_int_add (volatile gint G_GNUC_MAY_ALIAS *atomic,
gint val)
{
gint result;
# 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)
{
}
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)
{
}
# 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)
{
}
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)
{
/* 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);
}
void
-g_atomic_int_add (volatile gint *atomic,
+g_atomic_int_add (volatile gint G_GNUC_MAY_ALIAS *atomic,
gint val)
{
__sync_fetch_and_add (atomic, val);
}
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)
{
}
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)
{
# 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)
{
}
# 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)
{
}
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;
}
void
-g_atomic_int_add (volatile gint *atomic,
+g_atomic_int_add (volatile gint G_GNUC_MAY_ALIAS *atomic,
gint val)
{
atomic_spin_lock();
}
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)
{
}
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)
{
#define CRIS_ATOMIC_BREAKS_CACHELINE(atomic) \
(((gulong)(atomic) & (CRIS_CACHELINE_SIZE - 1)) > (CRIS_CACHELINE_SIZE - sizeof (atomic)))
-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);
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)
{
}
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)
{
}
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;
}
void
-g_atomic_int_add (volatile gint *atomic,
+g_atomic_int_add (volatile gint G_GNUC_MAY_ALIAS *atomic,
gint val)
{
gint result;
# 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)
{
}
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)
{
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;
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);
}
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)
{
}
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)
{
#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;
}
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);
}
gpointer
-g_atomic_pointer_get (volatile gpointer *atomic)
+(g_atomic_pointer_get) (volatile gpointer G_GNUC_MAY_ALIAS *atomic)
{
gpointer result;
}
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);
#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;
}
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;
#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)
{
}
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;
}
void
-g_atomic_int_add (volatile gint *atomic,
+g_atomic_int_add (volatile gint G_GNUC_MAY_ALIAS *atomic,
gint val)
{
gint result;
#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);
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))