Skip to content

Sync #if/ifdef/defined #14520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_operators.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_virtual_cwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions Zend/zend_virtual_cwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ext/iconv/iconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion ext/odbc/php_odbc_includes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions ext/opcache/zend_accelerator_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion ext/opcache/zend_file_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion ext/random/csprng.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

#if 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
Expand Down
10 changes: 5 additions & 5 deletions ext/readline/readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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

Expand All @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions ext/readline/readline.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand All @@ -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
32 changes: 16 additions & 16 deletions ext/readline/readline_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ext/sockets/multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion main/streams/userspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#endif
#include <stddef.h>

#if HAVE_UTIME
#ifdef HAVE_UTIME
# ifdef PHP_WIN32
# include <sys/utime.h>
# else
Expand Down
4 changes: 2 additions & 2 deletions sapi/cli/php_cli_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: ".";
Expand Down
Loading