[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-1.4 1/2] trace: use glib atomic int types
From: |
Juan Quintela |
Subject: |
Re: [Qemu-devel] [PATCH for-1.4 1/2] trace: use glib atomic int types |
Date: |
Wed, 13 Feb 2013 13:25:02 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
Markus Armbruster <address@hidden> wrote:
> Stefan Hajnoczi <address@hidden> 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.
Later, Juan.