On Wed, Feb 13, 2013 at 01:25:02PM +0100, Juan Quintela wrote: > Markus Armbruster <[email protected]> wrote: > > Stefan Hajnoczi <[email protected]> writes: > > > >> Juan reported that RHEL 6.4 hosts give compiler warnings because we use > >> unsigned int while glib prototypes use volatile gint in trace/simple.c. > >> > >> trace/simple.c:223: error: pointer targets in passing argument 1 > >> of 'g_atomic_int_compare_and_exchange' differ in signedness > > > > Meh. Contrary to documentation and how current GLib versions behave, in > > other words a bug in need of a workaround. > > > >> These variables are only accessed with glib atomic int functions so > >> let's play it by the book and use volatile gint. > > > > gint is a silly alias for int, and used completely interchangeably, even > > within GLib APIs. Any pretentions of treating it as something more > > abstract break down at the first printf(), if not earlier. But if you > > think it helps... > > >> -static unsigned int trace_idx; > >> +static volatile gint trace_idx; > > Problem was this bit. int vs unsigned.
We only access the variable through the glib API, never directly. So in this case I don't see much benefit in using nicer types, better to conform precisely to the function declaration. Stefan
