Skip to content

Commit 87d981b

Browse files
committed
Zend/zend_variables: add _Static_assert on the size zend_rc_dtor_func
_Static_assert is C11, but has been supported since GCC 4.6.
1 parent 5b152ef commit 87d981b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Zend/zend_variables.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ static const zend_rc_dtor_func_t zend_rc_dtor_func[] = {
5151
[IS_CONSTANT_AST] = (zend_rc_dtor_func_t)zend_ast_ref_destroy
5252
};
5353

54+
#if ZEND_GCC_VERSION >= 4006 || defined(__clang__)
55+
_Static_assert(sizeof(zend_rc_dtor_func) / sizeof(zend_rc_dtor_func[0]) == _IS_REGULAR_END,
56+
"zend_rc_dtor_func has the wrong size");
57+
#endif
58+
5459
ZEND_API void ZEND_FASTCALL rc_dtor_func(zend_refcounted *p)
5560
{
5661
ZEND_ASSERT(GC_TYPE(p) <= IS_CONSTANT_AST);

0 commit comments

Comments
 (0)