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. 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 5f7f6fbc6e659..2f8b4ba569f46 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. */ @@ -63,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) { @@ -94,13 +88,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; } @@ -123,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) { @@ -159,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()