Zend/zend_types.h: deprecate zend_bool, zend_intptr_t, zend_uintptr_t (#10597)

These types are standard C99.

For compatibility with out-of-tree extensions, keep the typedefs
in main/php.h.
This commit is contained in:
Max Kellermann 2023-02-18 20:31:28 +01:00 committed by GitHub
parent 5e617d0b4d
commit 413844d626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 77 additions and 81 deletions

View File

@ -482,7 +482,7 @@ end
define print_pi
set $pi = (zend_property_info *)$arg0
set $initial_offset = ((uint32_t)(zend_uintptr_t)(&((zend_object*)0)->properties_table[(0)]))
set $initial_offset = ((uint32_t)(uintptr_t)(&((zend_object*)0)->properties_table[(0)]))
set $ptr_to_val = (zval*)((char*)$pi->ce->default_properties_table + $pi->offset - $initial_offset)
printf "[%p] {\n", $pi
printf " offset = %p\n", $pi->offset

View File

@ -2764,7 +2764,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
internal_function->arg_info = (zend_internal_arg_info*)ptr->arg_info+1;
internal_function->num_args = ptr->num_args;
/* Currently you cannot denote that the function can accept less arguments than num_args */
if (info->required_num_args == (zend_uintptr_t)-1) {
if (info->required_num_args == (uintptr_t)-1) {
internal_function->required_num_args = ptr->num_args;
} else {
internal_function->required_num_args = info->required_num_args;

View File

@ -156,7 +156,7 @@ typedef struct _zend_fcall_info_cache {
#define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX2(name, return_reference, required_num_args, class_name, allow_null, is_tentative_return_type) \
static const zend_internal_arg_info name[] = { \
{ (const char*)(zend_uintptr_t)(required_num_args), \
{ (const char*)(uintptr_t)(required_num_args), \
ZEND_TYPE_INIT_CLASS_CONST(#class_name, allow_null, _ZEND_ARG_INFO_FLAGS(return_reference, 0, is_tentative_return_type)), NULL },
#define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(name, return_reference, required_num_args, class_name, allow_null) \
@ -170,7 +170,7 @@ typedef struct _zend_fcall_info_cache {
#define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX2(name, return_reference, required_num_args, type, is_tentative_return_type) \
static const zend_internal_arg_info name[] = { \
{ (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_MASK(type | _ZEND_ARG_INFO_FLAGS(return_reference, 0, is_tentative_return_type)), NULL },
{ (const char*)(uintptr_t)(required_num_args), ZEND_TYPE_INIT_MASK(type | _ZEND_ARG_INFO_FLAGS(return_reference, 0, is_tentative_return_type)), NULL },
#define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(name, return_reference, required_num_args, type) \
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX2(name, return_reference, required_num_args, type, 0)
@ -180,7 +180,7 @@ typedef struct _zend_fcall_info_cache {
#define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX2(name, return_reference, required_num_args, class_name, type, is_tentative_return_type) \
static const zend_internal_arg_info name[] = { \
{ (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_CLASS_CONST_MASK(#class_name, type | _ZEND_ARG_INFO_FLAGS(return_reference, 0, is_tentative_return_type)), NULL },
{ (const char*)(uintptr_t)(required_num_args), ZEND_TYPE_INIT_CLASS_CONST_MASK(#class_name, type | _ZEND_ARG_INFO_FLAGS(return_reference, 0, is_tentative_return_type)), NULL },
#define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(name, return_reference, required_num_args, class_name, type) \
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX2(name, return_reference, required_num_args, class_name, type, 0)
@ -190,7 +190,7 @@ typedef struct _zend_fcall_info_cache {
#define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX2(name, return_reference, required_num_args, type, allow_null, is_tentative_return_type) \
static const zend_internal_arg_info name[] = { \
{ (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_CODE(type, allow_null, _ZEND_ARG_INFO_FLAGS(return_reference, 0, is_tentative_return_type)), NULL },
{ (const char*)(uintptr_t)(required_num_args), ZEND_TYPE_INIT_CODE(type, allow_null, _ZEND_ARG_INFO_FLAGS(return_reference, 0, is_tentative_return_type)), NULL },
#define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX2(name, return_reference, required_num_args, type, allow_null, 0)
@ -203,7 +203,7 @@ typedef struct _zend_fcall_info_cache {
#define ZEND_BEGIN_ARG_INFO_EX(name, _unused, return_reference, required_num_args) \
static const zend_internal_arg_info name[] = { \
{ (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_NONE(_ZEND_ARG_INFO_FLAGS(return_reference, 0, 0)), NULL },
{ (const char*)(uintptr_t)(required_num_args), ZEND_TYPE_INIT_NONE(_ZEND_ARG_INFO_FLAGS(return_reference, 0, 0)), NULL },
#define ZEND_BEGIN_ARG_INFO(name, _unused) \
ZEND_BEGIN_ARG_INFO_EX(name, {}, ZEND_RETURN_VALUE, -1)
#define ZEND_END_ARG_INFO() };

View File

@ -774,7 +774,7 @@ static void *zend_mm_chunk_alloc(zend_mm_heap *heap, size_t size, size_t alignme
#if ZEND_MM_STORAGE
if (UNEXPECTED(heap->storage)) {
void *ptr = heap->storage->handlers.chunk_alloc(heap->storage, size, alignment);
ZEND_ASSERT(((zend_uintptr_t)((char*)ptr + (alignment-1)) & (alignment-1)) == (zend_uintptr_t)ptr);
ZEND_ASSERT(((uintptr_t)((char*)ptr + (alignment-1)) & (alignment-1)) == (uintptr_t)ptr);
return ptr;
}
#endif
@ -2171,7 +2171,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap)
repeated = zend_mm_find_leaks_huge(heap, list);
total += 1 + repeated;
if (repeated) {
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated);
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(uintptr_t)repeated);
}
heap->huge_list = list = list->next;
@ -2210,7 +2210,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap)
zend_mm_find_leaks(heap, p, i + bin_pages[bin_num], &leak);
total += 1 + repeated;
if (repeated) {
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated);
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(uintptr_t)repeated);
}
}
dbg = (zend_mm_debug_info*)((char*)dbg + bin_data_size[bin_num]);
@ -2236,7 +2236,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap)
repeated = zend_mm_find_leaks(heap, p, i + pages_count, &leak);
total += 1 + repeated;
if (repeated) {
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated);
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(uintptr_t)repeated);
}
i += pages_count;
}

View File

@ -431,7 +431,7 @@ typedef struct _zend_arg_info {
* It's also used for the return type.
*/
typedef struct _zend_internal_function_info {
zend_uintptr_t required_num_args;
uintptr_t required_num_args;
zend_type type;
const char *default_value;
} zend_internal_function_info;

View File

@ -4804,7 +4804,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_array(zend_ar
}
/* }}} */
#define ZEND_FAKE_OP_ARRAY ((zend_op_array*)(zend_intptr_t)-1)
#define ZEND_FAKE_OP_ARRAY ((zend_op_array*)(intptr_t)-1)
static zend_never_inline zend_op_array* ZEND_FASTCALL zend_include_or_eval(zval *inc_filename_zv, int type) /* {{{ */
{

View File

@ -1141,7 +1141,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *
ALLOC_HASHTABLE(CG(unlinked_uses));
zend_hash_init(CG(unlinked_uses), 0, NULL, NULL, 0);
}
zend_hash_index_add_empty_element(CG(unlinked_uses), (zend_long)(zend_uintptr_t)ce);
zend_hash_index_add_empty_element(CG(unlinked_uses), (zend_long)(uintptr_t)ce);
return ce;
}
return NULL;

View File

@ -298,7 +298,7 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t
ZEND_API void ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort_func, bucket_compare_func_t compare_func, bool renumber);
ZEND_API zval* ZEND_FASTCALL zend_hash_minmax(const HashTable *ht, compare_func_t compar, uint32_t flag);
static zend_always_inline void ZEND_FASTCALL zend_hash_sort(HashTable *ht, bucket_compare_func_t compare_func, zend_bool renumber) {
static zend_always_inline void ZEND_FASTCALL zend_hash_sort(HashTable *ht, bucket_compare_func_t compare_func, bool renumber) {
zend_hash_sort_ex(ht, zend_sort, compare_func, renumber);
}

View File

@ -2682,7 +2682,7 @@ static void check_unrecoverable_load_failure(zend_class_entry *ce) {
* a dependence on the inheritance hierarchy of this specific class. Instead we fall back to
* a fatal error, as would happen if we did not allow exceptions in the first place. */
if (CG(unlinked_uses)
&& zend_hash_index_del(CG(unlinked_uses), (zend_long)(zend_uintptr_t)ce) == SUCCESS) {
&& zend_hash_index_del(CG(unlinked_uses), (zend_long)(uintptr_t)ce) == SUCCESS) {
zend_exception_uncaught_error(
"During inheritance of %s with variance dependencies", ZSTR_VAL(ce->name));
}
@ -2957,7 +2957,7 @@ ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string
}
if (CG(unlinked_uses)) {
zend_hash_index_del(CG(unlinked_uses), (zend_long)(zend_uintptr_t) ce);
zend_hash_index_del(CG(unlinked_uses), (zend_long)(uintptr_t) ce);
}
orig_linking_class = CG(current_linking_class);

View File

@ -536,7 +536,7 @@ ZEND_API zend_result zend_check_property_access(const zend_object *zobj, zend_st
static void zend_property_guard_dtor(zval *el) /* {{{ */ {
uint32_t *ptr = (uint32_t*)Z_PTR_P(el);
if (EXPECTED(!(((zend_uintptr_t)ptr) & 1))) {
if (EXPECTED(!(((uintptr_t)ptr) & 1))) {
efree_size(ptr, sizeof(uint32_t));
}
}
@ -565,7 +565,7 @@ ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *membe
zend_hash_init(guards, 8, NULL, zend_property_guard_dtor, 0);
/* mark pointer as "special" using low bit */
zend_hash_add_new_ptr(guards, str,
(void*)(((zend_uintptr_t)&Z_PROPERTY_GUARD_P(zv)) | 1));
(void*)(((uintptr_t)&Z_PROPERTY_GUARD_P(zv)) | 1));
zval_ptr_dtor_str(zv);
ZVAL_ARR(zv, guards);
}
@ -574,7 +574,7 @@ ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *membe
ZEND_ASSERT(guards != NULL);
zv = zend_hash_find(guards, member);
if (zv != NULL) {
return (uint32_t*)(((zend_uintptr_t)Z_PTR_P(zv)) & ~1);
return (uint32_t*)(((uintptr_t)Z_PTR_P(zv)) & ~1);
}
} else {
ZEND_ASSERT(Z_TYPE_P(zv) == IS_UNDEF);

View File

@ -25,14 +25,14 @@
#define OBJ_BUCKET_INVALID (1<<0)
#define IS_OBJ_VALID(o) (!(((zend_uintptr_t)(o)) & OBJ_BUCKET_INVALID))
#define IS_OBJ_VALID(o) (!(((uintptr_t)(o)) & OBJ_BUCKET_INVALID))
#define SET_OBJ_INVALID(o) ((zend_object*)((((zend_uintptr_t)(o)) | OBJ_BUCKET_INVALID)))
#define SET_OBJ_INVALID(o) ((zend_object*)((((uintptr_t)(o)) | OBJ_BUCKET_INVALID)))
#define GET_OBJ_BUCKET_NUMBER(o) (((zend_intptr_t)(o)) >> 1)
#define GET_OBJ_BUCKET_NUMBER(o) (((intptr_t)(o)) >> 1)
#define SET_OBJ_BUCKET_NUMBER(o, n) do { \
(o) = (zend_object*)((((zend_uintptr_t)(n)) << 1) | OBJ_BUCKET_INVALID); \
(o) = (zend_object*)((((uintptr_t)(n)) << 1) | OBJ_BUCKET_INVALID); \
} while (0)
#define ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST(h) do { \

View File

@ -701,7 +701,7 @@ extern "C++" {
# define ZEND_SET_ALIGNED(alignment, decl) decl
#endif
#define ZEND_SLIDE_TO_ALIGNED(alignment, ptr) (((zend_uintptr_t)(ptr) + ((alignment)-1)) & ~((alignment)-1))
#define ZEND_SLIDE_TO_ALIGNED(alignment, ptr) (((uintptr_t)(ptr) + ((alignment)-1)) & ~((alignment)-1))
#define ZEND_SLIDE_TO_ALIGNED16(ptr) ZEND_SLIDE_TO_ALIGNED(Z_UL(16), ptr)
#ifdef ZEND_WIN32

View File

@ -47,7 +47,6 @@
# define ZEND_ENDIAN_LOHI_C_4(a, b, c, d) a, b, c, d
#endif
typedef bool zend_bool;
typedef unsigned char zend_uchar;
typedef enum {
@ -71,9 +70,6 @@ typedef ZEND_RESULT_CODE zend_result;
# endif
#endif
typedef intptr_t zend_intptr_t;
typedef uintptr_t zend_uintptr_t;
#ifdef ZTS
#define ZEND_TLS static TSRM_TLS
#define ZEND_EXT_TLS TSRM_TLS

10
Zend/zend_vm_execute.h generated
View File

@ -64706,7 +64706,7 @@ static void init_opcode_serialiser(void)
Z_TYPE_INFO(tmp) = IS_LONG;
for (i = 0; i < zend_handlers_count; i++) {
Z_LVAL(tmp) = i;
zend_hash_index_add(zend_handlers_table, (zend_long)(zend_uintptr_t)zend_opcode_handlers[i], &tmp);
zend_hash_index_add(zend_handlers_table, (zend_long)(uintptr_t)zend_opcode_handlers[i], &tmp);
}
}
@ -64717,14 +64717,14 @@ ZEND_API void ZEND_FASTCALL zend_serialize_opcode_handler(zend_op *op)
if (!zend_handlers_table) {
init_opcode_serialiser();
}
zv = zend_hash_index_find(zend_handlers_table, (zend_long)(zend_uintptr_t)op->handler);
zv = zend_hash_index_find(zend_handlers_table, (zend_long)(uintptr_t)op->handler);
ZEND_ASSERT(zv != NULL);
op->handler = (const void *)(zend_uintptr_t)Z_LVAL_P(zv);
op->handler = (const void *)(uintptr_t)Z_LVAL_P(zv);
}
ZEND_API void ZEND_FASTCALL zend_deserialize_opcode_handler(zend_op *op)
{
op->handler = zend_opcode_handlers[(zend_uintptr_t)op->handler];
op->handler = zend_opcode_handlers[(uintptr_t)op->handler];
}
ZEND_API const void* ZEND_FASTCALL zend_get_opcode_handler_func(const zend_op *op)
@ -64737,7 +64737,7 @@ ZEND_API const void* ZEND_FASTCALL zend_get_opcode_handler_func(const zend_op *o
if (!zend_handlers_table) {
init_opcode_serialiser();
}
zv = zend_hash_index_find(zend_handlers_table, (zend_long)(zend_uintptr_t)op->handler);
zv = zend_hash_index_find(zend_handlers_table, (zend_long)(uintptr_t)op->handler);
ZEND_ASSERT(zv != NULL);
return zend_opcode_handler_funcs[Z_LVAL_P(zv)];
#else

View File

@ -102,7 +102,7 @@ static void init_opcode_serialiser(void)
Z_TYPE_INFO(tmp) = IS_LONG;
for (i = 0; i < zend_handlers_count; i++) {
Z_LVAL(tmp) = i;
zend_hash_index_add(zend_handlers_table, (zend_long)(zend_uintptr_t)zend_opcode_handlers[i], &tmp);
zend_hash_index_add(zend_handlers_table, (zend_long)(uintptr_t)zend_opcode_handlers[i], &tmp);
}
}
@ -113,14 +113,14 @@ ZEND_API void ZEND_FASTCALL zend_serialize_opcode_handler(zend_op *op)
if (!zend_handlers_table) {
init_opcode_serialiser();
}
zv = zend_hash_index_find(zend_handlers_table, (zend_long)(zend_uintptr_t)op->handler);
zv = zend_hash_index_find(zend_handlers_table, (zend_long)(uintptr_t)op->handler);
ZEND_ASSERT(zv != NULL);
op->handler = (const void *)(zend_uintptr_t)Z_LVAL_P(zv);
op->handler = (const void *)(uintptr_t)Z_LVAL_P(zv);
}
ZEND_API void ZEND_FASTCALL zend_deserialize_opcode_handler(zend_op *op)
{
op->handler = zend_opcode_handlers[(zend_uintptr_t)op->handler];
op->handler = zend_opcode_handlers[(uintptr_t)op->handler];
}
ZEND_API const void* ZEND_FASTCALL zend_get_opcode_handler_func(const zend_op *op)
@ -133,7 +133,7 @@ ZEND_API const void* ZEND_FASTCALL zend_get_opcode_handler_func(const zend_op *o
if (!zend_handlers_table) {
init_opcode_serialiser();
}
zv = zend_hash_index_find(zend_handlers_table, (zend_long)(zend_uintptr_t)op->handler);
zv = zend_hash_index_find(zend_handlers_table, (zend_long)(uintptr_t)op->handler);
ZEND_ASSERT(zv != NULL);
return zend_opcode_handler_funcs[Z_LVAL_P(zv)];
#else

View File

@ -67,7 +67,7 @@ on input and is used to verify the PHP parameter is an instance of that class.
```txt
a - array (zval*)
A - array or object (zval*)
b - boolean (zend_bool)
b - boolean (bool)
C - class (zend_class_entry*)
d - double (double)
f - function or array containing php method call info (returned as
@ -97,9 +97,9 @@ The following characters also have a meaning in the specifier string:
* `!` - the parameter it follows can be of specified type or NULL. If NULL is
passed, and the output for such type is a pointer, then the output pointer is
set to a native NULL pointer. For 'b', 'l' and 'd', an extra argument of type
zend_bool* must be passed after the corresponding bool*, zend_long* or
bool* must be passed after the corresponding bool*, zend_long* or
double* arguments, respectively. A non-zero value will be written to the
zend_bool if a PHP NULL is passed.
bool if a PHP NULL is passed.
For `f` use the ``ZEND_FCI_INITIALIZED(fci)`` macro to check if a callable
has been provided and ``!ZEND_FCI_INITIALIZED(fci)`` to check if a PHP NULL
is passed.

View File

@ -2145,7 +2145,7 @@ static void date_interval_object_to_hash(php_interval_obj *intervalobj, HashTabl
/* Records whether this is a special relative interval that needs to be recreated from a string */
if (intervalobj->from_string) {
ZVAL_BOOL(&zv, (zend_bool)intervalobj->from_string);
ZVAL_BOOL(&zv, (bool)intervalobj->from_string);
zend_hash_str_update(props, "from_string", strlen("from_string"), &zv);
ZVAL_STR_COPY(&zv, intervalobj->date_string);
zend_hash_str_update(props, "date_string", strlen("date_string"), &zv);
@ -2171,7 +2171,7 @@ static void date_interval_object_to_hash(php_interval_obj *intervalobj, HashTabl
ZVAL_FALSE(&zv);
zend_hash_str_update(props, "days", sizeof("days")-1, &zv);
}
ZVAL_BOOL(&zv, (zend_bool)intervalobj->from_string);
ZVAL_BOOL(&zv, (bool)intervalobj->from_string);
zend_hash_str_update(props, "from_string", strlen("from_string"), &zv);
#undef PHP_DATE_INTERVAL_ADD_PROPERTY

View File

@ -1507,11 +1507,11 @@ static zend_persistent_script *store_script_in_file_cache(zend_persistent_script
#if defined(__AVX__) || defined(__SSE2__)
/* Align to 64-byte boundary */
ZCG(mem) = zend_arena_alloc(&CG(arena), memory_used + 64);
ZCG(mem) = (void*)(((zend_uintptr_t)ZCG(mem) + 63L) & ~63L);
ZCG(mem) = (void*)(((uintptr_t)ZCG(mem) + 63L) & ~63L);
#elif ZEND_MM_NEED_EIGHT_BYTE_REALIGNMENT
/* Align to 8-byte boundary */
ZCG(mem) = zend_arena_alloc(&CG(arena), memory_used + 8);
ZCG(mem) = (void*)(((zend_uintptr_t)ZCG(mem) + 7L) & ~7L);
ZCG(mem) = (void*)(((uintptr_t)ZCG(mem) + 7L) & ~7L);
#else
ZCG(mem) = zend_arena_alloc(&CG(arena), memory_used);
#endif
@ -2410,7 +2410,7 @@ static zend_class_entry* zend_accel_inheritance_cache_add(zend_class_entry *ce,
#if ZEND_MM_NEED_EIGHT_BYTE_REALIGNMENT
/* Align to 8-byte boundary */
ZCG(mem) = (void*)(((zend_uintptr_t)ZCG(mem) + 7L) & ~7L);
ZCG(mem) = (void*)(((uintptr_t)ZCG(mem) + 7L) & ~7L);
#endif
memset(ZCG(mem), 0, size);

View File

@ -262,7 +262,7 @@ static const char* zend_jit_disasm_resolver(
((void)ud);
# endif
const char *name;
void *a = (void*)(zend_uintptr_t)(addr);
void *a = (void*)(uintptr_t)(addr);
Dl_info info;
name = zend_jit_disasm_find_symbol(addr, offset);

View File

@ -27,7 +27,7 @@ static void zend_jit_oprofile_register(const char *name,
size_t size)
{
if (op_agent) {
op_write_native_code(op_agent, name, (uint64_t)(zend_uintptr_t)start, start, size);
op_write_native_code(op_agent, name, (uint64_t)(uintptr_t)start, start, size);
}
}

View File

@ -46,7 +46,7 @@ static zend_always_inline const char *zend_jit_trace_star_desc(uint8_t trace_fla
}
}
static int zend_jit_trace_startup(zend_bool reattached)
static int zend_jit_trace_startup(bool reattached)
{
if (!reattached) {
zend_jit_traces = (zend_jit_trace_info*)zend_shared_alloc(sizeof(zend_jit_trace_info) * JIT_G(max_root_traces));

View File

@ -1098,7 +1098,7 @@ int zend_file_cache_script_store(zend_persistent_script *script, bool in_shm)
#if defined(__AVX__) || defined(__SSE2__)
/* Align to 64-byte boundary */
mem = emalloc(script->size + 64);
buf = (void*)(((zend_uintptr_t)mem + 63L) & ~63L);
buf = (void*)(((uintptr_t)mem + 63L) & ~63L);
#else
mem = buf = emalloc(script->size);
#endif
@ -1834,7 +1834,7 @@ zend_persistent_script *zend_file_cache_script_load(zend_file_handle *file_handl
#if defined(__AVX__) || defined(__SSE2__)
/* Align to 64-byte boundary */
mem = zend_arena_alloc(&CG(arena), info.mem_size + info.str_size + 64);
mem = (void*)(((zend_uintptr_t)mem + 63L) & ~63L);
mem = (void*)(((uintptr_t)mem + 63L) & ~63L);
#else
mem = zend_arena_alloc(&CG(arena), info.mem_size + info.str_size);
#endif

View File

@ -136,7 +136,7 @@ static void zend_hash_persist(HashTable *ht)
hash_size >>= 1;
}
ht->nTableMask = (uint32_t)(-(int32_t)hash_size);
ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */
ZEND_ASSERT(((uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */
HT_SET_DATA_ADDR(ht, ZCG(mem));
ZCG(mem) = (void*)((char*)ZCG(mem) + ZEND_ALIGNED_SIZE((hash_size * sizeof(uint32_t)) + (ht->nNumUsed * sizeof(Bucket))));
HT_HASH_RESET(ht);
@ -157,7 +157,7 @@ static void zend_hash_persist(HashTable *ht)
void *data = ZCG(mem);
void *old_data = HT_GET_DATA_ADDR(ht);
ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */
ZEND_ASSERT(((uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */
ZCG(mem) = (void*)((char*)data + ZEND_ALIGNED_SIZE(HT_USED_SIZE(ht)));
memcpy(data, old_data, HT_USED_SIZE(ht));
if (!(GC_FLAGS(ht) & IS_ARRAY_IMMUTABLE)) {
@ -1308,7 +1308,7 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script
script->mem = ZCG(mem);
ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */
ZEND_ASSERT(((uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */
script = zend_shared_memdup_free(script, sizeof(zend_persistent_script));
script->corrupted = false;
@ -1323,9 +1323,9 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script
#if defined(__AVX__) || defined(__SSE2__)
/* Align to 64-byte boundary */
ZCG(mem) = (void*)(((zend_uintptr_t)ZCG(mem) + 63L) & ~63L);
ZCG(mem) = (void*)(((uintptr_t)ZCG(mem) + 63L) & ~63L);
#else
ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */
ZEND_ASSERT(((uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */
#endif
#ifdef HAVE_JIT

View File

@ -355,7 +355,7 @@ void *zend_shared_alloc(size_t size)
ZSMMG(shared_segments)[i]->pos += block_size;
ZSMMG(shared_free) -= block_size;
ZEND_ASSERT(((zend_uintptr_t)retval & 0x7) == 0); /* should be 8 byte aligned */
ZEND_ASSERT(((uintptr_t)retval & 0x7) == 0); /* should be 8 byte aligned */
return retval;
}
}

View File

@ -141,7 +141,7 @@ static inline void *zend_shared_alloc_aligned(size_t size) {
#if defined(__AVX__) || defined(__SSE2__)
/* Align to 64-byte boundary */
void *p = zend_shared_alloc(size + 64);
return (void *)(((zend_uintptr_t)p + 63L) & ~63L);
return (void *)(((uintptr_t)p + 63L) & ~63L);
#else
return zend_shared_alloc(size);
#endif

View File

@ -382,11 +382,11 @@ fail:
# if BASE64_INTRIN_AVX512_FUNC_PROTO || BASE64_INTRIN_AVX512_FUNC_PTR
ZEND_INTRIN_AVX512_FUNC_DECL(zend_string *php_base64_encode_avx512(const unsigned char *str, size_t length));
ZEND_INTRIN_AVX512_FUNC_DECL(zend_string *php_base64_decode_ex_avx512(const unsigned char *str, size_t length, zend_bool strict));
ZEND_INTRIN_AVX512_FUNC_DECL(zend_string *php_base64_decode_ex_avx512(const unsigned char *str, size_t length, bool strict));
# endif
# if BASE64_INTRIN_AVX512_VBMI_FUNC_PROTO || BASE64_INTRIN_AVX512_VBMI_FUNC_PTR
ZEND_INTRIN_AVX512_VBMI_FUNC_DECL(zend_string *php_base64_encode_avx512_vbmi(const unsigned char *str, size_t length));
ZEND_INTRIN_AVX512_VBMI_FUNC_DECL(zend_string *php_base64_decode_ex_avx512_vbmi(const unsigned char *str, size_t length, zend_bool strict));
ZEND_INTRIN_AVX512_VBMI_FUNC_DECL(zend_string *php_base64_decode_ex_avx512_vbmi(const unsigned char *str, size_t length, bool strict));
# endif
# if ZEND_INTRIN_AVX2_RESOLVER
@ -552,7 +552,7 @@ zend_string *php_base64_encode_avx512_vbmi(const unsigned char *str, size_t leng
return result;
}
zend_string *php_base64_decode_ex_avx512_vbmi(const unsigned char *str, size_t length, zend_bool strict)
zend_string *php_base64_decode_ex_avx512_vbmi(const unsigned char *str, size_t length, bool strict)
{
const unsigned char *c = str;
unsigned char *o;
@ -680,7 +680,7 @@ zend_string *php_base64_encode_avx512(const unsigned char *str, size_t length)
_mm512_setr4_epi32(build_dword(b0, b1, b2, b3), build_dword(b4, b5, b6, b7), \
build_dword(b8, b9, b10, b11), build_dword(b12, b13, b14, b15))
zend_string *php_base64_decode_ex_avx512(const unsigned char *str, size_t length, zend_bool strict)
zend_string *php_base64_decode_ex_avx512(const unsigned char *str, size_t length, bool strict)
{
const unsigned char *c = str;
unsigned char *o;

View File

@ -1282,7 +1282,7 @@ PHP_FUNCTION(proc_open)
}
#ifdef PHP_WIN32
stream = php_stream_fopen_from_fd(_open_osfhandle((zend_intptr_t)descriptors[i].parentend,
stream = php_stream_fopen_from_fd(_open_osfhandle((intptr_t)descriptors[i].parentend,
descriptors[i].mode_flags), mode_string, NULL);
php_stream_set_option(stream, PHP_STREAM_OPTION_PIPE_BLOCKING, blocking_pipes, NULL);
#else

View File

@ -680,7 +680,7 @@ static inline zend_long php_add_var_hash(php_serialize_data_t data, zval *var) /
/* Index for the variable is stored using the numeric value of the pointer to
* the zend_refcounted struct */
key = (zend_ulong) (zend_uintptr_t) Z_COUNTED_P(var);
key = (zend_ulong) (uintptr_t) Z_COUNTED_P(var);
zv = zend_hash_index_find(&data->ht, key);
if (zv) {
@ -1148,7 +1148,7 @@ again:
} else {
/* Mark this value in the var_hash, to avoid creating references to it. */
zval *var_idx = zend_hash_index_find(&var_hash->ht,
(zend_ulong) (zend_uintptr_t) Z_COUNTED_P(struc));
(zend_ulong) (uintptr_t) Z_COUNTED_P(struc));
if (var_idx) {
ZVAL_LONG(var_idx, -1);
}

View File

@ -616,7 +616,7 @@ declared_property:
if ((*var_hash)->ref_props) {
/* Remove old entry from ref_props table, if it exists. */
zend_hash_index_del(
(*var_hash)->ref_props, (zend_uintptr_t) data);
(*var_hash)->ref_props, (uintptr_t) data);
}
}
/* We may override default property value, but they are usually immutable */
@ -705,7 +705,7 @@ second_try:
zend_hash_init((*var_hash)->ref_props, 8, NULL, NULL, 0);
}
zend_hash_index_update_ptr(
(*var_hash)->ref_props, (zend_uintptr_t) data, info);
(*var_hash)->ref_props, (uintptr_t) data, info);
}
}
@ -915,7 +915,7 @@ static int php_var_unserialize_internal(UNSERIALIZE_PARAMETER)
if (!Z_ISREF_P(rval_ref)) {
zend_property_info *info = NULL;
if ((*var_hash)->ref_props) {
info = zend_hash_index_find_ptr((*var_hash)->ref_props, (zend_uintptr_t) rval_ref);
info = zend_hash_index_find_ptr((*var_hash)->ref_props, (uintptr_t) rval_ref);
}
ZVAL_NEW_REF(rval_ref, rval_ref);
if (info) {

View File

@ -683,7 +683,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg)
switch (op) {
case SAPI_HEADER_SET_STATUS:
sapi_update_response_code((int)(zend_intptr_t) arg);
sapi_update_response_code((int)(intptr_t) arg);
return SUCCESS;
case SAPI_HEADER_ADD:

View File

@ -1627,7 +1627,7 @@ static ZEND_COLD void php_message_handler_for_zend(zend_long message, const void
strlcat(memory_leak_buf, relay_buf, sizeof(memory_leak_buf));
}
} else {
unsigned long leak_count = (zend_uintptr_t) data;
unsigned long leak_count = (uintptr_t) data;
snprintf(memory_leak_buf, 512, "Last leak repeated %lu time%s\n", leak_count, (leak_count>1?"s":""));
}

View File

@ -434,4 +434,10 @@ END_EXTERN_C()
#include "php_reentrancy.h"
/* the following typedefs are deprecated and will be removed in PHP
* 9.0; use the standard C99 types instead */
typedef bool zend_bool;
typedef intptr_t zend_intptr_t;
typedef uintptr_t zend_uintptr_t;
#endif

View File

@ -258,9 +258,9 @@ static void detect_is_seekable(php_stdio_stream_data *self) {
self->is_pipe = S_ISFIFO(self->sb.st_mode);
}
#elif defined(PHP_WIN32)
zend_uintptr_t handle = _get_osfhandle(self->fd);
uintptr_t handle = _get_osfhandle(self->fd);
if (handle != (zend_uintptr_t)INVALID_HANDLE_VALUE) {
if (handle != (uintptr_t)INVALID_HANDLE_VALUE) {
DWORD file_type = GetFileType((HANDLE)handle);
self->is_seekable = !(file_type == FILE_TYPE_PIPE || file_type == FILE_TYPE_CHAR);
@ -733,7 +733,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
return -1;
}
if ((zend_uintptr_t) ptrparam == PHP_STREAM_LOCK_SUPPORTED) {
if ((uintptr_t) ptrparam == PHP_STREAM_LOCK_SUPPORTED) {
return 0;
}

View File

@ -2,11 +2,8 @@
<def>
<podtype name="zend_long" sign="s" size="8" />
<podtype name="zend_ulong" sign="u" size="8" />
<podtype name="zend_bool" sign="u" size="1" />
<podtype name="zend_uchar" sign="u" size="1" />
<podtype name="zend_off_t" sign="s" size="8" />
<podtype name="zend_intptr_t" sign="s" size="8" />
<podtype name="zend_uintptr_t" sign="s" size="8" />
<!--
<memory>
<alloc init="true"></alloc>

View File

@ -3,10 +3,7 @@
<podtype name="zend_long" sign="s" size="4" />
<podtype name="zend_ulong" sign="u" size="4" />
<podtype name="zend_off_t" sign="s" size="4" />
<podtype name="zend_bool" sign="u" size="1" />
<podtype name="zend_uchar" sign="u" size="1" />
<podtype name="zend_intptr_t" sign="s" size="4" />
<podtype name="zend_uintptr_t" sign="s" size="4" />
<!--

View File

@ -62,7 +62,7 @@ PHPAPI int php_select(php_socket_t max_fd, fd_set *rfds, fd_set *wfds, fd_set *e
/* build an array of handles for non-sockets */
for (i = 0; (uint32_t)i < max_fd; i++) {
if (SAFE_FD_ISSET(i, rfds) || SAFE_FD_ISSET(i, wfds) || SAFE_FD_ISSET(i, efds)) {
handles[n_handles] = (HANDLE)(zend_uintptr_t)_get_osfhandle(i);
handles[n_handles] = (HANDLE)(uintptr_t)_get_osfhandle(i);
if (handles[n_handles] == INVALID_HANDLE_VALUE) {
/* socket */
if (SAFE_FD_ISSET(i, rfds)) {