Skip to content

Commit 84a0da1

Browse files
authored
Sync #if/ifdef/defined (#14508)
This syncs CPP macro conditions: - _WIN32 - _WIN64 - HAVE_ALLOCA_H - HAVE_ALPHASORT - HAVE_ARPA_INET_H - HAVE_CONFIG_H - HAVE_DIRENT_H - HAVE_DLFCN_H - HAVE_GETTIMEOFDAY - HAVE_LIBDL - HAVE_POLL_H - HAVE_PWD_H - HAVE_SCANDIR - HAVE_SYS_FILE_H - HAVE_SYS_PARAM_H - HAVE_SYS_SOCKET_H - HAVE_SYS_TIME_H - HAVE_SYS_TYPES_H - HAVE_SYS_WAIT_H - HAVE_UNISTD_H - PHP_WIN32 - ZEND_WIN32 These are either undefined or defined to 1 in Autotools and Windows. Follow up of GH-5526 (-Wundef).
1 parent 52f6e09 commit 84a0da1

32 files changed

+76
-80
lines changed

Zend/zend_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3346,7 +3346,7 @@ void module_destructor(zend_module_entry *module) /* {{{ */
33463346

33473347
void module_registry_unload(const zend_module_entry *module)
33483348
{
3349-
#if HAVE_LIBDL
3349+
#ifdef HAVE_LIBDL
33503350
if (!getenv("ZEND_DONT_UNLOAD_MODULES")) {
33513351
DL_UNLOAD(module->handle);
33523352
}

Zend/zend_virtual_cwd.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
#include <stdarg.h>
3333
#include <limits.h>
3434

35-
#if HAVE_SYS_PARAM_H
35+
#ifdef HAVE_SYS_PARAM_H
3636
# include <sys/param.h>
3737
#endif
3838

3939
#ifndef MAXPATHLEN
40-
# if _WIN32
40+
# ifdef _WIN32
4141
# include "win32/ioutil.h"
4242
# define MAXPATHLEN PHP_WIN32_IOUTIL_MAXPATHLEN
4343
# elif PATH_MAX

ext/date/php_date.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2381,7 +2381,7 @@ static void php_date_set_time_fraction(timelib_time *time, int microsecond)
23812381

23822382
static void php_date_get_current_time_with_fraction(time_t *sec, suseconds_t *usec)
23832383
{
2384-
#if HAVE_GETTIMEOFDAY
2384+
#ifdef HAVE_GETTIMEOFDAY
23852385
struct timeval tp = {0}; /* For setting microsecond */
23862386

23872387
gettimeofday(&tp, NULL);

ext/dba/libflatfile/flatfile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <stdlib.h>
3030
#include <string.h>
3131
#include <errno.h>
32-
#if HAVE_UNISTD_H
32+
#ifdef HAVE_UNISTD_H
3333
#include <unistd.h>
3434
#endif
3535

ext/dba/libinifile/inifile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <stdlib.h>
2727
#include <string.h>
2828
#include <errno.h>
29-
#if HAVE_UNISTD_H
29+
#ifdef HAVE_UNISTD_H
3030
#include <unistd.h>
3131
#endif
3232

ext/dom/html_document.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ PHP_METHOD(Dom_HTMLDocument, createFromFile)
11141114
xmlFree(converted);
11151115
lxml_doc->URL = new_buffer;
11161116
} else {
1117-
#if PHP_WIN32
1117+
#ifdef PHP_WIN32
11181118
converted = php_dom_libxml_fix_file_path(converted);
11191119
#endif
11201120
lxml_doc->URL = converted;

ext/dom/xml_document.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ PHP_METHOD(Dom_XMLDocument, createEmpty)
101101
zend_argument_value_error(2, "is not a valid document encoding");
102102
RETURN_THROWS();
103103
}
104-
104+
105105
xmlDocPtr lxml_doc = xmlNewDoc((const xmlChar *) version);
106106
if (UNEXPECTED(lxml_doc == NULL)) {
107107
goto oom;
@@ -197,7 +197,7 @@ static void load_from_helper(INTERNAL_FUNCTION_PARAMETERS, int mode)
197197
if (!php_is_stream_path((char *) lxml_doc->URL)) {
198198
/* Check for "file:/" instead of "file://" because of libxml2 quirk */
199199
if (strncmp((const char *) lxml_doc->URL, "file:/", sizeof("file:/") - 1) != 0) {
200-
#if PHP_WIN32
200+
#ifdef PHP_WIN32
201201
xmlChar *buffer = xmlStrdup((const xmlChar *) "file:///");
202202
#else
203203
xmlChar *buffer = xmlStrdup((const xmlChar *) "file://");
@@ -212,7 +212,7 @@ static void load_from_helper(INTERNAL_FUNCTION_PARAMETERS, int mode)
212212
}
213213
}
214214
} else {
215-
#if PHP_WIN32
215+
#ifdef PHP_WIN32
216216
lxml_doc->URL = php_dom_libxml_fix_file_path(BAD_CAST lxml_doc->URL);
217217
#endif
218218
}

ext/opcache/ZendAccelerator.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ static int zend_get_stream_timestamp(const char *filename, zend_stat_t *statbuf)
962962
return SUCCESS;
963963
}
964964

