From d8599a3562ca15dee614eb4018a405ba1a790aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 1 Jul 2026 21:19:01 +0200 Subject: [PATCH] zend_portability: Consistently allow using `ZEND_ASSUME()` as an expression Specifically this is intended to be used as the first part of a comma expression in function-like macros that cannot be proper functions (due to needing to work with generic types). --- Zend/zend_portability.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index ccad24682fdb..73c0e07a28c9 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -98,9 +98,7 @@ # pragma clang diagnostic ignored "-Wassume" # define ZEND_ASSUME(c) __builtin_assume(c) #elif defined(PHP_HAVE_BUILTIN_UNREACHABLE) && defined(PHP_HAVE_BUILTIN_EXPECT) -# define ZEND_ASSUME(c) do { \ - if (__builtin_expect(!(c), 0)) __builtin_unreachable(); \ - } while (0) +# define ZEND_ASSUME(c) ((void)(__builtin_expect(!(c), 0) ? __builtin_unreachable() : (void)false)) #else # define ZEND_ASSUME(c) #endif