Skip to content

Commit 5d3fab9

Browse files
authored
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)
1 parent 45714e2 commit 5d3fab9

File tree

15 files changed

+44
-44
lines changed

15 files changed

+44
-44
lines changed

Zend/zend_compile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8857,9 +8857,9 @@ static bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast) /* {{{ */
88578857

88588858
if (zend_string_equals_literal(dirname, ".")) {
88598859
dirname = zend_string_extend(dirname, MAXPATHLEN, 0);
8860-
#if HAVE_GETCWD
8860+
#ifdef HAVE_GETCWD
88618861
ZEND_IGNORE_VALUE(VCWD_GETCWD(ZSTR_VAL(dirname), MAXPATHLEN));
8862-
#elif HAVE_GETWD
8862+
#elif defined(HAVE_GETWD)
88638863
ZEND_IGNORE_VALUE(VCWD_GETWD(ZSTR_VAL(dirname)));
88648864
#endif
88658865
ZSTR_LEN(dirname) = strlen(ZSTR_VAL(dirname));

Zend/zend_operators.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2859,7 +2859,7 @@ ZEND_API void zend_update_current_locale(void) /* {{{ */
28592859
#elif defined(MB_CUR_MAX)
28602860
/* Check if current locale uses variable width encoding */
28612861
if (MB_CUR_MAX > 1) {
2862-
#if HAVE_NL_LANGINFO
2862+
#ifdef HAVE_NL_LANGINFO
28632863
const char *charmap = nl_langinfo(CODESET);
28642864
#else
28652865
char buf[16];

Zend/zend_virtual_cwd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,7 @@ CWD_API int virtual_access(const char *pathname, int mode) /* {{{ */
13541354
}
13551355
/* }}} */
13561356

1357-
#if HAVE_UTIME
1357+
#ifdef HAVE_UTIME
13581358
CWD_API int virtual_utime(const char *filename, struct utimbuf *buf) /* {{{ */
13591359
{
13601360
cwd_state new_state;
@@ -1425,7 +1425,7 @@ CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int li
14251425
}
14261426

14271427
if (link) {
1428-
#if HAVE_LCHOWN
1428+
#ifdef HAVE_LCHOWN
14291429
ret = lchown(new_state.cwd, owner, group);
14301430
#else
14311431
ret = -1;

Zend/zend_virtual_cwd.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ CWD_API DIR *virtual_opendir(const char *pathname);
190190
CWD_API FILE *virtual_popen(const char *command, const char *type);
191191
CWD_API int virtual_access(const char *pathname, int mode);
192192

193-
#if HAVE_UTIME
193+
#ifdef HAVE_UTIME
194194
CWD_API int virtual_utime(const char *filename, struct utimbuf *buf);
195195
#endif
196196
CWD_API int virtual_chmod(const char *filename, mode_t mode);
@@ -284,13 +284,13 @@ extern void virtual_cwd_main_cwd_init(uint8_t);
284284
#define VCWD_OPENDIR(pathname) virtual_opendir(pathname)
285285
#define VCWD_POPEN(command, type) virtual_popen(command, type)
286286
#define VCWD_ACCESS(pathname, mode) virtual_access(pathname, mode)
287-
#if HAVE_UTIME
287+
#ifdef HAVE_UTIME
288288
#define VCWD_UTIME(path, time) virtual_utime(path, time)
289289
#endif
290290
#define VCWD_CHMOD(path, mode) virtual_chmod(path, mode)
291291
#if !defined(ZEND_WIN32)
292292
#define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group, 0)
293-
#if HAVE_LCHOWN
293+
#ifdef HAVE_LCHOWN
294294
#define VCWD_LCHOWN(path, owner, group) virtual_chown(path, owner, group, 1)
295295
#endif
296296
#endif
@@ -335,7 +335,7 @@ extern void virtual_cwd_main_cwd_init(uint8_t);
335335

336336
#define VCWD_REALPATH(path, real_path) tsrm_realpath(path, real_path)
337337

338-
#if HAVE_UTIME
338+
#ifdef HAVE_UTIME
339339
# ifdef ZEND_WIN32
340340
# define VCWD_UTIME(path, time) win32_utime(path, time)
341341
# else
@@ -345,7 +345,7 @@ extern void virtual_cwd_main_cwd_init(uint8_t);
345345

346346
#if !defined(ZEND_WIN32)
347347
#define VCWD_CHOWN(path, owner, group) chown(path, owner, group)
348-
#if HAVE_LCHOWN
348+
#ifdef HAVE_LCHOWN
349349
#define VCWD_LCHOWN(path, owner, group) lchown(path, owner, group)
350350
#endif
351351
#endif

ext/iconv/iconv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static char *get_iconv_version(void) {
7070
static char buf[16];
7171
snprintf(buf, sizeof(buf), "%d.%d", _libiconv_version >> 8, _libiconv_version & 0xff);
7272
version = buf;
73-
#elif HAVE_GLIBC_ICONV
73+
#elif defined(HAVE_GLIBC_ICONV)
7474
version = (char *) gnu_get_libc_version();
7575
#endif
7676

ext/odbc/php_odbc_includes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ typedef struct odbc_result {
220220
odbc_result_value *values;
221221
SQLSMALLINT numcols;
222222
SQLSMALLINT numparams;
223-
# if HAVE_SQL_EXTENDED_FETCH
223+
# ifdef HAVE_SQL_EXTENDED_FETCH
224224
int fetch_abs;
225225
# endif
226226
zend_long longreadlen;

ext/opcache/zend_accelerator_module.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "ext/date/php_date.h"
3535
#include "opcache_arginfo.h"
3636

37-
#if HAVE_JIT
37+
#ifdef HAVE_JIT
3838
#include "jit/zend_jit.h"
3939
#endif
4040

@@ -480,7 +480,7 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
480480
} else {
481481
php_info_print_table_row(2, "File Cache", "Disabled");
482482
}
483-
#if HAVE_JIT
483+
#ifdef HAVE_JIT
484484
if (JIT_G(enabled)) {
485485
if (JIT_G(on)) {
486486
php_info_print_table_row(2, "JIT", "On");
@@ -758,7 +758,7 @@ ZEND_FUNCTION(opcache_get_status)
758758
add_assoc_zval(return_value, "scripts", &scripts);
759759
}
760760
}
761-
#if HAVE_JIT
761+
#ifdef HAVE_JIT
762762
zend_jit_status(return_value);
763763
#endif
764764
}

ext/opcache/zend_file_cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include "zend_accelerator_util_funcs.h"
3737
#include "zend_accelerator_hash.h"
3838

39-
#if HAVE_JIT
39+
#ifdef HAVE_JIT
4040
#include "jit/zend_jit.h"
4141
#endif
4242

ext/random/csprng.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
#ifdef HAVE_SYS_PARAM_H
4949
# include <sys/param.h>
50-
# if (__FreeBSD__ && __FreeBSD_version > 1200000) || (__DragonFly__ && __DragonFly_version >= 500700) || \
50+
# if (defined(__FreeBSD__) && __FreeBSD_version > 1200000) || (defined(__DragonFly__) && __DragonFly_version >= 500700) || \
5151
defined(__sun) || (defined(__NetBSD__) && __NetBSD_Version__ >= 1000000000) || defined(__midipix__)
5252
# include <sys/random.h>
5353
# endif

ext/readline/readline.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include <readline/history.h>
3939
#endif
4040

41-
#if HAVE_RL_CALLBACK_READ_CHAR
41+
#ifdef HAVE_RL_CALLBACK_READ_CHAR
4242

4343
static zval _prepped_callback;
4444

@@ -79,7 +79,7 @@ PHP_MINIT_FUNCTION(readline)
7979
using_history();
8080
#endif
8181
ZVAL_UNDEF(&_readline_completion);
82-
#if HAVE_RL_CALLBACK_READ_CHAR
82+
#ifdef HAVE_RL_CALLBACK_READ_CHAR
8383
ZVAL_UNDEF(&_prepped_callback);
8484
#endif
8585

@@ -97,7 +97,7 @@ PHP_RSHUTDOWN_FUNCTION(readline)
9797
{
9898
zval_ptr_dtor(&_readline_completion);
9999
ZVAL_UNDEF(&_readline_completion);
100-
#if HAVE_RL_CALLBACK_READ_CHAR
100+
#ifdef HAVE_RL_CALLBACK_READ_CHAR
101101
if (Z_TYPE(_prepped_callback) != IS_UNDEF) {
102102
rl_callback_handler_remove();
103103
zval_ptr_dtor(&_prepped_callback);
@@ -493,7 +493,7 @@ PHP_FUNCTION(readline_completion_function)
493493

494494
/* }}} */
495495

496-
#if HAVE_RL_CALLBACK_READ_CHAR
496+
#ifdef HAVE_RL_CALLBACK_READ_CHAR
497497

498498
static void php_rl_callback_handler(char *the_line)
499499
{
@@ -583,7 +583,7 @@ PHP_FUNCTION(readline_redisplay)
583583

584584
#endif
585585

586-
#if HAVE_RL_ON_NEW_LINE
586+
#ifdef HAVE_RL_ON_NEW_LINE
587587
/* {{{ Inform readline that the cursor has moved to a new line */
588588
PHP_FUNCTION(readline_on_new_line)
589589
{

ext/readline/readline.stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function readline_write_history(?string $filename = null): bool {}
3232
function readline_completion_function(callable $callback): bool {}
3333

3434

35-
#if HAVE_RL_CALLBACK_READ_CHAR
35+
#ifdef HAVE_RL_CALLBACK_READ_CHAR
3636
function readline_callback_handler_install(string $prompt, callable $callback): bool {}
3737

3838
function readline_callback_read_char(): void {}
@@ -41,7 +41,7 @@ function readline_callback_handler_remove(): bool {}
4141

4242
function readline_redisplay(): void {}
4343

44-
#if HAVE_RL_ON_NEW_LINE
44+
#ifdef HAVE_RL_ON_NEW_LINE
4545
function readline_on_new_line(): void {}
4646
#endif
4747
#endif

ext/readline/readline_arginfo.h

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/sockets/multicast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static int _php_mcast_source_op(php_socket *sock, int level, struct sockaddr *gr
5454

5555
#ifdef RFC3678_API
5656
static int _php_source_op_to_rfc3678_op(enum source_op sop);
57-
#elif HAS_MCAST_EXT
57+
#elif defined(HAS_MCAST_EXT)
5858
static const char *_php_source_op_to_string(enum source_op sop);
5959
static int _php_source_op_to_ipv4_op(enum source_op sop);
6060
#endif

main/streams/userspace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#endif
2525
#include <stddef.h>
2626

27-
#if HAVE_UTIME
27+
#ifdef HAVE_UTIME
2828
# ifdef PHP_WIN32
2929
# include <sys/utime.h>
3030
# else

sapi/cli/php_cli_server.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2840,9 +2840,9 @@ int do_cli_server(int argc, char **argv) /* {{{ */
28402840
} else {
28412841
char *ret = NULL;
28422842

2843-
#if HAVE_GETCWD
2843+
#ifdef HAVE_GETCWD
28442844
ret = VCWD_GETCWD(document_root_buf, MAXPATHLEN);
2845-
#elif HAVE_GETWD
2845+
#elif defined(HAVE_GETWD)
28462846
ret = VCWD_GETWD(document_root_buf);
28472847
#endif
28482848
document_root = ret ? document_root_buf: ".";

0 commit comments

Comments
 (0)