1
0
Fork 0

Move 'likely' macros to the compiler support header

This makes it easier to move away from autoconfig in the future.

Also, use '!!' C trick to prevent accidental incorrect usage of
these macros.
This commit is contained in:
Patryk Obara 2019-12-29 09:59:56 +01:00 committed by Patryk Obara
parent cac7ba136c
commit ff2968df3f
4 changed files with 43 additions and 11 deletions

View file

@ -335,17 +335,8 @@ AH_BOTTOM([#if C_ATTRIBUTE_FASTCALL
#define DB_FASTCALL
#endif])
AH_BOTTOM([#if C_HAS_ATTRIBUTE
#define GCC_ATTRIBUTE(x) __attribute__ ((x))
#else
#define GCC_ATTRIBUTE(x) /* attribute not supported */
#endif])
AH_BOTTOM([#if C_HAS_BUILTIN_EXPECT
#define GCC_UNLIKELY(x) __builtin_expect((x),0)
#define GCC_LIKELY(x) __builtin_expect((x),1)
#else
#define GCC_UNLIKELY(x) (x)
#define GCC_LIKELY(x) (x)
#endif])