From 964a40445131d3764b6eb235262d020e04d62098 Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Wed, 9 Jul 2025 11:27:25 -0300 Subject: [PATCH] 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 --- Zend/zend_portability.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index 7a41a496a0e..1b28f21c39a 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -109,7 +109,10 @@ # define ZEND_ASSERT(c) ZEND_ASSUME(c) #endif -#ifdef PHP_HAVE_BUILTIN_UNREACHABLE +/* use C23 unreachable() from if possible */ +#ifdef unreachable +# define _ZEND_UNREACHABLE() unreachable() +#elif defined(PHP_HAVE_BUILTIN_UNREACHABLE) # define _ZEND_UNREACHABLE() __builtin_unreachable() #else # define _ZEND_UNREACHABLE() ZEND_ASSUME(0)