[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 03/13] compiler.h: remove GCC < 3 __builtin_expect fallbac
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v3 03/13] compiler.h: remove GCC < 3 __builtin_expect fallback |
Date: |
Thu, 10 Dec 2020 15:32:46 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 |
On 12/10/20 2:47 PM, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Since commit efc6c07 ("configure: Add a test for the minimum compiler
> version"), QEMU explicitely depends on GCC >= 4.8.
>
> (clang >= 3.4 advertizes itself as GCC >= 4.2 compatible and supports
> __builtin_expect too)
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> include/qemu/compiler.h | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
> index c76281f354..226ead6c90 100644
> --- a/include/qemu/compiler.h
> +++ b/include/qemu/compiler.h
> @@ -44,10 +44,6 @@
> #endif
>
> #ifndef likely
> -#if __GNUC__ < 3
> -#define __builtin_expect(x, n) (x)
> -#endif
> -
> #define likely(x) __builtin_expect(!!(x), 1)
> #define unlikely(x) __builtin_expect(!!(x), 0)
> #endif
>
Trying with GCC 10:
warning: implicit declaration of function ‘likely’
[-Wimplicit-function-declaration]
Clang 10:
warning: implicit declaration of function 'likely' is invalid in C99
[-Wimplicit-function-declaration]
Shouldn't it becleaner to test in the configure script or Meson that
likely() and unlikely() are not defined, and define them here
unconditionally?
Regards,
Phil.
- [PATCH v3 00/13] Remove GCC < 4.8 checks, marcandre . lureau, 2020/12/10
- [PATCH v3 04/13] qemu-plugin.h: remove GCC < 4, marcandre . lureau, 2020/12/10
- [PATCH v3 05/13] tests: remove GCC < 4 fallbacks, marcandre . lureau, 2020/12/10
- [PATCH v3 06/13] virtiofsd: replace _Static_assert with QEMU_BUILD_BUG_ON, marcandre . lureau, 2020/12/10
- [PATCH v3 07/13] compiler.h: explicit case for Clang printf attribute, marcandre . lureau, 2020/12/10