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).
This commit is contained in:
Peter Kokot 2024-06-09 14:23:41 +02:00 committed by GitHub
parent 52f6e099b0
commit 84a0da1574
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 76 additions and 80 deletions

View File

@ -3346,7 +3346,7 @@ void module_destructor(zend_module_entry *module) /* {{{ */
void module_registry_unload(const zend_module_entry *module) void module_registry_unload(const zend_module_entry *module)
{ {
#if HAVE_LIBDL #ifdef HAVE_LIBDL
if (!getenv("ZEND_DONT_UNLOAD_MODULES")) { if (!getenv("ZEND_DONT_UNLOAD_MODULES")) {
DL_UNLOAD(module->handle); DL_UNLOAD(module->handle);
} }

View File

@ -32,12 +32,12 @@
#include <stdarg.h> #include <stdarg.h>
#include <limits.h> #include <limits.h>
#if HAVE_SYS_PARAM_H #ifdef HAVE_SYS_PARAM_H
# include <sys/param.h> # include <sys/param.h>
#endif #endif
#ifndef MAXPATHLEN #ifndef MAXPATHLEN
# if _WIN32 # ifdef _WIN32
# include "win32/ioutil.h" # include "win32/ioutil.h"
# define MAXPATHLEN PHP_WIN32_IOUTIL_MAXPATHLEN # define MAXPATHLEN PHP_WIN32_IOUTIL_MAXPATHLEN
# elif PATH_MAX # elif PATH_MAX

View File

@ -2381,7 +2381,7 @@ static void php_date_set_time_fraction(timelib_time *time, int microsecond)
static void php_date_get_current_time_with_fraction(time_t *sec, suseconds_t *usec) static void php_date_get_current_time_with_fraction(time_t *sec, suseconds_t *usec)
{ {
#if HAVE_GETTIMEOFDAY #ifdef HAVE_GETTIMEOFDAY
struct timeval tp = {0}; /* For setting microsecond */ struct timeval tp = {0}; /* For setting microsecond */
gettimeofday(&tp, NULL); gettimeofday(&tp, NULL);

View File

@ -29,7 +29,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#if HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif

View File

@ -26,7 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#if HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif

View File

@ -1114,7 +1114,7 @@ PHP_METHOD(Dom_HTMLDocument, createFromFile)
xmlFree(converted); xmlFree(converted);
lxml_doc->URL = new_buffer; lxml_doc->URL = new_buffer;
} else { } else {
#if PHP_WIN32 #ifdef PHP_WIN32
converted = php_dom_libxml_fix_file_path(converted); converted = php_dom_libxml_fix_file_path(converted);
#endif #endif
lxml_doc->URL = converted; lxml_doc->URL = converted;

View File

@ -101,7 +101,7 @@ PHP_METHOD(Dom_XMLDocument, createEmpty)
zend_argument_value_error(2, "is not a valid document encoding"); zend_argument_value_error(2, "is not a valid document encoding");
RETURN_THROWS(); RETURN_THROWS();
} }
xmlDocPtr lxml_doc = xmlNewDoc((const xmlChar *) version); xmlDocPtr lxml_doc = xmlNewDoc((const xmlChar *) version);
if (UNEXPECTED(lxml_doc == NULL)) { if (UNEXPECTED(lxml_doc == NULL)) {
goto oom; goto oom;
@ -197,7 +197,7 @@ static void load_from_helper(INTERNAL_FUNCTION_PARAMETERS, int mode)
if (!php_is_stream_path((char *) lxml_doc->URL)) { if (!php_is_stream_path((char *) lxml_doc->URL)) {
/* Check for "file:/" instead of "file://" because of libxml2 quirk */ /* Check for "file:/" instead of "file://" because of libxml2 quirk */
if (strncmp((const char *) lxml_doc->URL, "file:/", sizeof("file:/") - 1) != 0) { if (strncmp((const char *) lxml_doc->URL, "file:/", sizeof("file:/") - 1) != 0) {
#if PHP_WIN32 #ifdef PHP_WIN32
xmlChar *buffer = xmlStrdup((const xmlChar *) "file:///"); xmlChar *buffer = xmlStrdup((const xmlChar *) "file:///");
#else #else
xmlChar *buffer = xmlStrdup((const xmlChar *) "file://"); xmlChar *buffer = xmlStrdup((const xmlChar *) "file://");
@ -212,7 +212,7 @@ static void load_from_helper(INTERNAL_FUNCTION_PARAMETERS, int mode)
} }
} }
} else { } else {
#if PHP_WIN32 #ifdef PHP_WIN32
lxml_doc->URL = php_dom_libxml_fix_file_path(BAD_CAST lxml_doc->URL); lxml_doc->URL = php_dom_libxml_fix_file_path(BAD_CAST lxml_doc->URL);
#endif #endif
} }

View File

@ -962,7 +962,7 @@ static int zend_get_stream_timestamp(const char *filename, zend_stat_t *statbuf)
return SUCCESS; return SUCCESS;
} }
#if ZEND_WIN32 #ifdef ZEND_WIN32
static accel_time_t zend_get_file_handle_timestamp_win(zend_file_handle *file_handle, size_t *size) static accel_time_t zend_get_file_handle_timestamp_win(zend_file_handle *file_handle, size_t *size)
{ {
static unsigned __int64 utc_base = 0; static unsigned __int64 utc_base = 0;
@ -2177,7 +2177,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
HANDLE_UNBLOCK_INTERRUPTIONS(); HANDLE_UNBLOCK_INTERRUPTIONS();
} else { } else {
#if !ZEND_WIN32 #ifndef ZEND_WIN32
ZCSG(hits)++; /* TBFixed: may lose one hit */ ZCSG(hits)++; /* TBFixed: may lose one hit */
persistent_script->dynamic_members.hits++; /* see above */ persistent_script->dynamic_members.hits++; /* see above */
#else #else

View File

@ -36,7 +36,7 @@
/* 8 - Standalone Open Source Zend OPcache */ /* 8 - Standalone Open Source Zend OPcache */
#define ACCELERATOR_API_NO 8 #define ACCELERATOR_API_NO 8
#if ZEND_WIN32 #ifdef ZEND_WIN32
# include "zend_config.w32.h" # include "zend_config.w32.h"
#else #else
#include "zend_config.h" #include "zend_config.h"
@ -44,7 +44,7 @@
# include <sys/resource.h> # include <sys/resource.h>
#endif #endif
#if HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include "unistd.h" # include "unistd.h"
#endif #endif
@ -97,7 +97,7 @@ extern int lock_file;
# define ENABLE_FILE_CACHE_FALLBACK 0 # define ENABLE_FILE_CACHE_FALLBACK 0
#endif #endif
#if ZEND_WIN32 #ifdef ZEND_WIN32
typedef unsigned __int64 accel_time_t; typedef unsigned __int64 accel_time_t;
#else #else
typedef time_t accel_time_t; typedef time_t accel_time_t;

View File

@ -691,7 +691,7 @@ static bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string *memb
# pragma clang diagnostic pop # pragma clang diagnostic pop
#endif #endif
#if _WIN32 #ifdef _WIN32
# include <Windows.h> # include <Windows.h>
#else #else
# include <sys/mman.h> # include <sys/mman.h>
@ -3246,7 +3246,7 @@ ZEND_EXT_API void zend_jit_unprotect(void)
fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno)); fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
} }
} }
#elif _WIN32 #elif defined(_WIN32)
if (!(JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) { if (!(JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
DWORD old, new; DWORD old, new;
#ifdef ZTS #ifdef ZTS
@ -3277,7 +3277,7 @@ ZEND_EXT_API void zend_jit_protect(void)
fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno)); fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
} }
} }
#elif _WIN32 #elif defined(_WIN32)
if (!(JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) { if (!(JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
DWORD old; DWORD old;
@ -3520,7 +3520,7 @@ ZEND_EXT_API void zend_jit_startup(void *buf, size_t size, bool reattached)
fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno)); fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
} }
} }
#elif _WIN32 #elif defined(_WIN32)
if (JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP)) { if (JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP)) {
DWORD old; DWORD old;

View File

@ -3125,7 +3125,7 @@ static void zend_jit_calc_trace_prologue_size(void)
zend_jit_trace_prologue_size = size; zend_jit_trace_prologue_size = size;
} }
#if !ZEND_WIN32 && !defined(IR_TARGET_AARCH64) #if !defined(ZEND_WIN32) && !defined(IR_TARGET_AARCH64)
static uintptr_t zend_jit_hybrid_vm_sp_adj = 0; static uintptr_t zend_jit_hybrid_vm_sp_adj = 0;
typedef struct _Unwind_Context _Unwind_Context; typedef struct _Unwind_Context _Unwind_Context;
@ -3239,7 +3239,7 @@ static void zend_jit_setup(void)
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Could not enable JIT: offset >= size"); zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Could not enable JIT: offset >= size");
} }
} while(0); } while(0);
# elif ZEND_WIN32 # elif defined(ZEND_WIN32)
tsrm_tls_index = _tls_index * sizeof(void*); tsrm_tls_index = _tls_index * sizeof(void*);
/* To find offset of "_tsrm_ls_cache" in TLS segment we perform a linear scan of local TLS memory */ /* To find offset of "_tsrm_ls_cache" in TLS segment we perform a linear scan of local TLS memory */
@ -3339,7 +3339,7 @@ static void zend_jit_setup(void)
# endif # endif
#endif #endif
#if !ZEND_WIN32 && !defined(IR_TARGET_AARCH64) #if !defined(ZEND_WIN32) && !defined(IR_TARGET_AARCH64)
if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) { if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
zend_jit_set_sp_adj_vm(); // set zend_jit_hybrid_vm_sp_adj zend_jit_set_sp_adj_vm(); // set zend_jit_hybrid_vm_sp_adj
} }
@ -5441,7 +5441,7 @@ static int zend_jit_add_arrays(zend_jit_ctx *jit, const zend_op *opline, uint32_
static int zend_jit_long_math_helper(zend_jit_ctx *jit, static int zend_jit_long_math_helper(zend_jit_ctx *jit,
const zend_op *opline, const zend_op *opline,
uint8_t opcode, uint8_t opcode,
uint8_t op1_type, uint8_t op1_type,
znode_op op1, znode_op op1,
zend_jit_addr op1_addr, zend_jit_addr op1_addr,
uint32_t op1_info, uint32_t op1_info,
@ -7982,7 +7982,7 @@ static int zend_jit_type_check(zend_jit_ctx *jit, const zend_op *opline, uint32_
if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) { if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
mask = opline->extended_value; mask = opline->extended_value;
if (!(op1_info & MAY_BE_GUARD) && !(op1_info & (MAY_BE_ANY - mask))) { if (!(op1_info & MAY_BE_GUARD) && !(op1_info & (MAY_BE_ANY - mask))) {
jit_FREE_OP(jit, opline->op1_type, opline->op1, op1_info, opline); jit_FREE_OP(jit, opline->op1_type, opline->op1, op1_info, opline);
if (exit_addr) { if (exit_addr) {
if (smart_branch_opcode == ZEND_JMPNZ) { if (smart_branch_opcode == ZEND_JMPNZ) {
@ -11840,7 +11840,7 @@ static int zend_jit_fetch_dimension_address_inner(zend_jit_ctx *jit,
if (opline->op2_type != IS_CONST) { if (opline->op2_type != IS_CONST) {
ir_ref if_num, end1, ref2; ir_ref if_num, end1, ref2;
if_num = ir_IF( if_num = ir_IF(
ir_ULE( ir_ULE(
ir_LOAD_C(ir_ADD_OFFSET(key, offsetof(zend_string, val))), ir_LOAD_C(ir_ADD_OFFSET(key, offsetof(zend_string, val))),
ir_CONST_CHAR('9'))); ir_CONST_CHAR('9')));
@ -16030,7 +16030,7 @@ static void *zend_jit_finish(zend_jit_ctx *jit)
// ir_mem_unprotect(entry, size); // ir_mem_unprotect(entry, size);
if (!(jit->ctx.flags & IR_FUNCTION) if (!(jit->ctx.flags & IR_FUNCTION)
&& zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) { && zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
#if !ZEND_WIN32 && !defined(IR_TARGET_AARCH64) #if !defined(ZEND_WIN32) && !defined(IR_TARGET_AARCH64)
sp_offset = zend_jit_hybrid_vm_sp_adj; sp_offset = zend_jit_hybrid_vm_sp_adj;
#else #else
sp_offset = sizeof(void*); sp_offset = sizeof(void*);

View File

@ -323,7 +323,7 @@ ZEND_INI_BEGIN()
#ifndef ZEND_WIN32 #ifndef ZEND_WIN32
STD_PHP_INI_ENTRY("opcache.preload_user" , "" , PHP_INI_SYSTEM, OnUpdateStringUnempty, accel_directives.preload_user, zend_accel_globals, accel_globals) STD_PHP_INI_ENTRY("opcache.preload_user" , "" , PHP_INI_SYSTEM, OnUpdateStringUnempty, accel_directives.preload_user, zend_accel_globals, accel_globals)
#endif #endif
#if ZEND_WIN32 #ifdef ZEND_WIN32
STD_PHP_INI_ENTRY("opcache.cache_id" , "" , PHP_INI_SYSTEM, OnUpdateString, accel_directives.cache_id, zend_accel_globals, accel_globals) STD_PHP_INI_ENTRY("opcache.cache_id" , "" , PHP_INI_SYSTEM, OnUpdateString, accel_directives.cache_id, zend_accel_globals, accel_globals)
#endif #endif
#ifdef HAVE_JIT #ifdef HAVE_JIT
@ -838,7 +838,7 @@ ZEND_FUNCTION(opcache_get_configuration)
#ifndef ZEND_WIN32 #ifndef ZEND_WIN32
add_assoc_string(&directives, "opcache.preload_user", STRING_NOT_NULL(ZCG(accel_directives).preload_user)); add_assoc_string(&directives, "opcache.preload_user", STRING_NOT_NULL(ZCG(accel_directives).preload_user));
#endif #endif
#if ZEND_WIN32 #ifdef ZEND_WIN32
add_assoc_string(&directives, "opcache.cache_id", STRING_NOT_NULL(ZCG(accel_directives).cache_id)); add_assoc_string(&directives, "opcache.cache_id", STRING_NOT_NULL(ZCG(accel_directives).cache_id));
#endif #endif
#ifdef HAVE_JIT #ifdef HAVE_JIT

View File

@ -44,7 +44,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#if HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif

View File

@ -31,7 +31,7 @@
#include "php_random.h" #include "php_random.h"
#include "php_random_csprng.h" #include "php_random_csprng.h"
#if HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif #endif
@ -45,7 +45,7 @@
# include <sys/syscall.h> # include <sys/syscall.h>
#endif #endif
#if HAVE_SYS_PARAM_H #ifdef HAVE_SYS_PARAM_H
# include <sys/param.h> # include <sys/param.h>
# if (__FreeBSD__ && __FreeBSD_version > 1200000) || (__DragonFly__ && __DragonFly_version >= 500700) || \ # if (__FreeBSD__ && __FreeBSD_version > 1200000) || (__DragonFly__ && __DragonFly_version >= 500700) || \
defined(__sun) || (defined(__NetBSD__) && __NetBSD_Version__ >= 1000000000) || defined(__midipix__) defined(__sun) || (defined(__NetBSD__) && __NetBSD_Version__ >= 1000000000) || defined(__midipix__)

View File

@ -34,7 +34,7 @@
#include "php_random_csprng.h" #include "php_random_csprng.h"
#include "ext/standard/sha1.h" #include "ext/standard/sha1.h"
#if HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif #endif
@ -46,7 +46,7 @@
# include <sys/time.h> # include <sys/time.h>
#endif #endif
#if HAVE_SYS_PARAM_H #ifdef HAVE_SYS_PARAM_H
# include <sys/param.h> # include <sys/param.h>
#endif #endif

View File

@ -20,7 +20,7 @@
#ifndef PHP_SOCKETS_H #ifndef PHP_SOCKETS_H
#define PHP_SOCKETS_H #define PHP_SOCKETS_H
#if HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif

View File

@ -45,7 +45,7 @@
# include "win32/fnmatch.h" # include "win32/fnmatch.h"
# include "win32/ioutil.h" # include "win32/ioutil.h"
#else #else
# if HAVE_SYS_PARAM_H # ifdef HAVE_SYS_PARAM_H
# include <sys/param.h> # include <sys/param.h>
# endif # endif
# if HAVE_SYS_SELECT_H # if HAVE_SYS_SELECT_H
@ -54,7 +54,7 @@
# include <sys/socket.h> # include <sys/socket.h>
# include <netinet/in.h> # include <netinet/in.h>
# include <netdb.h> # include <netdb.h>
# if HAVE_ARPA_INET_H # ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h> # include <arpa/inet.h>
# endif # endif
#endif #endif

View File

@ -1697,7 +1697,7 @@ PHP_FUNCTION(stream_isatty)
#ifdef PHP_WIN32 #ifdef PHP_WIN32
/* Check if the Windows standard handle is redirected to file */ /* Check if the Windows standard handle is redirected to file */
RETVAL_BOOL(php_win32_console_fileno_is_console(fileno)); RETVAL_BOOL(php_win32_console_fileno_is_console(fileno));
#elif HAVE_UNISTD_H #elif defined(HAVE_UNISTD_H)
/* Check if the file descriptor identifier is a terminal */ /* Check if the file descriptor identifier is a terminal */
RETVAL_BOOL(isatty(fileno)); RETVAL_BOOL(isatty(fileno));
#else #else

View File

@ -40,12 +40,12 @@
#include "php_network.h" #include "php_network.h"
#include "zend_smart_str.h" #include "zend_smart_str.h"
#if HAVE_PWD_H #ifdef HAVE_PWD_H
#include <pwd.h> #include <pwd.h>
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#if HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
@ -54,7 +54,7 @@
#else #else
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>
#if HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
#endif #endif
@ -368,7 +368,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle)
memset(file_handle, 0, sizeof(zend_file_handle)); memset(file_handle, 0, sizeof(zend_file_handle));
path_info = SG(request_info).request_uri; path_info = SG(request_info).request_uri;
#if HAVE_PWD_H #ifdef HAVE_PWD_H
if (PG(user_dir) && *PG(user_dir) && path_info && '/' == path_info[0] && '~' == path_info[1]) { if (PG(user_dir) && *PG(user_dir) && path_info && '/' == path_info[0] && '~' == path_info[1]) {
char *s = strchr(path_info + 2, '/'); char *s = strchr(path_info + 2, '/');

View File

@ -30,10 +30,10 @@
#include "win32/winutil.h" #include "win32/winutil.h"
#include <process.h> #include <process.h>
#endif #endif
#if HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#if HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif

View File

@ -33,7 +33,7 @@
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#if HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
@ -44,7 +44,7 @@
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> #include <sys/select.h>
#endif #endif
#if HAVE_POLL_H #ifdef HAVE_POLL_H
#include <poll.h> #include <poll.h>
#elif HAVE_SYS_POLL_H #elif HAVE_SYS_POLL_H
#include <sys/poll.h> #include <sys/poll.h>
@ -54,7 +54,7 @@
#ifndef PHP_WIN32 #ifndef PHP_WIN32
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>
#if HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
#endif #endif
@ -774,7 +774,7 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short
struct sockaddr **sal, **psal, *sa; struct sockaddr **sal, **psal, *sa;
struct timeval working_timeout; struct timeval working_timeout;
socklen_t socklen; socklen_t socklen;
#if HAVE_GETTIMEOFDAY #ifdef HAVE_GETTIMEOFDAY
struct timeval limit_time, time_now; struct timeval limit_time, time_now;
#endif #endif
@ -787,7 +787,7 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short
if (timeout) { if (timeout) {
memcpy(&working_timeout, timeout, sizeof(working_timeout)); memcpy(&working_timeout, timeout, sizeof(working_timeout));
#if HAVE_GETTIMEOFDAY #ifdef HAVE_GETTIMEOFDAY
gettimeofday(&limit_time, NULL); gettimeofday(&limit_time, NULL);
limit_time.tv_sec += working_timeout.tv_sec; limit_time.tv_sec += working_timeout.tv_sec;
limit_time.tv_usec += working_timeout.tv_usec; limit_time.tv_usec += working_timeout.tv_usec;
@ -906,7 +906,7 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short
} }
/* adjust timeout for next attempt */ /* adjust timeout for next attempt */
#if HAVE_GETTIMEOFDAY #ifdef HAVE_GETTIMEOFDAY
if (timeout) { if (timeout) {
gettimeofday(&time_now, NULL); gettimeofday(&time_now, NULL);

View File

@ -122,11 +122,11 @@ typedef int pid_t;
#include <unix.h> #include <unix.h>
#endif #endif
#if HAVE_ALLOCA_H #ifdef HAVE_ALLOCA_H
#include <alloca.h> #include <alloca.h>
#endif #endif
#if HAVE_BUILD_DEFS_H #ifdef HAVE_BUILD_DEFS_H
#include <build-defs.h> #include <build-defs.h>
#endif #endif
@ -209,7 +209,7 @@ typedef unsigned int socklen_t;
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#if HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
@ -220,7 +220,7 @@ typedef unsigned int socklen_t;
#include "zend_stack.h" #include "zend_stack.h"
#include <string.h> #include <string.h>
#if HAVE_PWD_H #ifdef HAVE_PWD_H
# ifdef PHP_WIN32 # ifdef PHP_WIN32
#include "win32/param.h" #include "win32/param.h"
# else # else

View File

@ -30,7 +30,7 @@
#include "win32/winutil.h" #include "win32/winutil.h"
#endif #endif
#if HAVE_SCANDIR && HAVE_ALPHASORT && HAVE_DIRENT_H #if defined(HAVE_SCANDIR) && defined(HAVE_ALPHASORT) && defined(HAVE_DIRENT_H)
#include <dirent.h> #include <dirent.h>
#endif #endif

View File

@ -31,7 +31,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>
#if HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
#endif #endif

View File

@ -19,7 +19,7 @@
#include <Ws2tcpip.h> #include <Ws2tcpip.h>
#endif #endif
#if HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h> # include <sys/socket.h>
#endif #endif

View File

@ -23,10 +23,10 @@
#include "ext/standard/php_filestat.h" #include "ext/standard/php_filestat.h"
#include <stddef.h> #include <stddef.h>
#include <fcntl.h> #include <fcntl.h>
#if HAVE_SYS_WAIT_H #ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h> #include <sys/wait.h>
#endif #endif
#if HAVE_SYS_FILE_H #ifdef HAVE_SYS_FILE_H
#include <sys/file.h> #include <sys/file.h>
#endif #endif
#ifdef HAVE_SYS_MMAN_H #ifdef HAVE_SYS_MMAN_H

View File

@ -36,11 +36,11 @@
# include <process.h> # include <process.h>
#endif #endif
#if HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
# include <sys/time.h> # include <sys/time.h>
#endif #endif
#if HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif #endif
@ -48,11 +48,11 @@
#include <locale.h> #include <locale.h>
#if HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h> # include <sys/types.h>
#endif #endif
#if HAVE_SYS_WAIT_H #ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h> # include <sys/wait.h>
#endif #endif
@ -1737,7 +1737,7 @@ int main(int argc, char *argv[])
int warmup_repeats = 0; int warmup_repeats = 0;
int repeats = 1; int repeats = 1;
int benchmark = 0; int benchmark = 0;
#if HAVE_GETTIMEOFDAY #ifdef HAVE_GETTIMEOFDAY
struct timeval start, end; struct timeval start, end;
#else #else
time_t start, end; time_t start, end;

View File

@ -39,10 +39,10 @@
#include <process.h> #include <process.h>
#include <shellapi.h> #include <shellapi.h>
#endif #endif
#if HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#if HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif

View File

@ -36,17 +36,17 @@
#include <unixlib/local.h> #include <unixlib/local.h>
#endif #endif
#if HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#if HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <signal.h> #include <signal.h>
#include <locale.h> #include <locale.h>
#if HAVE_DLFCN_H #ifdef HAVE_DLFCN_H
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif
@ -222,7 +222,7 @@ static const php_cli_server_http_response_status_code_pair template_map[] = {
static int php_cli_server_log_level = 3; static int php_cli_server_log_level = 3;
#if HAVE_UNISTD_H || defined(PHP_WIN32) #if defined(HAVE_UNISTD_H) || defined(PHP_WIN32)
static int php_cli_output_is_tty = OUTPUT_NOT_CHECKED; static int php_cli_output_is_tty = OUTPUT_NOT_CHECKED;
#endif #endif
@ -1164,7 +1164,7 @@ static bool php_cli_server_content_sender_pull(php_cli_server_content_sender *se
return true; return true;
} /* }}} */ } /* }}} */
#if HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
static int php_cli_is_output_tty(void) /* {{{ */ static int php_cli_is_output_tty(void) /* {{{ */
{ {
if (php_cli_output_is_tty == OUTPUT_NOT_CHECKED) { if (php_cli_output_is_tty == OUTPUT_NOT_CHECKED) {
@ -1199,7 +1199,7 @@ static void php_cli_server_log_response(php_cli_server_client *client, int statu
} }
} }
#if HAVE_UNISTD_H || defined(PHP_WIN32) #if defined(HAVE_UNISTD_H) || defined(PHP_WIN32)
if (CLI_SERVER_G(color) && php_cli_is_output_tty() == OUTPUT_IS_TTY) { if (CLI_SERVER_G(color) && php_cli_is_output_tty() == OUTPUT_IS_TTY) {
if (effective_status >= 500) { if (effective_status >= 500) {
/* server error: red */ /* server error: red */

View File

@ -30,17 +30,15 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#if HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/stat.h> #include <sys/stat.h>
#if HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <signal.h> #include <signal.h>

View File

@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#if HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
@ -60,10 +60,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <sys/stat.h> #include <sys/stat.h>
#if HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <sys/types.h> #include <sys/types.h>

View File

@ -683,7 +683,7 @@ __forceinline static char *php_win32_ioutil_realpath(const char *path, char *res
}/*}}}*/ }/*}}}*/
#include <sys/stat.h> #include <sys/stat.h>
#if _WIN64 #ifdef _WIN64
typedef unsigned __int64 php_win32_ioutil_dev_t; typedef unsigned __int64 php_win32_ioutil_dev_t;
typedef unsigned __int64 php_win32_ioutil_ino_t; typedef unsigned __int64 php_win32_ioutil_ino_t;
typedef __time64_t php_win32_ioutil_time_t; typedef __time64_t php_win32_ioutil_time_t;