From c663397f46152e96c548ba392858c730e132dd7a Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Mon, 17 Dec 2018 11:46:54 +0100 Subject: [PATCH] Use __GNUC_PREREQ for detecting __builtin_expect --- configure.ac | 6 ------ src/util.h | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 68c45a5..0657b71 100644 --- a/configure.ac +++ b/configure.ac @@ -153,12 +153,6 @@ AC_ARG_WITH([asm], [AS_HELP_STRING([--with-asm=x86_64|arm|no|auto] 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 AC_DEFINE(COVERAGE, 1, [Define this symbol to compile out all VERIFY code]) CFLAGS="$CFLAGS -O0 --coverage" diff --git a/src/util.h b/src/util.h index e014750..e1f5b76 100644 --- a/src/util.h +++ b/src/util.h @@ -36,7 +36,7 @@ static SECP256K1_INLINE void secp256k1_callback_call(const secp256k1_callback * } while(0) #endif -#ifdef HAVE_BUILTIN_EXPECT +#if SECP256K1_GNUC_PREREQ(3, 0) #define EXPECT(x,c) __builtin_expect((x),(c)) #else #define EXPECT(x,c) (x)