Re: com php-src: Move check for __builtin_expect to configure: Zend/zend_portability.h acinclude.m4 configure.in

From: Date: Mon, 23 Mar 2015 09:55:06 +0000
Subject: Re: com php-src: Move check for __builtin_expect to configure: Zend/zend_portability.h acinclude.m4 configure.in
References: 1 2  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-85819@lists.php.net to get a copy of this message
I was trying to get verification that platforms that do not support the builtin failed properly first, which would have caught this. On Mar 23, 2015 3:12 AM, "Dmitry Stogov" <dmitry@zend.com> wrote: > Hi guys, > > could you please check patches before committing. > I fixed the introduced bug with > > http://git.php.net/?p=php-src.git;a=commitdiff;h=f596c953e449d97d1c1d21011ef8d391e1e1ff48 > Before it we had "#define PHP_HAVE_BUILTIN_EXPECT $have_builtin_expect" in > php_config.h > > Thanks. Dmitry. > > On Sun, Mar 22, 2015 at 7:31 PM, Stanislav Malyshev <stas@php.net> wrote: > >> Commit: 017f89e871a8411765b82cecd09c355377f3a8df >> Author: Levi Morrison <levim@php.net> Fri, 20 Mar 2015 >> 11:58:58 -0600 >> Parents: a50e9d87f265f911f9c76ca0e998588be0bd6eac >> Branches: master >> >> Link: >> >> http://git.php.net/?p=php-src.git;a=commitdiff;h=017f89e871a8411765b82cecd09c355377f3a8dfpN¤j‰ >> œ×y„ºŠ•T >> >> Log: >> Move check for __builtin_expect to configure >> >> This allows __builtin_expect to be used more accurately >> >> Changed paths: >> M Zend/zend_portability.h >> M acinclude.m4 >> M configure.in >> >> >> Diff: >> diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h >> index 5c8a21e..0743141 100644 >> --- a/Zend/zend_portability.h >> +++ b/Zend/zend_portability.h >> @@ -257,9 +257,9 @@ char *alloca(); >> # endif >> #endif /* ZEND_DEBUG */ >> >> -#if (defined (__GNUC__) && __GNUC__ > 2 ) && !defined(DARWIN) >> && >> !defined(__hpux) && !defined(_AIX) >> -# define EXPECTED(condition) __builtin_expect(!(!(condition)), 1) >> -# define UNEXPECTED(condition) __builtin_expect(!(!(condition)), 0) >> +#if PHP_HAVE_BUILTIN_EXPECT >> +# define EXPECTED(condition) __builtin_expect(!!(condition), 1) >> +# define UNEXPECTED(condition) __builtin_expect(!!(condition), 0) >> #else >> # define EXPECTED(condition) (condition) >> # define UNEXPECTED(condition) (condition) >> diff --git a/acinclude.m4 b/acinclude.m4 >> index b2220c3..478ea31 100644 >> --- a/acinclude.m4 >> +++ b/acinclude.m4 >> @@ -3031,3 +3031,21 @@ AC_DEFUN([PHP_CHECK_STDINT_TYPES], [ >> ]) >> AC_DEFINE([PHP_HAVE_STDINT_TYPES], [1], [Checked for stdint types]) >> ]) >> + >> +dnl PHP_CHECK_BUILTIN_EXPECT >> +AC_DEFUN([PHP_CHECK_BUILTIN_EXPECT], [ >> + AC_MSG_CHECKING([for __builtin_expect]) >> + >> + AC_TRY_LINK(, [ >> + return __builtin_expect(1,1) ? 1 : 0; >> + ], [ >> + have_builtin_expect=1 >> + AC_MSG_RESULT([yes]) >> + ], [ >> + have_builtin_expect=0 >> + AC_MSG_RESULT([no]) >> + ]) >> + >> + AC_DEFINE([PHP_HAVE_BUILTIN_EXPECT], [$have_builtin_expect], [Whether >> the compiler supports __builtin_expect]) >> + >> +]) >> diff --git a/configure.in b/configure.in >> index 06db0a7..8f9844d 100644 >> --- a/configure.in >> +++ b/configure.in >> @@ -575,6 +575,9 @@ PHP_CHECK_SIZEOF(ptrdiff_t, 8) >> dnl Check stdint types (must be after header check) >> PHP_CHECK_STDINT_TYPES >> >> +dnl Check __builtin_expect >> +PHP_CHECK_BUILTIN_EXPECT >> + >> dnl Check for members of the stat structure >> AC_STRUCT_ST_BLKSIZE >> dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not >> exists >> >> >> -- >> PHP CVS Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >

« previous php.cvs (#85819) next »