From c939835f77f9785e96380949c13b290abac7e4c2 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 8 Oct 2017 22:26:03 +0200 Subject: [PATCH] MINOR: compiler: restore the likely() wrapper for gcc 5.x After some tests, gcc 5.x produces better code with likely() than without, contrary to gcc 4.x where it was better to disable it. Let's re-enable it for 5 and above. --- include/common/compiler.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/common/compiler.h b/include/common/compiler.h index 001b89301..ee7744c9f 100644 --- a/include/common/compiler.h +++ b/include/common/compiler.h @@ -89,8 +89,8 @@ #define __builtin_expect(x,y) (x) #define likely(x) (x) #define unlikely(x) (x) -#elif __GNUC__ < 4 -/* gcc 3.x does the best job at this */ +#elif __GNUC__ < 4 || __GNUC__ >= 5 +/* gcc 3.x and 5.x do the best job at this */ #define likely(x) (__builtin_expect((x) != 0, 1)) #define unlikely(x) (__builtin_expect((x) != 0, 0)) #else