File tree Expand file tree Collapse file tree 3 files changed +25
-7
lines changed Expand file tree Collapse file tree 3 files changed +25
-7
lines changed Original file line number Diff line number Diff line change 9292#elif defined(__clang__) && __has_builtin(__builtin_assume)
9393# pragma clang diagnostic ignored "-Wassume"
9494# define ZEND_ASSUME (c ) __builtin_assume(c)
95- #elif ((defined(__GNUC__) && ZEND_GCC_VERSION >= 4005) || __has_builtin(__builtin_unreachable)) && PHP_HAVE_BUILTIN_EXPECT
95+ #elif PHP_HAVE_BUILTIN_UNREACHABLE && PHP_HAVE_BUILTIN_EXPECT
9696# define ZEND_ASSUME (c ) do { \
9797 if (__builtin_expect (!(c), 0 )) __builtin_unreachable (); \
9898 } while (0 )
106106# define ZEND_ASSERT (c ) ZEND_ASSUME(c)
107107#endif
108108
109- #ifdef __has_builtin
110- # if __has_builtin(__builtin_unreachable)
111- # define _ZEND_UNREACHABLE () __builtin_unreachable()
112- # endif
113- #endif
114- #ifndef _ZEND_UNREACHABLE
109+ #ifdef PHP_HAVE_BUILTIN_UNREACHABLE
110+ # define _ZEND_UNREACHABLE () __builtin_unreachable()
111+ #else
115112# define _ZEND_UNREACHABLE () ZEND_ASSUME(0 )
116113#endif
117114
Original file line number Diff line number Diff line change @@ -2464,6 +2464,25 @@ AC_DEFUN([PHP_CHECK_BUILTIN_EXPECT], [
24642464 AC_DEFINE_UNQUOTED ( [ PHP_HAVE_BUILTIN_EXPECT] , [ $have_builtin_expect] , [ Whether the compiler supports __builtin_expect] )
24652465] )
24662466
2467+ dnl
2468+ dnl PHP_CHECK_BUILTIN_UNREACHABLE
2469+ dnl
2470+ AC_DEFUN ( [ PHP_CHECK_BUILTIN_UNREACHABLE] , [
2471+ AC_MSG_CHECKING ( [ for __builtin_unreachable] )
2472+
2473+ AC_LINK_IFELSE ( [ AC_LANG_PROGRAM ( [ ] , [ [
2474+ __builtin_unreachable();
2475+ ] ] ) ] , [
2476+ have_builtin_unreachable=1
2477+ AC_MSG_RESULT ( [ yes] )
2478+ ] , [
2479+ have_builtin_unreachable=0
2480+ AC_MSG_RESULT ( [ no] )
2481+ ] )
2482+
2483+ AC_DEFINE_UNQUOTED ( [ PHP_HAVE_BUILTIN_UNREACHABLE] , [ $have_builtin_unreachable] , [ Whether the compiler supports __builtin_unreachable] )
2484+ ] )
2485+
24672486dnl
24682487dnl PHP_CHECK_BUILTIN_CLZ
24692488dnl
Original file line number Diff line number Diff line change @@ -494,6 +494,8 @@ PHP_CHECK_STDINT_TYPES
494494
495495dnl Check __builtin_expect
496496PHP_CHECK_BUILTIN_EXPECT
497+ dnl Check __builtin_unreachable
498+ PHP_CHECK_BUILTIN_UNREACHABLE
497499dnl Check __builtin_clz
498500PHP_CHECK_BUILTIN_CLZ
499501dnl Check __builtin_clzl
You can’t perform that action at this time.
0 commit comments