[Mesa-dev] [PATCH] gallium/util: Define ffsll on OpenBSD.
Jose Fonseca
jfonseca at vmware.com
Mon Feb 9 11:22:35 PST 2015
On 09/02/15 16:59, Jon TURNEY wrote:
> On 06/02/2015 19:58, Matt Turner wrote:
>> On Fri, Feb 6, 2015 at 3:38 AM, Jonathan Gray <jsg at jsg.id.au> wrote:
>>> OpenBSD has ffs in libc but does not have ffsll so use the compiler
>>> builtin. PIPE_OS_BSD isn't suitable here as FreeBSD has ffsll in libc.
>>>
>>> Signed-off-by: Jonathan Gray <jsg at jsg.id.au>
>>> ---
>>> src/gallium/auxiliary/util/u_math.h | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/src/gallium/auxiliary/util/u_math.h
>>> b/src/gallium/auxiliary/util/u_math.h
>>> index 5db5b66..ec282f3 100644
>>> --- a/src/gallium/auxiliary/util/u_math.h
>>> +++ b/src/gallium/auxiliary/util/u_math.h
>>> @@ -531,6 +531,8 @@ unsigned ffs( unsigned u )
>>> #elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID)
>>> #define ffs __builtin_ffs
>>> #define ffsll __builtin_ffsll
>>> +#elif defined(__OpenBSD__)
>>> +#define ffsll __builtin_ffsll
>>> #endif
>>
>> Autoconf checks for presence of a bunch of builtins. Please use those
>> instead (in this case, HAVE___BUILTIN_FFSLL).
>
> Yes, please.
>
> This has just been 'fixed' for MinGW, now for OpenBSD, and also needs
> fixing for Cygwin.
>
> Attached is a patch which attempts to do this using autoconf checks.
The issue is that this will break scons builds unless these checks are
replicated there. And SCons implementation of configure checks are not
great to be honest -- they either are cached (but in such way were
multiple builds from same source tree pick up wrong values) or they need
to be re-checked on every build (wasting time for incremental builds).
This is why, within reason, I personally like to avoid configure checks
when practical.
So for now I'd prefer to leave MinGW 'fixed' as you put it.
But fell free to fix the other platforms as you propose.
BTW, isn't there any standard include that defines ffsll as macro or
inline on top of __builtin_ffsll for systems that support it?
Jose
More information about the mesa-dev
mailing list