[klibc] [patch] bitops.h don't use likely/unlikely outside __KERNEL__

H. Peter Anvin hpa at zytor.com
Tue Jun 20 15:27:08 PDT 2006


maximilian attems wrote:
> On Tue, Jun 20, 2006 at 02:38:56PM -0700, H. Peter Anvin wrote:
>> NAK.  This patch is wrong.  likely() and unlikely() don't belong in 
>> userspace without the underscores, for namespace reasons.
>>
>> 	-hpa
> 
> ok patch was motivated due to the abundance of klibc warnings of s390 build:
> In file included from linux/include/asm/posix_types.h:82,
>                  from linux/include/linux/posix_types.h:47,
>                  from usr/klibc/../include/sys/types.h:15,
>                  from usr/klibc/../include/signal.h:12,
>                  from usr/klibc/socketcalls/socketcommon.h:9,
>                  from usr/klibc/socketcalls/getpeername.c:1:
> linux/include/asm/bitops.h: In function 'ffz':
> linux/include/asm/bitops.h:544: warning: implicit declaration of function 'likely'
> 
> belows patchs fixes s390 ffz() and ffs() to not use likely.
> 

More fundamentally busted seems to be that this function gets included at all from a 
userspace build.  This chain seems to be <sys/types.h> -> <linux/posix_types.h> -> -> 
<asm/posix_types.h> -> <asm/bitops.h>.

This appears to come from the definitions of __FD_*() in <asm/posix_types.h>; it would 
probably be cleaner to just open-code those, since they don't need stuff like ffs/ffz.

	-hpa



More information about the klibc mailing list