From 0241b3bbaf67c94f24a7d53c7dd5a737be942788 Mon Sep 17 00:00:00 2001 From: twosee Date: Mon, 13 Jun 2022 15:16:37 +0800 Subject: [PATCH 1/4] Remove ZEND_GCC_PREREQ() We already have ZEND_GCC_VERSION to do such check. --- Zend/zend_atomic.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Zend/zend_atomic.h b/Zend/zend_atomic.h index 5f7f6fbc6e659..3d94944ff7e6c 100644 --- a/Zend/zend_atomic.h +++ b/Zend/zend_atomic.h @@ -19,13 +19,10 @@ #include -#define ZEND_GCC_PREREQ(x, y) \ - ((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || (__GNUC__ > (x))) - /* Builtins are used to avoid library linkage */ #if __has_feature(c_atomic) #define HAVE_C11_ATOMICS 1 -#elif ZEND_GCC_PREREQ(4, 7) +#elif ZEND_GCC_VERSION >= 4007 #define HAVE_GNUC_ATOMICS 1 #elif defined(__GNUC__) #define HAVE_SYNC_ATOMICS 1 @@ -33,8 +30,6 @@ #define HAVE_NO_ATOMICS 1 #endif -#undef ZEND_GCC_PREREQ - /* Treat zend_atomic_* types as opaque. They have definitions only for size * and alignment purposes. */ From 2b8ba999c7b7a57302eb286ea90c9a9c3c09df42 Mon Sep 17 00:00:00 2001 From: twosee Date: Mon, 13 Jun 2022 15:18:32 +0800 Subject: [PATCH 2/4] Prev does not need to be initialized __atomic_load() returns the contents of *ptr in *ret. --- Zend/zend_atomic.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zend/zend_atomic.h b/Zend/zend_atomic.h index 3d94944ff7e6c..807ee3406598c 100644 --- a/Zend/zend_atomic.h +++ b/Zend/zend_atomic.h @@ -89,13 +89,13 @@ static zend_always_inline void zend_atomic_bool_store_ex(zend_atomic_bool *obj, #define ZEND_ATOMIC_BOOL_INIT(obj, desired) ((obj)->value = (desired)) static zend_always_inline bool zend_atomic_bool_exchange_ex(zend_atomic_bool *obj, bool desired) { - bool prev = false; + bool prev; __atomic_exchange(&obj->value, &desired, &prev, __ATOMIC_SEQ_CST); return prev; } static zend_always_inline bool zend_atomic_bool_load_ex(const zend_atomic_bool *obj) { - bool prev = false; + bool prev; __atomic_load(&obj->value, &prev, __ATOMIC_SEQ_CST); return prev; } From 3c8da571c0e97f72458a599991d5e55e5a23ae7b Mon Sep 17 00:00:00 2001 From: twosee Date: Mon, 13 Jun 2022 15:24:44 +0800 Subject: [PATCH 3/4] Make zend_atomic_bool_load() function signature static --- Zend/zend_atomic.c | 7 ------- Zend/zend_atomic.h | 15 ++++----------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/Zend/zend_atomic.c b/Zend/zend_atomic.c index 7b16f5e485138..dca8effb92d8b 100644 --- a/Zend/zend_atomic.c +++ b/Zend/zend_atomic.c @@ -35,13 +35,6 @@ ZEND_API void zend_atomic_bool_store(zend_atomic_bool *obj, bool desired) { zend_atomic_bool_store_ex(obj, desired); } -#if ZEND_WIN32 || HAVE_SYNC_ATOMICS -/* On these platforms it is non-const due to underlying APIs. */ -ZEND_API bool zend_atomic_bool_load(zend_atomic_bool *obj) { - return zend_atomic_bool_load_ex(obj); -} -#else ZEND_API bool zend_atomic_bool_load(const zend_atomic_bool *obj) { return zend_atomic_bool_load_ex(obj); } -#endif diff --git a/Zend/zend_atomic.h b/Zend/zend_atomic.h index 807ee3406598c..2f8b4ba569f46 100644 --- a/Zend/zend_atomic.h +++ b/Zend/zend_atomic.h @@ -58,10 +58,9 @@ static zend_always_inline bool zend_atomic_bool_exchange_ex(zend_atomic_bool *ob return InterlockedExchange8(&obj->value, desired); } -/* On this platform it is non-const due to Iterlocked API*/ -static zend_always_inline bool zend_atomic_bool_load_ex(zend_atomic_bool *obj) { +static zend_always_inline bool zend_atomic_bool_load_ex(const zend_atomic_bool *obj) { /* Or'ing with false won't change the value. */ - return InterlockedOr8(&obj->value, false); + return InterlockedOr8(&((zend_atomic_bool *) obj)->value, false); } static zend_always_inline void zend_atomic_bool_store_ex(zend_atomic_bool *obj, bool desired) { @@ -118,9 +117,9 @@ static zend_always_inline bool zend_atomic_bool_exchange_ex(zend_atomic_bool *ob return prev; } -static zend_always_inline bool zend_atomic_bool_load_ex(zend_atomic_bool *obj) { +static zend_always_inline bool zend_atomic_bool_load_ex(const zend_atomic_bool *obj) { /* Or'ing false won't change the value */ - return __sync_fetch_and_or(&obj->value, false); + return __sync_fetch_and_or(&((zend_atomic_bool *) obj)->value, false); } static zend_always_inline void zend_atomic_bool_store_ex(zend_atomic_bool *obj, bool desired) { @@ -154,13 +153,7 @@ static zend_always_inline bool zend_atomic_bool_exchange_ex(zend_atomic_bool *ob ZEND_API void zend_atomic_bool_init(zend_atomic_bool *obj, bool desired); ZEND_API bool zend_atomic_bool_exchange(zend_atomic_bool *obj, bool desired); ZEND_API void zend_atomic_bool_store(zend_atomic_bool *obj, bool desired); - -#if ZEND_WIN32 || HAVE_SYNC_ATOMICS -/* On these platforms it is non-const due to underlying APIs. */ -ZEND_API bool zend_atomic_bool_load(zend_atomic_bool *obj); -#else ZEND_API bool zend_atomic_bool_load(const zend_atomic_bool *obj); -#endif END_EXTERN_C() From 878b8168571dbc8c13c64d7aadcaa3958b9a2e5d Mon Sep 17 00:00:00 2001 From: twosee Date: Thu, 30 Jun 2022 12:09:44 +0800 Subject: [PATCH 4/4] Drop support of clang 7 and older --- UPGRADING | 3 +++ 1 file changed, 3 insertions(+) diff --git a/UPGRADING b/UPGRADING index b330c28e42630..47f614437c29e 100644 --- a/UPGRADING +++ b/UPGRADING @@ -19,6 +19,9 @@ PHP 8.2 UPGRADE NOTES 1. Backward Incompatible Changes ======================================== +- Core: + . Drop support of clang 7 and older. + - Date: . DateTime::createFromImmutable() now has a tentative return type of static, previously it was DateTime.