mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Use C23 unreachable() when possible (#19077)
This is a macro defined in stddef, which is already included in this header. Since this is a macro, we can just check for the define rather than add any additional build system checks. Fixes GH-18975
This commit is contained in:
parent
b43a7ac0e7
commit
964a404451
1 changed files with 4 additions and 1 deletions
|
@ -109,7 +109,10 @@
|
||||||
# define ZEND_ASSERT(c) ZEND_ASSUME(c)
|
# define ZEND_ASSERT(c) ZEND_ASSUME(c)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PHP_HAVE_BUILTIN_UNREACHABLE
|
/* use C23 unreachable() from <stddef.h> if possible */
|
||||||
|
#ifdef unreachable
|
||||||
|
# define _ZEND_UNREACHABLE() unreachable()
|
||||||
|
#elif defined(PHP_HAVE_BUILTIN_UNREACHABLE)
|
||||||
# define _ZEND_UNREACHABLE() __builtin_unreachable()
|
# define _ZEND_UNREACHABLE() __builtin_unreachable()
|
||||||
#else
|
#else
|
||||||
# define _ZEND_UNREACHABLE() ZEND_ASSUME(0)
|
# define _ZEND_UNREACHABLE() ZEND_ASSUME(0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue