Commit 10dd64f5b58 for php
commit 10dd64f5b588b3214b3ec060be7a542d39d221d3
Author: Gina Peter Banyard <girgias@php.net>
Date: Sun Nov 8 21:05:56 2026 +0000
Zend: use native C deprecated attribute if available (#25325)
And move deprecated attribute at the beginning of function declarations.
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index a513593d7d6..57aa16d6a71 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -5040,7 +5040,7 @@ ZEND_API void zend_cleanup_unfinished_execution(zend_execute_data *execute_data,
cleanup_live_vars(execute_data, op_num, catch_op_num);
}
-ZEND_API ZEND_ATTRIBUTE_DEPRECATED HashTable *zend_unfinished_execution_gc(zend_execute_data *execute_data, zend_execute_data *call, zend_get_gc_buffer *gc_buffer)
+ZEND_ATTRIBUTE_DEPRECATED ZEND_API HashTable *zend_unfinished_execution_gc(zend_execute_data *execute_data, zend_execute_data *call, zend_get_gc_buffer *gc_buffer)
{
return zend_unfinished_execution_gc_ex(execute_data, call, gc_buffer, false);
}
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index 3e750e8cf30..82d4af25d91 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -555,7 +555,7 @@ ZEND_API zval *zend_get_zval_ptr(const zend_op *opline, int op_type, const znode
ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table);
ZEND_API void ZEND_FASTCALL zend_free_compiled_variables(zend_execute_data *execute_data);
ZEND_API void zend_cleanup_unfinished_execution(zend_execute_data *execute_data, uint32_t op_num, uint32_t catch_op_num);
-ZEND_API ZEND_ATTRIBUTE_DEPRECATED HashTable *zend_unfinished_execution_gc(zend_execute_data *execute_data, zend_execute_data *call, zend_get_gc_buffer *gc_buffer);
+ZEND_ATTRIBUTE_DEPRECATED ZEND_API HashTable *zend_unfinished_execution_gc(zend_execute_data *execute_data, zend_execute_data *call, zend_get_gc_buffer *gc_buffer);
ZEND_API HashTable *zend_unfinished_execution_gc_ex(zend_execute_data *execute_data, zend_execute_data *call, zend_get_gc_buffer *gc_buffer, bool suspended_by_yield);
ZEND_API zval* ZEND_FASTCALL zend_fetch_static_property(zend_execute_data *ex, int fetch_type);
ZEND_API zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_undefined_method(const zend_class_entry *ce, const zend_string *method);
diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h
index ab1592bfe9c..193a28259f0 100644
--- a/Zend/zend_portability.h
+++ b/Zend/zend_portability.h
@@ -310,7 +310,9 @@ char *alloca();
# define ZEND_ATTRIBUTE_PTR_FORMAT(type, idx, first)
#endif
-#if ZEND_GCC_VERSION >= 3001 || __has_attribute(deprecated)
+#if __STDC_VERSION__ >= 202311L || (defined(__cplusplus) && __cplusplus >= 201402L)
+# define ZEND_ATTRIBUTE_DEPRECATED [[deprecated]]
+#elif ZEND_GCC_VERSION >= 3001 || __has_attribute(deprecated)
# define ZEND_ATTRIBUTE_DEPRECATED __attribute__((deprecated))
#elif defined(ZEND_WIN32)
# define ZEND_ATTRIBUTE_DEPRECATED __declspec(deprecated)
diff --git a/main/php.h b/main/php.h
index 89ceac346b5..2b72f04d604 100644
--- a/main/php.h
+++ b/main/php.h
@@ -293,11 +293,11 @@ END_EXTERN_C()
#define error_handling_t zend_error_handling_t
BEGIN_EXTERN_C()
-static inline ZEND_ATTRIBUTE_DEPRECATED void php_set_error_handling(error_handling_t error_handling, zend_class_entry *exception_class)
+ZEND_ATTRIBUTE_DEPRECATED static inline void php_set_error_handling(error_handling_t error_handling, zend_class_entry *exception_class)
{
zend_replace_error_handling(error_handling, exception_class, NULL);
}
-static inline ZEND_ATTRIBUTE_DEPRECATED void php_std_error_handling(void) {}
+ZEND_ATTRIBUTE_DEPRECATED static inline void php_std_error_handling(void) {}
PHPAPI ZEND_COLD void php_verror(const char *docref, int type, const char *format, va_list args) PHP_ATTRIBUTE_FORMAT(printf, 3, 0);