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 92
92
#elif defined(__clang__) && __has_builtin(__builtin_assume)
93
93
# pragma clang diagnostic ignored "-Wassume"
94
94
# 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
96
96
# define ZEND_ASSUME (c ) do { \
97
97
if (__builtin_expect (!(c), 0 )) __builtin_unreachable (); \
98
98
} while (0 )
106
106
# define ZEND_ASSERT (c ) ZEND_ASSUME(c)
107
107
#endif
108
108
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
115
112
# define _ZEND_UNREACHABLE () ZEND_ASSUME(0 )
116
113
#endif
117
114
Original file line number Diff line number Diff line change @@ -2464,6 +2464,25 @@ AC_DEFUN([PHP_CHECK_BUILTIN_EXPECT], [
2464
2464
AC_DEFINE_UNQUOTED ( [ PHP_HAVE_BUILTIN_EXPECT] , [ $have_builtin_expect] , [ Whether the compiler supports __builtin_expect] )
2465
2465
] )
2466
2466
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
+
2467
2486
dnl
2468
2487
dnl PHP_CHECK_BUILTIN_CLZ
2469
2488
dnl
Original file line number Diff line number Diff line change @@ -494,6 +494,8 @@ PHP_CHECK_STDINT_TYPES
494
494
495
495
dnl Check __builtin_expect
496
496
PHP_CHECK_BUILTIN_EXPECT
497
+ dnl Check __builtin_unreachable
498
+ PHP_CHECK_BUILTIN_UNREACHABLE
497
499
dnl Check __builtin_clz
498
500
PHP_CHECK_BUILTIN_CLZ
499
501
dnl Check __builtin_clzl
You can’t perform that action at this time.
0 commit comments