On 30 January 2013 14:05, Peter Maydell <peter.mayd...@linaro.org> wrote: > On 16 January 2013 17:31, Paolo Bonzini <pbonz...@redhat.com> 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 <pbonz...@redhat.com> > > 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