Fix -Wundef/C4668 warnings (#15853)

- ZTS is either undefined or defined (to 1)
- PHP_WIN32 is either undefined or defined (to 1)
- HAVE_LIBEDIT is either undefined or defined (to 1)
This commit is contained in:
Peter Kokot 2024-09-14 11:28:32 +02:00 committed by GitHub
parent f6a232cce2
commit 888eb370cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 7 additions and 7 deletions

View File

@ -2958,7 +2958,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
if (EG(active)) { // at run-time: this ought to only happen if registered with dl() or somehow temporarily at runtime
ZEND_MAP_PTR_INIT(internal_function->run_time_cache, zend_arena_calloc(&CG(arena), 1, zend_internal_run_time_cache_reserved_size()));
} else {
#if ZTS
#ifdef ZTS
ZEND_MAP_PTR_NEW_STATIC(internal_function->run_time_cache);
#else
ZEND_MAP_PTR_INIT(internal_function->run_time_cache, NULL);

View File

@ -421,7 +421,7 @@ static void zend_enum_register_func(zend_class_entry *ce, zend_known_string_id n
if (EG(active)) { // at run-time
ZEND_MAP_PTR_INIT(zif->run_time_cache, zend_arena_calloc(&CG(arena), 1, zend_internal_run_time_cache_reserved_size()));
} else {
#if ZTS
#ifdef ZTS
ZEND_MAP_PTR_NEW_STATIC(zif->run_time_cache);
#else
ZEND_MAP_PTR_INIT(zif->run_time_cache, NULL);

View File

@ -5393,7 +5393,7 @@ static zend_result ffi_fixup_temporaries(void) {
++zend_ffi_cast_fn.T;
++zend_ffi_type_fn.T;
}
#if !ZTS
#ifndef ZTS
ZEND_MAP_PTR(zend_ffi_new_fn.run_time_cache) = ZEND_MAP_PTR(((zend_internal_function *)zend_hash_str_find_ptr(&zend_ffi_ce->function_table, "new", sizeof("new")-1))->run_time_cache);
ZEND_MAP_PTR(zend_ffi_cast_fn.run_time_cache) = ZEND_MAP_PTR(((zend_internal_function *)zend_hash_str_find_ptr(&zend_ffi_ce->function_table, "cast", sizeof("cast")-1))->run_time_cache);
ZEND_MAP_PTR(zend_ffi_type_fn.run_time_cache) = ZEND_MAP_PTR(((zend_internal_function *)zend_hash_str_find_ptr(&zend_ffi_ce->function_table, "type", sizeof("type")-1))->run_time_cache);

View File

@ -4552,7 +4552,7 @@ static struct jit_observer_fcall_is_unobserved_data jit_observer_fcall_is_unobse
if (func && (func->common.fn_flags & ZEND_ACC_CLOSURE) == 0 && ZEND_MAP_PTR_IS_OFFSET(func->common.run_time_cache)) {
// JIT: ZEND_MAP_PTR_GET_IMM(func->common.runtime_cache)
run_time_cache = ir_LOAD_A(ir_ADD_OFFSET(ir_LOAD_A(jit_CG(map_ptr_base)), (uintptr_t)ZEND_MAP_PTR(func->common.run_time_cache)));
#if !ZTS
#ifndef ZTS
} else if (func && rx == IS_UNUSED) { // happens for internal functions only
ZEND_ASSERT(!ZEND_USER_CODE(func->type));
run_time_cache = ir_LOAD_A(ir_ADD_OFFSET(ir_CONST_ADDR(func), offsetof(zend_op_array, run_time_cache__ptr)));

View File

@ -186,7 +186,7 @@ PHP_FUNCTION(readline_info)
if (!try_convert_to_string(value)) {
RETURN_THROWS();
}
#if !defined(PHP_WIN32) && !HAVE_LIBEDIT
#if !defined(PHP_WIN32) && !defined(HAVE_LIBEDIT)
if (!rl_line_buffer) {
rl_line_buffer = malloc(Z_STRLEN_P(value) + 1);
} else if (strlen(oldstr) < Z_STRLEN_P(value)) {

View File

@ -1276,7 +1276,7 @@ static zend_result xmlreader_fixup_temporaries(void) {
++xmlreader_open_fn.T;
++xmlreader_xml_fn.T;
}
#if !ZTS
#ifndef ZTS
ZEND_MAP_PTR(xmlreader_open_fn.run_time_cache) = ZEND_MAP_PTR(((zend_internal_function *)zend_hash_str_find_ptr(&xmlreader_class_entry->function_table, "open", sizeof("open")-1))->run_time_cache);
ZEND_MAP_PTR(xmlreader_xml_fn.run_time_cache) = ZEND_MAP_PTR(((zend_internal_function *)zend_hash_str_find_ptr(&xmlreader_class_entry->function_table, "xml", sizeof("xml")-1))->run_time_cache);
#endif

View File

@ -207,7 +207,7 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka
} else {
php_error_docref(NULL, E_WARNING, "php_network_getaddresses: getaddrinfo for %s failed: %s", host, gai_error);
}
# if PHP_WIN32
# ifdef PHP_WIN32
php_win32_error_msg_free(gai_error);
# endif
return 0;