[klibc] [patch] compiler.h fix use of likely/unlikely
H. Peter Anvin
hpa at zytor.com
Tue Jun 20 14:38:56 PDT 2006
maximilian attems wrote:
> patch from Hannes Reinecke <hare at suse.de> reduces noise
> on s390 build logs.
> while we are it remove check for early 2.X gcc versions.
>
> Signed-off-by: maximilian attems <maks at sternwelten.at>
>
> diff --git a/usr/include/klibc/compiler.h b/usr/include/klibc/compiler.h
> index 893f8a9..b7d9b50 100644
> --- a/usr/include/klibc/compiler.h
> +++ b/usr/include/klibc/compiler.h
> @@ -91,12 +91,12 @@ # define __mallocfunc
> #endif
>
> /* likely/unlikely */
> -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
> -# define __likely(x) __builtin_expect((x), 1)
> -# define __unlikely(x) __builtin_expect((x), 0)
> +#if defined(__GNUC__)
> +# define likely(x) __builtin_expect((x), 1)
> +# define unlikely(x) __builtin_expect((x), 0)
> #else
> -# define __likely(x) (x)
> -# define __unlikely(x) (x)
> +# define likely(x) (x)
> +# define unlikely(x) (x)
> #endif
>
NAK. This patch is wrong. likely() and unlikely() don't belong in userspace without the
underscores, for namespace reasons.
-hpa
More information about the klibc
mailing list