965-
#if ZEND_WIN32
965+
#ifdef ZEND_WIN32
966966
static accel_time_t zend_get_file_handle_timestamp_win(zend_file_handle *file_handle, size_t *size)
967967
{
968968
static unsigned __int64 utc_base = 0;
@@ -2177,7 +2177,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
21772177
HANDLE_UNBLOCK_INTERRUPTIONS();
21782178
} else {
21792179

2180-
#if !ZEND_WIN32
2180+
#ifndef ZEND_WIN32
21812181
ZCSG(hits)++; /* TBFixed: may lose one hit */
21822182
persistent_script->dynamic_members.hits++; /* see above */
21832183
#else

ext/opcache/ZendAccelerator.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@
3636
/* 8 - Standalone Open Source Zend OPcache */
3737
#define ACCELERATOR_API_NO 8
3838

39-
#if ZEND_WIN32
39+
#ifdef ZEND_WIN32
4040
# include "zend_config.w32.h"
4141
#else
4242
#include "zend_config.h"
4343
# include <sys/time.h>
4444
# include <sys/resource.h>
4545
#endif
4646

47-
#if HAVE_UNISTD_H
47+
#ifdef HAVE_UNISTD_H
4848
# include "unistd.h"
4949
#endif
5050

@@ -97,7 +97,7 @@ extern int lock_file;
9797
# define ENABLE_FILE_CACHE_FALLBACK 0
9898
#endif
9999

100-
#if ZEND_WIN32
100+
#ifdef ZEND_WIN32
101101
typedef unsigned __int64 accel_time_t;
102102
#else
103103
typedef time_t accel_time_t;

ext/opcache/jit/zend_jit.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ static bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string *memb
691691
# pragma clang diagnostic pop
692692
#endif
693693

694-
#if _WIN32
694+
#ifdef _WIN32
695695
# include <Windows.h>
696696
#else
697697
# include <sys/mman.h>
@@ -3246,7 +3246,7 @@ ZEND_EXT_API void zend_jit_unprotect(void)
32463246
fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
32473247
}
32483248
}
3249-
#elif _WIN32
3249+
#elif defined(_WIN32)
32503250
if (!(JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
32513251
DWORD old, new;
32523252
#ifdef ZTS
@@ -3277,7 +3277,7 @@ ZEND_EXT_API void zend_jit_protect(void)
32773277
fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
32783278
}
32793279
}
3280-
#elif _WIN32
3280+
#elif defined(_WIN32)
32813281
if (!(JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
32823282
DWORD old;
32833283

@@ -3520,7 +3520,7 @@ ZEND_EXT_API void zend_jit_startup(void *buf, size_t size, bool reattached)
35203520
fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
35213521
}
35223522
}
3523-
#elif _WIN32
3523+
#elif defined(_WIN32)
35243524
if (JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP)) {
35253525
DWORD old;
35263526

0 commit comments

Comments
 (0)