diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index a97c46ca914bd..c3417b91703cf 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -8857,9 +8857,9 @@ static bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast) /* {{{ */ if (zend_string_equals_literal(dirname, ".")) { dirname = zend_string_extend(dirname, MAXPATHLEN, 0); -#if HAVE_GETCWD +#ifdef HAVE_GETCWD ZEND_IGNORE_VALUE(VCWD_GETCWD(ZSTR_VAL(dirname), MAXPATHLEN)); -#elif HAVE_GETWD +#elif defined(HAVE_GETWD) ZEND_IGNORE_VALUE(VCWD_GETWD(ZSTR_VAL(dirname))); #endif ZSTR_LEN(dirname) = strlen(ZSTR_VAL(dirname)); diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index fc124d1b20999..5331244731cac 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -2859,7 +2859,7 @@ ZEND_API void zend_update_current_locale(void) /* {{{ */ #elif defined(MB_CUR_MAX) /* Check if current locale uses variable width encoding */ if (MB_CUR_MAX > 1) { -#if HAVE_NL_LANGINFO +#ifdef HAVE_NL_LANGINFO const char *charmap = nl_langinfo(CODESET); #else char buf[16]; diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index a35919d8c92e7..9de7efff04950 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -1354,7 +1354,7 @@ CWD_API int virtual_access(const char *pathname, int mode) /* {{{ */ } /* }}} */ -#if HAVE_UTIME +#ifdef HAVE_UTIME CWD_API int virtual_utime(const char *filename, struct utimbuf *buf) /* {{{ */ { cwd_state new_state; @@ -1425,7 +1425,7 @@ CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int li } if (link) { -#if HAVE_LCHOWN +#ifdef HAVE_LCHOWN ret = lchown(new_state.cwd, owner, group); #else ret = -1; diff --git a/Zend/zend_virtual_cwd.h b/Zend/zend_virtual_cwd.h index acfb5c46c60e0..4d541ea0c94a3 100644 --- a/Zend/zend_virtual_cwd.h +++ b/Zend/zend_virtual_cwd.h @@ -190,7 +190,7 @@ CWD_API DIR *virtual_opendir(const char *pathname); CWD_API FILE *virtual_popen(const char *command, const char *type); CWD_API int virtual_access(const char *pathname, int mode); -#if HAVE_UTIME +#ifdef HAVE_UTIME CWD_API int virtual_utime(const char *filename, struct utimbuf *buf); #endif CWD_API int virtual_chmod(const char *filename, mode_t mode); @@ -284,13 +284,13 @@ extern void virtual_cwd_main_cwd_init(uint8_t); #define VCWD_OPENDIR(pathname) virtual_opendir(pathname) #define VCWD_POPEN(command, type) virtual_popen(command, type) #define VCWD_ACCESS(pathname, mode) virtual_access(pathname, mode) -#if HAVE_UTIME +#ifdef HAVE_UTIME #define VCWD_UTIME(path, time) virtual_utime(path, time) #endif #define VCWD_CHMOD(path, mode) virtual_chmod(path, mode) #if !defined(ZEND_WIN32) #define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group, 0) -#if HAVE_LCHOWN +#ifdef HAVE_LCHOWN #define VCWD_LCHOWN(path, owner, group) virtual_chown(path, owner, group, 1) #endif #endif @@ -335,7 +335,7 @@ extern void virtual_cwd_main_cwd_init(uint8_t); #define VCWD_REALPATH(path, real_path) tsrm_realpath(path, real_path) -#if HAVE_UTIME +#ifdef HAVE_UTIME # ifdef ZEND_WIN32 # define VCWD_UTIME(path, time) win32_utime(path, time) # else @@ -345,7 +345,7 @@ extern void virtual_cwd_main_cwd_init(uint8_t); #if !defined(ZEND_WIN32) #define VCWD_CHOWN(path, owner, group) chown(path, owner, group) -#if HAVE_LCHOWN +#ifdef HAVE_LCHOWN #define VCWD_LCHOWN(path, owner, group) lchown(path, owner, group) #endif #endif diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index b5c8547196033..c1d85ffded7f7 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -70,7 +70,7 @@ static char *get_iconv_version(void) { static char buf[16]; snprintf(buf, sizeof(buf), "%d.%d", _libiconv_version >> 8, _libiconv_version & 0xff); version = buf; -#elif HAVE_GLIBC_ICONV +#elif defined(HAVE_GLIBC_ICONV) version = (char *) gnu_get_libc_version(); #endif diff --git a/ext/odbc/php_odbc_includes.h b/ext/odbc/php_odbc_includes.h index 88b9c98ab012d..59404ecd266ba 100644 --- a/ext/odbc/php_odbc_includes.h +++ b/ext/odbc/php_odbc_includes.h @@ -220,7 +220,7 @@ typedef struct odbc_result { odbc_result_value *values; SQLSMALLINT numcols; SQLSMALLINT numparams; -# if HAVE_SQL_EXTENDED_FETCH +# ifdef HAVE_SQL_EXTENDED_FETCH int fetch_abs; # endif zend_long longreadlen; diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index f688126cdf4f7..b459bfe337a19 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -34,7 +34,7 @@ #include "ext/date/php_date.h" #include "opcache_arginfo.h" -#if HAVE_JIT +#ifdef HAVE_JIT #include "jit/zend_jit.h" #endif @@ -480,7 +480,7 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS) } else { php_info_print_table_row(2, "File Cache", "Disabled"); } -#if HAVE_JIT +#ifdef HAVE_JIT if (JIT_G(enabled)) { if (JIT_G(on)) { php_info_print_table_row(2, "JIT", "On"); @@ -758,7 +758,7 @@ ZEND_FUNCTION(opcache_get_status) add_assoc_zval(return_value, "scripts", &scripts); } } -#if HAVE_JIT +#ifdef HAVE_JIT zend_jit_status(return_value); #endif } diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index 31fae17267159..90408b5da8cd9 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -36,7 +36,7 @@ #include "zend_accelerator_util_funcs.h" #include "zend_accelerator_hash.h" -#if HAVE_JIT +#ifdef HAVE_JIT #include "jit/zend_jit.h" #endif diff --git a/ext/random/csprng.c b/ext/random/csprng.c index fca8a50539cf4..cdaa7998f2751 100644 --- a/ext/random/csprng.c +++ b/ext/random/csprng.c @@ -47,7 +47,7 @@ #if HAVE_SYS_PARAM_H # include -# if (__FreeBSD__ && __FreeBSD_version > 1200000) || (__DragonFly__ && __DragonFly_version >= 500700) || \ +# if (defined(__FreeBSD__) && __FreeBSD_version > 1200000) || (defined(__DragonFly__) && __DragonFly_version >= 500700) || \ defined(__sun) || (defined(__NetBSD__) && __NetBSD_Version__ >= 1000000000) || defined(__midipix__) # include # endif diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 1bd5e2fd6059a..e41f49e844d9a 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -38,7 +38,7 @@ #include #endif -#if HAVE_RL_CALLBACK_READ_CHAR +#ifdef HAVE_RL_CALLBACK_READ_CHAR static zval _prepped_callback; @@ -79,7 +79,7 @@ PHP_MINIT_FUNCTION(readline) using_history(); #endif ZVAL_UNDEF(&_readline_completion); -#if HAVE_RL_CALLBACK_READ_CHAR +#ifdef HAVE_RL_CALLBACK_READ_CHAR ZVAL_UNDEF(&_prepped_callback); #endif @@ -97,7 +97,7 @@ PHP_RSHUTDOWN_FUNCTION(readline) { zval_ptr_dtor(&_readline_completion); ZVAL_UNDEF(&_readline_completion); -#if HAVE_RL_CALLBACK_READ_CHAR +#ifdef HAVE_RL_CALLBACK_READ_CHAR if (Z_TYPE(_prepped_callback) != IS_UNDEF) { rl_callback_handler_remove(); zval_ptr_dtor(&_prepped_callback); @@ -493,7 +493,7 @@ PHP_FUNCTION(readline_completion_function) /* }}} */ -#if HAVE_RL_CALLBACK_READ_CHAR +#ifdef HAVE_RL_CALLBACK_READ_CHAR static void php_rl_callback_handler(char *the_line) { @@ -583,7 +583,7 @@ PHP_FUNCTION(readline_redisplay) #endif -#if HAVE_RL_ON_NEW_LINE +#ifdef HAVE_RL_ON_NEW_LINE /* {{{ Inform readline that the cursor has moved to a new line */ PHP_FUNCTION(readline_on_new_line) { diff --git a/ext/readline/readline.stub.php b/ext/readline/readline.stub.php index 0e0db92af07c0..0b31b09006d96 100644 --- a/ext/readline/readline.stub.php +++ b/ext/readline/readline.stub.php @@ -32,7 +32,7 @@ function readline_write_history(?string $filename = null): bool {} function readline_completion_function(callable $callback): bool {} -#if HAVE_RL_CALLBACK_READ_CHAR +#ifdef HAVE_RL_CALLBACK_READ_CHAR function readline_callback_handler_install(string $prompt, callable $callback): bool {} function readline_callback_read_char(): void {} @@ -41,7 +41,7 @@ function readline_callback_handler_remove(): bool {} function readline_redisplay(): void {} -#if HAVE_RL_ON_NEW_LINE +#ifdef HAVE_RL_ON_NEW_LINE function readline_on_new_line(): void {} #endif #endif diff --git a/ext/readline/readline_arginfo.h b/ext/readline/readline_arginfo.h index d2c4b1214db93..6726ef4514954 100644 --- a/ext/readline/readline_arginfo.h +++ b/ext/readline/readline_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 64d630be9ea75d584a4a999dd4d4c6bc769f5aca */ + * Stub hash: 7b72b1af4217ac8647096cb7e2c239466949cbd2 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_readline, 0, 0, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, prompt, IS_STRING, 1, "null") @@ -32,28 +32,28 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_completion_function, 0, ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0) ZEND_END_ARG_INFO() -#if HAVE_RL_CALLBACK_READ_CHAR +#if defined(HAVE_RL_CALLBACK_READ_CHAR) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_callback_handler_install, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, prompt, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0) ZEND_END_ARG_INFO() #endif -#if HAVE_RL_CALLBACK_READ_CHAR +#if defined(HAVE_RL_CALLBACK_READ_CHAR) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_callback_read_char, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() #endif -#if HAVE_RL_CALLBACK_READ_CHAR +#if defined(HAVE_RL_CALLBACK_READ_CHAR) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_callback_handler_remove, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() #endif -#if HAVE_RL_CALLBACK_READ_CHAR +#if defined(HAVE_RL_CALLBACK_READ_CHAR) #define arginfo_readline_redisplay arginfo_readline_callback_read_char #endif -#if HAVE_RL_CALLBACK_READ_CHAR && HAVE_RL_ON_NEW_LINE +#if defined(HAVE_RL_CALLBACK_READ_CHAR) && defined(HAVE_RL_ON_NEW_LINE) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_on_new_line, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() #endif @@ -68,19 +68,19 @@ ZEND_FUNCTION(readline_list_history); ZEND_FUNCTION(readline_read_history); ZEND_FUNCTION(readline_write_history); ZEND_FUNCTION(readline_completion_function); -#if HAVE_RL_CALLBACK_READ_CHAR +#if defined(HAVE_RL_CALLBACK_READ_CHAR) ZEND_FUNCTION(readline_callback_handler_install); #endif -#if HAVE_RL_CALLBACK_READ_CHAR +#if defined(HAVE_RL_CALLBACK_READ_CHAR) ZEND_FUNCTION(readline_callback_read_char); #endif -#if HAVE_RL_CALLBACK_READ_CHAR +#if defined(HAVE_RL_CALLBACK_READ_CHAR) ZEND_FUNCTION(readline_callback_handler_remove); #endif -#if HAVE_RL_CALLBACK_READ_CHAR +#if defined(HAVE_RL_CALLBACK_READ_CHAR) ZEND_FUNCTION(readline_redisplay); #endif -#if HAVE_RL_CALLBACK_READ_CHAR && HAVE_RL_ON_NEW_LINE +#if defined(HAVE_RL_CALLBACK_READ_CHAR) && defined(HAVE_RL_ON_NEW_LINE) ZEND_FUNCTION(readline_on_new_line); #endif @@ -95,19 +95,19 @@ static const zend_function_entry ext_functions[] = { ZEND_FE(readline_read_history, arginfo_readline_read_history) ZEND_FE(readline_write_history, arginfo_readline_write_history) ZEND_FE(readline_completion_function, arginfo_readline_completion_function) -#if HAVE_RL_CALLBACK_READ_CHAR +#if defined(HAVE_RL_CALLBACK_READ_CHAR) ZEND_FE(readline_callback_handler_install, arginfo_readline_callback_handler_install) #endif -#if HAVE_RL_CALLBACK_READ_CHAR +#if defined(HAVE_RL_CALLBACK_READ_CHAR) ZEND_FE(readline_callback_read_char, arginfo_readline_callback_read_char) #endif -#if HAVE_RL_CALLBACK_READ_CHAR +#if defined(HAVE_RL_CALLBACK_READ_CHAR) ZEND_FE(readline_callback_handler_remove, arginfo_readline_callback_handler_remove) #endif -#if HAVE_RL_CALLBACK_READ_CHAR +#if defined(HAVE_RL_CALLBACK_READ_CHAR) ZEND_FE(readline_redisplay, arginfo_readline_redisplay) #endif -#if HAVE_RL_CALLBACK_READ_CHAR && HAVE_RL_ON_NEW_LINE +#if defined(HAVE_RL_CALLBACK_READ_CHAR) && defined(HAVE_RL_ON_NEW_LINE) ZEND_FE(readline_on_new_line, arginfo_readline_on_new_line) #endif ZEND_FE_END diff --git a/ext/sockets/multicast.c b/ext/sockets/multicast.c index 4d13b9e94ca3f..a348aa14b556c 100644 --- a/ext/sockets/multicast.c +++ b/ext/sockets/multicast.c @@ -54,7 +54,7 @@ static int _php_mcast_source_op(php_socket *sock, int level, struct sockaddr *gr #ifdef RFC3678_API static int _php_source_op_to_rfc3678_op(enum source_op sop); -#elif HAS_MCAST_EXT +#elif defined(HAS_MCAST_EXT) static const char *_php_source_op_to_string(enum source_op sop); static int _php_source_op_to_ipv4_op(enum source_op sop); #endif diff --git a/main/streams/userspace.c b/main/streams/userspace.c index d765448d7a636..bce9ed3a6c483 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -24,7 +24,7 @@ #endif #include -#if HAVE_UTIME +#ifdef HAVE_UTIME # ifdef PHP_WIN32 # include # else diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 36bfb26eb0f92..9a8e1183e4c3f 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -2840,9 +2840,9 @@ int do_cli_server(int argc, char **argv) /* {{{ */ } else { char *ret = NULL; -#if HAVE_GETCWD +#ifdef HAVE_GETCWD ret = VCWD_GETCWD(document_root_buf, MAXPATHLEN); -#elif HAVE_GETWD +#elif defined(HAVE_GETWD) ret = VCWD_GETWD(document_root_buf); #endif document_root = ret ? document_root_buf: ".";