[php-src] master: Zend: use native C deprecated attribute if available (#25325)

From: Date: Sun, 08 Nov 2026 21:05:59 +0000
Subject: [php-src] master: Zend: use native C deprecated attribute if available (#25325)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143456@lists.php.net to get a copy of this message
Author: Gina Peter Banyard (Girgias) Committer: GitHub (web-flow) Pusher: Girgias Date: 2026-11-08T21:05:56Z Commit: https://github.com/php/php-src/commit/10dd64f5b588b3214b3ec060be7a542d39d221d3 Raw diff: https://github.com/php/php-src/commit/10dd64f5b588b3214b3ec060be7a542d39d221d3.diff Zend: use native C deprecated attribute if available (#25325) And move deprecated attribute at the beginning of function declarations. Changed paths: M Zend/zend_execute.c M Zend/zend_execute.h M Zend/zend_portability.h M main/php.h Diff: diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index a513593d7d64..57aa16d6a71c 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 3e750e8cf30a..82d4af25d914 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 ab1592bfe9c9..193a28259f0c 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 89ceac346b50..2b72f04d604f 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);

« previous php.cvs (#143456) next »