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

Sync #if/ifdef/defined (#14520)

These are either undefined or defined (to value 1):
- __DragonFly__
- __FreeBSD__
- HAS_MCAST_EXT
- HAVE_GETCWD
- HAVE_GETWD
- HAVE_GLIBC_ICONV
- HAVE_JIT
- HAVE_LCHOWN
- HAVE_NL_LANGINFO
- HAVE_RL_CALLBACK_READ_CHAR
- HAVE_RL_ON_NEW_LINE
- HAVE_SQL_EXTENDED_FETCH
- HAVE_UTIME

Follow up of GH-5526 (-Wundef)
This commit is contained in:
Peter Kokot
2024-06-11 22:47:05 +02:00
committed by GitHub
parent 45714e2cb8
commit 5d3fab9334
15 changed files with 44 additions and 44 deletions

View File

@@ -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));

View File

@@ -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];

View File

@@ -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;

View File

@@ -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

View File

@@ -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

View File

@@ -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;

View File

@@ -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
}

View File

@@ -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

View File

@@ -47,7 +47,7 @@
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
# 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 <sys/random.h>
# endif

View File

@@ -38,7 +38,7 @@
#include <readline/history.h>
#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)
{

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -24,7 +24,7 @@
#endif
#include <stddef.h>
#if HAVE_UTIME
#ifdef HAVE_UTIME
# ifdef PHP_WIN32
# include <sys/utime.h>
# else

View File

@@ -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: ".";