diff --git a/Zend/zend_cpuinfo.h b/Zend/zend_cpuinfo.h index 2290a702475d..513dacfd08f5 100644 --- a/Zend/zend_cpuinfo.h +++ b/Zend/zend_cpuinfo.h @@ -271,8 +271,8 @@ static zend_always_inline int zend_cpu_supports_avx512_vbmi(void) { } #endif -/* __builtin_cpu_supports has pclmul from gcc9 */ -#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && (!defined(__GNUC__) || (ZEND_GCC_VERSION >= 9000)) +/* __builtin_cpu_supports has pclmul from gcc9 and clang 19 */ +#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && (!defined(__GNUC__) || (defined(__clang__) && __clang_major__ >= 19) || (ZEND_GCC_VERSION >= 9000)) ZEND_NO_SANITIZE_ADDRESS static inline int zend_cpu_supports_pclmul(void) { #ifdef PHP_HAVE_BUILTIN_CPU_INIT @@ -286,8 +286,9 @@ static inline int zend_cpu_supports_pclmul(void) { } #endif -/* __builtin_cpu_supports has cldemote from gcc11 */ -#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && defined(__GNUC__) && (ZEND_GCC_VERSION >= 11000) +/* __builtin_cpu_supports has cldemote from gcc11 and clang 19 */ +#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && ((defined(__clang__) && (__clang_major__ >= 19)) || (!defined(__clang__) && defined(__GNUC__) && (ZEND_GCC_VERSION >= 11000))) +#define HAVE_ZEND_CPU_SUPPORTS_CLDEMOTE 1 ZEND_NO_SANITIZE_ADDRESS static inline int zend_cpu_supports_cldemote(void) { #ifdef PHP_HAVE_BUILTIN_CPU_INIT diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index e4d90058a699..6801131e41da 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -270,7 +270,7 @@ char *alloca(); # define ZEND_ATTRIBUTE_NODISCARD #endif -#if ZEND_GCC_VERSION >= 3000 +#if ZEND_GCC_VERSION >= 3000 || __has_attribute(const) # define ZEND_ATTRIBUTE_CONST __attribute__((const)) #else # define ZEND_ATTRIBUTE_CONST @@ -312,7 +312,7 @@ char *alloca(); # define ZEND_ATTRIBUTE_NONNULL_ARGS(...) #endif -#if defined(__GNUC__) && ZEND_GCC_VERSION >= 4003 +#if (defined(__GNUC__) && ZEND_GCC_VERSION >= 4003) || __has_attribute(cold) # define ZEND_COLD __attribute__((cold)) # ifdef __OPTIMIZE__ # define ZEND_OPT_SIZE __attribute__((optimize("Os"))) @@ -327,7 +327,7 @@ char *alloca(); # define ZEND_OPT_SPEED #endif -#if defined(__GNUC__) && ZEND_GCC_VERSION >= 5000 +#if (defined(__GNUC__) && ZEND_GCC_VERSION >= 5000) # define ZEND_ATTRIBUTE_UNUSED_LABEL __attribute__((unused)); # define ZEND_ATTRIBUTE_COLD_LABEL __attribute__((cold)); #else @@ -651,8 +651,8 @@ extern "C++" { #endif /* Do not use for conditional declaration of API functions! */ -#if defined(ZEND_INTRIN_PCLMUL_RESOLVER) && defined(ZEND_INTRIN_HAVE_IFUNC_TARGET) && (!defined(__GNUC__) || (ZEND_GCC_VERSION >= 9000)) -/* __builtin_cpu_supports has pclmul from gcc9 */ +#if defined(ZEND_INTRIN_PCLMUL_RESOLVER) && defined(ZEND_INTRIN_HAVE_IFUNC_TARGET) && (!defined(__GNUC__) || (defined(__clang__) && __clang_major__ >= 19) || (ZEND_GCC_VERSION >= 9000)) +/* __builtin_cpu_supports has pclmul from gcc9 and clang 19 */ # define ZEND_INTRIN_PCLMUL_FUNC_PROTO 1 #elif defined(ZEND_INTRIN_PCLMUL_RESOLVER) # define ZEND_INTRIN_PCLMUL_FUNC_PTR 1 @@ -677,8 +677,8 @@ extern "C++" { #endif /* Do not use for conditional declaration of API functions! */ -#if defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER) && defined(ZEND_INTRIN_HAVE_IFUNC_TARGET) && (!defined(__GNUC__) || (ZEND_GCC_VERSION >= 9000)) -/* __builtin_cpu_supports has pclmul from gcc9 */ +#if defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER) && defined(ZEND_INTRIN_HAVE_IFUNC_TARGET) && (!defined(__GNUC__) || (defined(__clang__) && __clang_major__ >= 19) || (ZEND_GCC_VERSION >= 9000)) +/* __builtin_cpu_supports has pclmul from gcc9 and clang 19 */ # define ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PROTO 1 #elif defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER) # define ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PTR 1 diff --git a/ext/opcache/jit/zend_jit_ir.c b/ext/opcache/jit/zend_jit_ir.c index 2461d024dd6a..c4b88b74f64d 100644 --- a/ext/opcache/jit/zend_jit_ir.c +++ b/ext/opcache/jit/zend_jit_ir.c @@ -14,6 +14,7 @@ +----------------------------------------------------------------------+ */ +#include "Zend/zend_cpuinfo.h" #include "Zend/zend_types.h" #include "Zend/zend_type_info.h" #include "jit/ir/ir.h" @@ -3394,7 +3395,7 @@ static void zend_jit_setup(bool reattached) if (zend_cpu_supports_avx()) { allowed_opt_flags |= ZEND_JIT_CPU_AVX; } -# if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && defined(__GNUC__) && (ZEND_GCC_VERSION >= 11000) +# ifdef HAVE_ZEND_CPU_SUPPORTS_CLDEMOTE if (zend_cpu_supports_cldemote()) { default_mflags |= IR_X86_CLDEMOTE; } diff --git a/ext/opcache/zend_shared_alloc.h b/ext/opcache/zend_shared_alloc.h index 23d515f5b9f2..cf0bb10d8932 100644 --- a/ext/opcache/zend_shared_alloc.h +++ b/ext/opcache/zend_shared_alloc.h @@ -164,7 +164,11 @@ typedef union _align_test { zend_long lng; } align_test; -#if ZEND_GCC_VERSION >= 2000 +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +# define PLATFORM_ALIGNMENT (alignof(align_test) < 8 ? 8 : alignof(align_test)) +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +# define PLATFORM_ALIGNMENT (_Alignof(align_test) < 8 ? 8 : _Alignof(align_test)) +#elif ZEND_GCC_VERSION >= 2000 || defined(__clang__) # define PLATFORM_ALIGNMENT (__alignof__(align_test) < 8 ? 8 : __alignof__(align_test)) #else # define PLATFORM_ALIGNMENT (sizeof(align_test)) diff --git a/ext/pdo_firebird/tests/autocommit.phpt b/ext/pdo_firebird/tests/autocommit.phpt index 3f4f7e8f370f..daa91898a8e9 100644 --- a/ext/pdo_firebird/tests/autocommit.phpt +++ b/ext/pdo_firebird/tests/autocommit.phpt @@ -71,9 +71,9 @@ array(1) { ========== not in auto commit mode ========== auto commit mode OFF insert, expect error -SQLSTATE[08003]: Connection does not exist: %s +%r(SQLSTATE\[08003\]: Connection does not exist|SQLSTATE\[HY000\]: General error)%r: %s select, expect error -SQLSTATE[08003]: Connection does not exist: %s +%r(SQLSTATE\[08003\]: Connection does not exist|SQLSTATE\[HY000\]: General error)%r: %s done!