qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 01/12] host-utils: add ffsl


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2 01/12] host-utils: add ffsl
Date: Wed, 30 Jan 2013 15:03:08 +0000

On 30 January 2013 14:05, Peter Maydell <address@hidden> wrote:
> On 16 January 2013 17:31, Paolo Bonzini <address@hidden> wrote:
>> We can provide fast versions based on the other functions defined
>> by host-utils.h.  Some care is required on glibc, which provides
>> ffsl already.
>>
>> Signed-off-by: Paolo Bonzini <address@hidden>
>
> Hi. This patch breaks compile on MacOS (and likely other BSDs):
>
>   CC    qga/commands-posix.o
> In file included from qga/commands-posix.c:22:
> /Users/pm215/src/qemu/include/qemu/host-utils.h:248: error: static
> declaration of ‘ffsl’ follows non-static declaration
>
> (because BSD strings.h provides a system ffsl()).
>
>> +/* glibc does not provide an inline version of ffsl, so always define
>> + * ours.  We need to give it a different name, however.
>> + */
>> +#ifdef __GLIBC__
>> +#define ffsl qemu_ffsl
>> +#endif
>
> Overriding a system function like this seems a bit brittle --
> can't we either (a) always use the system version or (b)
> always use a QEMU implementation?
>
> Failing that, you probably need a configure test to check for
> system ffsl().

Also, we already have a roll-your-own ffsl, it's bitops_ffsl()
in bitops.h. Can we improve and use that implementation instead
of having a second one?

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]