Use __GNUC_PREREQ for detecting __builtin_expect

This commit is contained in:
Tim Ruffing 2018-12-17 11:46:54 +01:00
parent e34ceb333b
commit c663397f46
2 changed files with 1 additions and 7 deletions

View File

@ -153,12 +153,6 @@ AC_ARG_WITH([asm], [AS_HELP_STRING([--with-asm=x86_64|arm|no|auto]
AC_CHECK_TYPES([__int128]) AC_CHECK_TYPES([__int128])
AC_MSG_CHECKING([for __builtin_expect])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[void myfunc() {__builtin_expect(0,0);}]])],
[ AC_MSG_RESULT([yes]);AC_DEFINE(HAVE_BUILTIN_EXPECT,1,[Define this symbol if __builtin_expect is available]) ],
[ AC_MSG_RESULT([no])
])
if test x"$enable_coverage" = x"yes"; then if test x"$enable_coverage" = x"yes"; then
AC_DEFINE(COVERAGE, 1, [Define this symbol to compile out all VERIFY code]) AC_DEFINE(COVERAGE, 1, [Define this symbol to compile out all VERIFY code])
CFLAGS="$CFLAGS -O0 --coverage" CFLAGS="$CFLAGS -O0 --coverage"

View File

@ -36,7 +36,7 @@ static SECP256K1_INLINE void secp256k1_callback_call(const secp256k1_callback *
} while(0) } while(0)
#endif #endif
#ifdef HAVE_BUILTIN_EXPECT #if SECP256K1_GNUC_PREREQ(3, 0)
#define EXPECT(x,c) __builtin_expect((x),(c)) #define EXPECT(x,c) __builtin_expect((x),(c))
#else #else
#define EXPECT(x,c) (x) #define EXPECT(x,c) (x)