diff mbox series

[v2,04/13] compiler.h: remove GCC < 3 __builtin_expect fallback

Message ID 20201126112915.525285-5-marcandre.lureau@redhat.com
State New
Headers show
Series Remove GCC < 4.8 checks | expand

Commit Message

Marc-André Lureau Nov. 26, 2020, 11:29 a.m. UTC
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.8 advertizes itself as GCC >= 4.2 compatible)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/qemu/compiler.h | 4 ----
 1 file changed, 4 deletions(-)

Comments

Peter Maydell Nov. 26, 2020, 11:55 a.m. UTC | #1
On Thu, 26 Nov 2020 at 11:29, <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.8 advertizes itself as GCC >= 4.2 compatible)

All clangs always have advertised themselves as gcc-4.2-compatible,
as far as I'm aware. 3.4 is the version we need to care about,
I think it probably supported __builtin_expect(). (A test
of the whole series with gcc 4.8 and clang 3.4 would confirm this.)

thnaks
-- PMM
Marc-André Lureau Dec. 10, 2020, 1:35 p.m. UTC | #2
Hi

On Thu, Nov 26, 2020 at 3:57 PM Peter Maydell <peter.maydell@linaro.org>
wrote:

> On Thu, 26 Nov 2020 at 11:29, <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.8 advertizes itself as GCC >= 4.2 compatible)
>
> All clangs always have advertised themselves as gcc-4.2-compatible,
> as far as I'm aware. 3.4 is the version we need to care about,
> I think it probably supported __builtin_expect(). (A test
> of the whole series with gcc 4.8 and clang 3.4 would confirm this.)
>

clang 3.4 also advertizes as gcc-4.2, thus we can safely remove that
__builtin_expect() fallback (if it didn't have it, it would have failed for
a long while)

I also checked the __builtin_expect() support with clang-3.4.2-9.el7.x86_64
from EPEL7 successfully.
diff mbox series

Patch

diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index cf044bab4a..ae3e0df34c 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -35,10 +35,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