[php-src] master: Merge branch 'PHP-8.6'
| From: | Arnaud Le Blanc | Date: | Thu, 29 Oct 2026 09:27:28 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142928@lists.php.net to get a copy of this message | ||
Author: Arnaud Le Blanc (arnaud-lb)
Date: 2026-10-29T10:27:08+01:00
Commit: https://github.com/php/php-src/commit/08b3587a387e92beff1521c874b298310f20cfb0
Raw diff: https://github.com/php/php-src/commit/08b3587a387e92beff1521c874b298310f20cfb0.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
Fix GH-25023: ZEND_CONTAINER_OF() fails to compile with -std=c11 (#25027)
Changed paths:
M Zend/zend_portability.h
Diff:
diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h
index d39a7c641ce9..ab1592bfe9c9 100644
--- a/Zend/zend_portability.h
+++ b/Zend/zend_portability.h
@@ -402,6 +402,12 @@ char *alloca();
#define ZEND_ELEMENT_COUNT(m)
#endif
+#if __STDC_VERSION__ >= 202311L
+# define ZEND_TYPEOF(x) typeof(x)
+#elif ZEND_GCC_VERSION
+# define ZEND_TYPEOF(x) __typeof__(x)
+#endif
+
#if __cplusplus
extern "C++" {
# include <cstddef>
@@ -416,13 +422,12 @@ extern "C++" {
# define ZEND_CONTAINER_OF(ptr, Type, member) zend_container_of<Type,
decltype(Type::member)>(ptr, offsetof(Type, member))
}
-#elif __STDC_VERSION__ >= 202311L || ZEND_GCC_VERSION
-/* typeof is C23 or a GCC extension */
+#elif defined(ZEND_TYPEOF)
# define ZEND_CONTAINER_OF(ptr, Type, member) \
_Generic( \
(ptr), \
- const typeof(((Type*)0)->member) *: ((const Type*)((char*)(ptr) - offsetof(Type, member))), \
- typeof(((Type*)0)->member) *: ((Type*)((char*)(ptr) - offsetof(Type, member))) \
+ const ZEND_TYPEOF(((Type*)0)->member) *: ((const Type*)((char*)(ptr) - offsetof(Type,
member))), \
+ ZEND_TYPEOF(((Type*)0)->member) *: ((Type*)((char*)(ptr) - offsetof(Type, member))) \
)
#else
/* Define a variant that does not keep const-ness for older compilers. Mismatches