Skip to content

Commit 496fdb5

Browse files
committed
prefer C std alignof over gcc- and clang extension
1 parent 778bdd5 commit 496fdb5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ext/opcache/zend_shared_alloc.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,11 @@ typedef union _align_test {
166166
zend_long lng;
167167
} align_test;
168168

169-
#if ZEND_GCC_VERSION >= 2000 || defined(__clang__)
169+
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
170+
# define PLATFORM_ALIGNMENT (alignof(align_test) < 8 ? 8 : alignof(align_test))
171+
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
172+
# define PLATFORM_ALIGNMENT (_Alignof(align_test) < 8 ? 8 : _Alignof(align_test))
173+
#elif ZEND_GCC_VERSION >= 2000 || defined(__clang__)
170174
# define PLATFORM_ALIGNMENT (__alignof__(align_test) < 8 ? 8 : __alignof__(align_test))
171175
#else
172176
# define PLATFORM_ALIGNMENT (sizeof(align_test))

0 commit comments

Comments
 (0)