1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Zend/zend_compile: add const qualifiers

This commit is contained in:
Gina Peter Banyard
2025-09-24 22:40:04 +01:00
parent ee40791aff
commit c669fbf370
5 changed files with 270 additions and 279 deletions

View File

@@ -430,7 +430,7 @@ ZEND_API ZEND_COLD void zend_argument_must_not_be_empty_error(uint32_t arg_num)
zend_argument_value_error(arg_num, "must not be empty"); zend_argument_value_error(arg_num, "must not be empty");
} }
ZEND_API ZEND_COLD void zend_class_redeclaration_error_ex(int type, zend_string *new_name, zend_class_entry *old_ce) ZEND_API ZEND_COLD void zend_class_redeclaration_error_ex(int type, zend_string *new_name, const zend_class_entry *old_ce)
{ {
if (old_ce->type == ZEND_INTERNAL_CLASS) { if (old_ce->type == ZEND_INTERNAL_CLASS) {
zend_error(type, "Cannot redeclare %s %s", zend_error(type, "Cannot redeclare %s %s",
@@ -445,7 +445,7 @@ ZEND_API ZEND_COLD void zend_class_redeclaration_error_ex(int type, zend_string
} }
} }
ZEND_API ZEND_COLD void zend_class_redeclaration_error(int type, zend_class_entry *old_ce) ZEND_API ZEND_COLD void zend_class_redeclaration_error(int type, const zend_class_entry *old_ce)
{ {
zend_class_redeclaration_error_ex(type, old_ce->name, old_ce); zend_class_redeclaration_error_ex(type, old_ce->name, old_ce);
} }

View File

@@ -1564,8 +1564,8 @@ ZEND_API ZEND_COLD void zend_argument_error(zend_class_entry *error_ce, uint32_t
ZEND_API ZEND_COLD void zend_argument_type_error(uint32_t arg_num, const char *format, ...); ZEND_API ZEND_COLD void zend_argument_type_error(uint32_t arg_num, const char *format, ...);
ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char *format, ...); ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char *format, ...);
ZEND_API ZEND_COLD void zend_argument_must_not_be_empty_error(uint32_t arg_num); ZEND_API ZEND_COLD void zend_argument_must_not_be_empty_error(uint32_t arg_num);
ZEND_API ZEND_COLD void zend_class_redeclaration_error(int type, zend_class_entry *old_ce); ZEND_API ZEND_COLD void zend_class_redeclaration_error(int type, const zend_class_entry *old_ce);
ZEND_API ZEND_COLD void zend_class_redeclaration_error_ex(int type, zend_string *new_name, zend_class_entry *old_ce); ZEND_API ZEND_COLD void zend_class_redeclaration_error_ex(int type, zend_string *new_name, const zend_class_entry *old_ce);
#define ZPP_ERROR_OK 0 #define ZPP_ERROR_OK 0
#define ZPP_ERROR_FAILURE 1 #define ZPP_ERROR_FAILURE 1

File diff suppressed because it is too large Load Diff

View File

@@ -461,7 +461,7 @@ const char *zend_visibility_string(uint32_t fn_flags);
/* Stored in zend_property_info.offset, not returned by zend_get_property_offset(). */ /* Stored in zend_property_info.offset, not returned by zend_get_property_offset(). */
#define ZEND_VIRTUAL_PROPERTY_OFFSET ((uint32_t)-1) #define ZEND_VIRTUAL_PROPERTY_OFFSET ((uint32_t)-1)
zend_property_hook_kind zend_get_property_hook_kind_from_name(zend_string *name); zend_property_hook_kind zend_get_property_hook_kind_from_name(const zend_string *name);
typedef struct _zend_property_info { typedef struct _zend_property_info {
uint32_t offset; /* property offset for object properties or uint32_t offset; /* property offset for object properties or
@@ -880,9 +880,9 @@ void shutdown_compiler(void);
void zend_init_compiler_data_structures(void); void zend_init_compiler_data_structures(void);
void zend_oparray_context_begin(zend_oparray_context *prev_context, zend_op_array *op_array); void zend_oparray_context_begin(zend_oparray_context *prev_context, zend_op_array *op_array);
void zend_oparray_context_end(zend_oparray_context *prev_context); void zend_oparray_context_end(const zend_oparray_context *prev_context);
void zend_file_context_begin(zend_file_context *prev_context); void zend_file_context_begin(zend_file_context *prev_context);
void zend_file_context_end(zend_file_context *prev_context); void zend_file_context_end(const zend_file_context *prev_context);
extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type); extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type);
extern ZEND_API zend_op_array *(*zend_compile_string)(zend_string *source_string, const char *filename, zend_compile_position position); extern ZEND_API zend_op_array *(*zend_compile_string)(zend_string *source_string, const char *filename, zend_compile_position position);
@@ -933,8 +933,8 @@ uint32_t zend_modifier_list_to_flags(zend_modifier_target target, zend_ast *modi
bool zend_handle_encoding_declaration(zend_ast *ast); bool zend_handle_encoding_declaration(zend_ast *ast);
ZEND_API zend_class_entry *zend_bind_class_in_slot( ZEND_API zend_class_entry *zend_bind_class_in_slot(
zval *class_table_slot, zval *lcname, zend_string *lc_parent_name); zval *class_table_slot, const zval *lcname, zend_string *lc_parent_name);
ZEND_API zend_result do_bind_function(zend_function *func, zval *lcname); ZEND_API zend_result do_bind_function(zend_function *func, const zval *lcname);
ZEND_API zend_result do_bind_class(zval *lcname, zend_string *lc_parent_name); ZEND_API zend_result do_bind_class(zval *lcname, zend_string *lc_parent_name);
void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline); void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline);
@@ -963,7 +963,7 @@ ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle);
ZEND_API void zend_cleanup_mutable_class_data(zend_class_entry *ce); ZEND_API void zend_cleanup_mutable_class_data(zend_class_entry *ce);
ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce); ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce);
ZEND_API void zend_type_release(zend_type type, bool persistent); ZEND_API void zend_type_release(zend_type type, bool persistent);
ZEND_API zend_string *zend_create_member_string(zend_string *class_name, zend_string *member_name); ZEND_API zend_string *zend_create_member_string(const zend_string *class_name, const zend_string *member_name);
ZEND_API ZEND_COLD void zend_user_exception_handler(void); ZEND_API ZEND_COLD void zend_user_exception_handler(void);
@@ -1005,7 +1005,7 @@ ZEND_API bool zend_is_compiling(void);
ZEND_API char *zend_make_compiled_string_description(const char *name); ZEND_API char *zend_make_compiled_string_description(const char *name);
ZEND_API void zend_initialize_class_data(zend_class_entry *ce, bool nullify_handlers); ZEND_API void zend_initialize_class_data(zend_class_entry *ce, bool nullify_handlers);
uint32_t zend_get_class_fetch_type(const zend_string *name); uint32_t zend_get_class_fetch_type(const zend_string *name);
ZEND_API uint8_t zend_get_call_op(const zend_op *init_op, zend_function *fbc, bool result_used); ZEND_API uint8_t zend_get_call_op(const zend_op *init_op, const zend_function *fbc, bool result_used);
ZEND_API bool zend_is_smart_branch(const zend_op *opline); ZEND_API bool zend_is_smart_branch(const zend_op *opline);
typedef bool (*zend_auto_global_callback)(zend_string *name); typedef bool (*zend_auto_global_callback)(zend_string *name);

View File

@@ -359,7 +359,7 @@ static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame_ex(ui
} }
} }
static zend_always_inline uint32_t zend_vm_calc_used_stack(uint32_t num_args, zend_function *func) static zend_always_inline uint32_t zend_vm_calc_used_stack(uint32_t num_args, const zend_function *func)
{ {
uint32_t used_stack = ZEND_CALL_FRAME_SLOT + num_args + func->common.T; uint32_t used_stack = ZEND_CALL_FRAME_SLOT + num_args + func->common.T;