diff --git a/.github/actions/configure-x64/action.yml b/.github/actions/configure-x64/action.yml index f9b774218f4ef..6697012dc9d9c 100644 --- a/.github/actions/configure-x64/action.yml +++ b/.github/actions/configure-x64/action.yml @@ -80,5 +80,4 @@ runs: --with-config-file-scan-dir=/etc/php.d \ --with-pdo-firebird \ --with-pdo-dblib \ - --enable-werror \ ${{ inputs.configurationParameters }} diff --git a/Zend/Zend.m4 b/Zend/Zend.m4 index fe28134dd92d6..ff9d434ebe0d7 100644 --- a/Zend/Zend.m4 +++ b/Zend/Zend.m4 @@ -206,7 +206,7 @@ else AC_DEFINE(ZEND_DEBUG,0,[ ]) fi -test -n "$GCC" && CFLAGS="-Wall -Wextra -Wno-strict-aliasing -Wno-unused-parameter -Wno-sign-compare $CFLAGS" +test -n "$GCC" && CFLAGS="-Wall -Wextra -Wundef -Wno-strict-aliasing -Wno-unused-parameter -Wno-sign-compare $CFLAGS" dnl Check if compiler supports -Wno-clobbered (only GCC) AX_CHECK_COMPILE_FLAG([-Wno-clobbered], CFLAGS="-Wno-clobbered $CFLAGS", , [-Werror]) dnl Check for support for implicit fallthrough level 1, also add after previous CFLAGS as level 3 is enabled in -Wextra diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 436a5a2fd2a94..66ac8e97cb054 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -3010,7 +3010,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c { zval *ptr; zend_object *zobj; - zend_string *name, *tmp_name; + zend_string *name, *tmp_name = NULL; if (container_op_type != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) { do { diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c index 3319b7aa34e64..998214eb0b07f 100644 --- a/Zend/zend_gc.c +++ b/Zend/zend_gc.c @@ -70,10 +70,6 @@ #include "zend_API.h" #include "zend_fibers.h" -#ifndef GC_BENCH -# define GC_BENCH 0 -#endif - #ifndef ZEND_GC_DEBUG # define ZEND_GC_DEBUG 0 #endif diff --git a/Zend/zend_gc.h b/Zend/zend_gc.h index 3221335733ece..3bef4057befc7 100644 --- a/Zend/zend_gc.h +++ b/Zend/zend_gc.h @@ -22,6 +22,10 @@ BEGIN_EXTERN_C() +#ifndef GC_BENCH +# define GC_BENCH 0 +#endif + typedef struct _zend_gc_status { uint32_t runs; uint32_t collected; diff --git a/azure/configure.yml b/azure/configure.yml index a7a65845e1a56..49510959ce0d1 100644 --- a/azure/configure.yml +++ b/azure/configure.yml @@ -72,7 +72,6 @@ steps: --with-pdo-dblib \ --with-pdo-oci=shared,instantclient,/opt/oracle/instantclient \ --with-oci8=shared,instantclient,/opt/oracle/instantclient \ - --enable-werror \ --with-config-file-path=/etc \ --with-config-file-scan-dir=/etc/php.d displayName: 'Configure Build' diff --git a/ext/date/config0.m4 b/ext/date/config0.m4 index 18b8106bd2d33..27aa6885457bc 100644 --- a/ext/date/config0.m4 +++ b/ext/date/config0.m4 @@ -4,7 +4,7 @@ AC_CHECK_HEADERS([io.h]) dnl Check for strtoll, atoll AC_CHECK_FUNCS(strtoll atoll) -PHP_DATE_CFLAGS="-Wno-implicit-fallthrough -I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1" +PHP_DATE_CFLAGS="-Wno-implicit-fallthrough -Wno-undef -I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1" timelib_sources="lib/astro.c lib/dow.c lib/parse_date.c lib/parse_tz.c lib/parse_posix.c lib/timelib.c lib/tm2unixtime.c lib/unixtime2tm.c lib/parse_iso_intervals.c lib/interval.c" diff --git a/ext/fileinfo/config.m4 b/ext/fileinfo/config.m4 index 1f62d464aae6c..7710ccf40d9e8 100644 --- a/ext/fileinfo/config.m4 +++ b/ext/fileinfo/config.m4 @@ -49,7 +49,8 @@ int main(void) libmagic_sources="$libmagic_sources libmagic/strcasestr.c" ],[AC_MSG_RESULT([skipped, cross-compiling])]) - PHP_NEW_EXTENSION(fileinfo, fileinfo.c $libmagic_sources, $ext_shared,,-I@ext_srcdir@/libmagic) + PHP_FILEINFO_CFLAGS="-Wno-undef -I@ext_srcdir@/libmagic" + PHP_NEW_EXTENSION(fileinfo, fileinfo.c $libmagic_sources, $ext_shared,,$PHP_FILEINFO_CFLAGS) PHP_ADD_BUILD_DIR($ext_builddir/libmagic) AC_CHECK_FUNCS([utimes strndup]) diff --git a/ext/hash/hash_crc32.c b/ext/hash/hash_crc32.c index 19811c9d59f7d..1c3b09c3f2b3c 100644 --- a/ext/hash/hash_crc32.c +++ b/ext/hash/hash_crc32.c @@ -29,7 +29,7 @@ PHP_HASH_API void PHP_CRC32Update(PHP_CRC32_CTX *context, const unsigned char *i { size_t i = 0; -#if ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE || ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER +#if defined(ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE) || defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER) i += crc32_x86_simd_update(X86_CRC32, &context->state, input, len); #endif @@ -42,7 +42,7 @@ PHP_HASH_API void PHP_CRC32BUpdate(PHP_CRC32_CTX *context, const unsigned char * { size_t i = 0; -#if ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE || ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER +#if defined(ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE) || defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER) i += crc32_x86_simd_update(X86_CRC32B, &context->state, input, len); #endif @@ -55,7 +55,7 @@ PHP_HASH_API void PHP_CRC32CUpdate(PHP_CRC32_CTX *context, const unsigned char * { size_t i = 0; -#if ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE || ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER +#if defined(ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE) || defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER) i += crc32_x86_simd_update(X86_CRC32C, &context->state, input, len); #endif diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c index 9cad5247a7d39..cd2ae6fd2ded7 100644 --- a/ext/mysqlnd/mysqlnd_result.c +++ b/ext/mysqlnd/mysqlnd_result.c @@ -1021,7 +1021,7 @@ MYSQLND_METHOD(mysqlnd_res, fetch_into)(MYSQLND_RES * result, const unsigned int static MYSQLND_ROW_C MYSQLND_METHOD(mysqlnd_res, fetch_row_c)(MYSQLND_RES * result) { - bool fetched_anything; + bool fetched_anything = false; zval *row_data; MYSQLND_ROW_C ret = NULL; DBG_ENTER("mysqlnd_res::fetch_row_c"); diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index af040eba9ca93..87acb4693dac2 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -947,7 +947,7 @@ static int zend_get_stream_timestamp(const char *filename, zend_stat_t *statbuf) 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 unsigned __int64 utc_base = 0; @@ -2176,7 +2176,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type) HANDLE_UNBLOCK_INTERRUPTIONS(); } else { -#if !ZEND_WIN32 +#ifndef ZEND_WIN32 ZCSG(hits)++; /* TBFixed: may lose one hit */ persistent_script->dynamic_members.hits++; /* see above */ #else diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index bc7236fbdb3fa..c435f48a12432 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -36,7 +36,7 @@ /* 8 - Standalone Open Source Zend OPcache */ #define ACCELERATOR_API_NO 8 -#if ZEND_WIN32 +#ifdef ZEND_WIN32 # include "zend_config.w32.h" #else #include "zend_config.h" @@ -97,7 +97,7 @@ extern int lock_file; # define ENABLE_FILE_CACHE_FALLBACK 0 #endif -#if ZEND_WIN32 +#ifdef ZEND_WIN32 typedef unsigned __int64 accel_time_t; #else typedef time_t accel_time_t; diff --git a/ext/opcache/jit/vtune/ittnotify_config.h b/ext/opcache/jit/vtune/ittnotify_config.h index fc3a476cdd1c9..60b92ed840692 100644 --- a/ext/opcache/jit/vtune/ittnotify_config.h +++ b/ext/opcache/jit/vtune/ittnotify_config.h @@ -337,7 +337,7 @@ ITT_INLINE long __itt_interlocked_increment(volatile long* ptr) #define __itt_fstrdup(s) strdup(s) #define __itt_thread_id() pthread_self() #define __itt_thread_yield() sched_yield() -#if ITT_ARCH==ITT_ARCH_IA64 +#if defined(ITT_ARCH_IA64) && ITT_ARCH==ITT_ARCH_IA64 #ifdef __INTEL_COMPILER #define __TBB_machine_fetchadd4(addr, val) __fetchadd4_acq((void *)addr, val) #else /* __INTEL_COMPILER */ diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 8ed75b7b7c797..9c1bc849382b6 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -767,7 +767,7 @@ static int sp_adj[SP_ADJ_LAST]; # pragma clang diagnostic pop #endif -#if _WIN32 +#ifdef _WIN32 # include #else # include @@ -4616,7 +4616,7 @@ ZEND_EXT_API void zend_jit_unprotect(void) 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))) { DWORD old, new; #ifdef ZTS @@ -4642,7 +4642,7 @@ ZEND_EXT_API void zend_jit_protect(void) 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))) { DWORD old; @@ -4907,7 +4907,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, bool reattached) 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)) { DWORD old; @@ -4933,7 +4933,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, bool reattached) if (!reattached) { zend_jit_unprotect(); *dasm_ptr = dasm_buf; -#if _WIN32 +#ifdef _WIN32 /* reserve space for global labels */ *dasm_ptr = (void**)*dasm_ptr + zend_lb_MAX; #endif @@ -4958,7 +4958,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, bool reattached) if (!reattached) { zend_jit_unprotect(); ret = zend_jit_make_stubs(); -#if _WIN32 +#ifdef _WIN32 /* save global labels */ memcpy(dasm_buf, dasm_labels, sizeof(void*) * zend_lb_MAX); #endif @@ -4968,7 +4968,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, bool reattached) return FAILURE; } } else { -#if _WIN32 +#ifdef _WIN32 /* restore global labels */ memcpy(dasm_labels, dasm_buf, sizeof(void*) * zend_lb_MAX); zend_jit_init_handlers(); diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index d8fdc49db63d4..3d88330e3ffdb 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -142,7 +142,7 @@ const char* zend_reg_name[] = { static void* dasm_labels[zend_lb_MAX]; -#if ZTS +#ifdef ZTS static size_t tsrm_ls_cache_tcb_offset = 0; static size_t tsrm_tls_index; static size_t tsrm_tls_offset; @@ -2831,7 +2831,7 @@ static const zend_jit_stub zend_jit_stubs[] = { #endif }; -#if ZTS && defined(ZEND_WIN32) +#if defined(ZTS) && defined(ZEND_WIN32) extern uint32_t _tls_index; extern char *_tls_start; extern char *_tls_end; @@ -2894,7 +2894,7 @@ static int zend_jit_setup(void) allowed_opt_flags |= ZEND_JIT_CPU_AVX; } -#if ZTS +#ifdef ZTS # ifdef _WIN64 tsrm_tls_index = _tls_index * sizeof(void*); @@ -2919,7 +2919,7 @@ static int zend_jit_setup(void) return FAILURE; } } while(0); -# elif ZEND_WIN32 +# elif defined(ZEND_WIN32) 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 */ @@ -3192,7 +3192,7 @@ static int zend_jit_trace_begin(dasm_State **Dst, uint32_t trace_num, zend_jit_t { zend_regset regset = ZEND_REGSET_SCRATCH; -#if ZTS +#ifdef ZTS if (1) { #else if ((sizeof(void*) == 8 && !IS_SIGNED_32BIT(&EG(jit_trace_num)))) { @@ -7997,7 +7997,7 @@ static int zend_jit_cmp(dasm_State **Dst, } | mov eax, dword T1 // restore } else if (may_throw) { -#if ZTS +#ifdef ZTS | mov dword T1, eax // save #else if ((sizeof(void*) == 8 && !IS_SIGNED_32BIT(&EG(exception)))) { @@ -8005,7 +8005,7 @@ static int zend_jit_cmp(dasm_State **Dst, } #endif zend_jit_check_exception_undef_result(Dst, opline); -#if ZTS +#ifdef ZTS | mov eax, dword T1 // restore #else if ((sizeof(void*) == 8 && !IS_SIGNED_32BIT(&EG(exception)))) { @@ -16233,7 +16233,7 @@ bw_op: if (ssa_op == ssa->ops && (JIT_G(current_trace)->stop == ZEND_JIT_TRACE_STOP_LOOP || JIT_G(current_trace)->stop == ZEND_JIT_TRACE_STOP_RECURSIVE_CALL)) { -#if ZTS +#ifdef ZTS ZEND_REGSET_INCL(regset, ZREG_R0); #else if ((sizeof(void*) == 8 && !IS_SIGNED_32BIT(&EG(vm_interrupt)))) { @@ -16246,7 +16246,7 @@ bw_op: if ((ssa->cfg.blocks[b].flags & ZEND_BB_LOOP_HEADER) != 0 && ssa->cfg.blocks[b].start == ssa_op - ssa->ops) { -#if ZTS +#ifdef ZTS ZEND_REGSET_INCL(regset, ZREG_R0); #else if ((sizeof(void*) == 8 && !IS_SIGNED_32BIT(&EG(vm_interrupt)))) { diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index b09eb9ff41ad9..0a449cc644a48 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -33,7 +33,7 @@ #include "ext/standard/php_filestat.h" #include "opcache_arginfo.h" -#if HAVE_JIT +#ifdef HAVE_JIT #include "jit/zend_jit.h" #endif @@ -280,7 +280,7 @@ ZEND_INI_BEGIN() #ifndef ZEND_WIN32 STD_PHP_INI_ENTRY("opcache.preload_user" , "" , PHP_INI_SYSTEM, OnUpdateStringUnempty, accel_directives.preload_user, zend_accel_globals, accel_globals) #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) #endif #ifdef HAVE_JIT @@ -436,7 +436,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"); @@ -689,7 +689,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 } @@ -770,7 +770,7 @@ ZEND_FUNCTION(opcache_get_configuration) #ifndef ZEND_WIN32 add_assoc_string(&directives, "opcache.preload_user", STRING_NOT_NULL(ZCG(accel_directives).preload_user)); #endif -#if ZEND_WIN32 +#ifdef ZEND_WIN32 add_assoc_string(&directives, "opcache.cache_id", STRING_NOT_NULL(ZCG(accel_directives).cache_id)); #endif #ifdef HAVE_JIT diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index e3300d1ebb381..bbed8a79ae397 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -43,7 +43,7 @@ #include #include -#if HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H #include #endif diff --git a/ext/readline/php_readline.h b/ext/readline/php_readline.h index d825e19a11799..a4a956c4fe895 100644 --- a/ext/readline/php_readline.h +++ b/ext/readline/php_readline.h @@ -17,7 +17,7 @@ #ifndef PHP_READLINE_H #define PHP_READLINE_H -#if HAVE_LIBREADLINE || HAVE_LIBEDIT +#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT) extern zend_module_entry readline_module_entry; #define phpext_readline_ptr &readline_module_entry diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 544258eeca621..26592b0b2acd8 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -25,7 +25,7 @@ #include "readline_cli.h" #include "readline_arginfo.h" -#if HAVE_LIBREADLINE || HAVE_LIBEDIT +#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT) #ifndef HAVE_RL_COMPLETION_MATCHES #define rl_completion_matches completion_matches @@ -38,7 +38,7 @@ #include #endif -#if HAVE_RL_CALLBACK_READ_CHAR +#ifdef HAVE_RL_CALLBACK_READ_CHAR static zval _prepped_callback; @@ -74,12 +74,12 @@ ZEND_GET_MODULE(readline) PHP_MINIT_FUNCTION(readline) { -#if HAVE_LIBREADLINE +#ifdef HAVE_LIBREADLINE /* libedit don't need this call which set the tty in cooked mode */ using_history(); #endif ZVAL_UNDEF(&_readline_completion); -#if HAVE_RL_CALLBACK_READ_CHAR +#ifdef HAVE_RL_CALLBACK_READ_CHAR ZVAL_UNDEF(&_prepped_callback); #endif return PHP_MINIT(cli_readline)(INIT_FUNC_ARGS_PASSTHRU); @@ -94,7 +94,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); @@ -168,7 +168,7 @@ PHP_FUNCTION(readline_info) : ZSTR_CHAR(rl_completion_append_character)); add_assoc_bool(return_value,"completion_suppress_append",rl_completion_suppress_append); #endif -#if HAVE_ERASE_EMPTY_LINE +#ifdef HAVE_ERASE_EMPTY_LINE add_assoc_long(return_value,"erase_empty_line",rl_erase_empty_line); #endif #ifndef PHP_WIN32 @@ -232,7 +232,7 @@ PHP_FUNCTION(readline_info) RETVAL_INTERNED_STR( oldval == 0 ? ZSTR_EMPTY_ALLOC() : ZSTR_CHAR(oldval)); #endif -#if HAVE_ERASE_EMPTY_LINE +#ifdef HAVE_ERASE_EMPTY_LINE } else if (zend_string_equals_literal_ci(what, "erase_empty_line")) { oldval = rl_erase_empty_line; if (value) { @@ -288,7 +288,7 @@ PHP_FUNCTION(readline_clear_history) RETURN_THROWS(); } -#if HAVE_LIBEDIT +#ifdef HAVE_LIBEDIT /* clear_history is the only function where rl_initialize is not call to ensure correct allocation */ using_history(); @@ -490,7 +490,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) { @@ -569,7 +569,7 @@ PHP_FUNCTION(readline_redisplay) RETURN_THROWS(); } -#if HAVE_LIBEDIT +#ifdef HAVE_LIBEDIT /* seems libedit doesn't take care of rl_initialize in rl_redisplay * see bug #72538 */ using_history(); @@ -580,7 +580,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) { diff --git a/ext/readline/readline.stub.php b/ext/readline/readline.stub.php index 804b02fde38c2..e0a14e993c804 100644 --- a/ext/readline/readline.stub.php +++ b/ext/readline/readline.stub.php @@ -25,8 +25,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 {} @@ -35,7 +34,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 diff --git a/ext/readline/readline_arginfo.h b/ext/readline/readline_arginfo.h index de539fd3310cc..6bcd9ed1d4a67 100644 --- a/ext/readline/readline_arginfo.h +++ b/ext/readline/readline_arginfo.h @@ -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 @@ -69,19 +69,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 @@ -97,19 +97,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 diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c index 8bf5d23df75f7..bab398b12c726 100644 --- a/ext/readline/readline_cli.c +++ b/ext/readline/readline_cli.c @@ -45,7 +45,7 @@ #include #endif -#if HAVE_LIBEDIT +#ifdef HAVE_LIBEDIT #include #else #include @@ -688,7 +688,7 @@ static int readline_shell_run(void) /* {{{ */ } if (history_lines_to_write) { -#if HAVE_LIBEDIT +#ifdef HAVE_LIBEDIT write_history(history_file); #else append_history(history_lines_to_write, history_file); @@ -771,7 +771,7 @@ PHP_MINIT_FUNCTION(cli_readline) ZEND_INIT_MODULE_GLOBALS(cli_readline, cli_readline_init_globals, NULL); REGISTER_INI_ENTRIES(); -#if HAVE_LIBEDIT +#ifdef HAVE_LIBEDIT REGISTER_STRING_CONSTANT("READLINE_LIB", "libedit", CONST_CS|CONST_PERSISTENT); #else REGISTER_STRING_CONSTANT("READLINE_LIB", "readline", CONST_CS|CONST_PERSISTENT); diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c index 90a79b83985c5..79acac7e49279 100644 --- a/ext/sockets/conversions.c +++ b/ext/sockets/conversions.c @@ -589,7 +589,7 @@ static void to_zval_read_sockaddr_in(const char *data, zval *zv, res_context *ct { to_zval_read_aggregation(data, zv, descriptors_sockaddr_in, ctx); } -#if HAVE_IPV6 +#ifdef HAVE_IPV6 static void from_zval_write_sin6_addr(const zval *zaddr_str, char *addr6, ser_context *ctx) { int res; @@ -740,7 +740,7 @@ static void from_zval_write_sockaddr_aux(const zval *container, } break; -#if HAVE_IPV6 +#ifdef HAVE_IPV6 case AF_INET6: if (ctx->sock->type != AF_INET6) { do_from_zval_err(ctx, "the specified family (AF_INET6) is not " @@ -804,7 +804,7 @@ static void to_zval_read_sockaddr_aux(const char *sockaddr_c, zval *zv, res_cont to_zval_read_sockaddr_in(sockaddr_c, zv, ctx); break; -#if HAVE_IPV6 +#ifdef HAVE_IPV6 case AF_INET6: to_zval_read_sockaddr_in6(sockaddr_c, zv, ctx); break; @@ -1245,7 +1245,7 @@ static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context str = zval_get_tmp_string((zval *) zv, &tmp_str); -#if HAVE_IF_NAMETOINDEX +#ifdef HAVE_IF_NAMETOINDEX ret = if_nametoindex(ZSTR_VAL(str)); if (ret == 0) { do_from_zval_err(ctx, "no interface with name \"%s\" could be found", ZSTR_VAL(str)); diff --git a/ext/sockets/multicast.c b/ext/sockets/multicast.c index ef32661be09ff..e1aa38f3b96ce 100644 --- a/ext/sockets/multicast.c +++ b/ext/sockets/multicast.c @@ -54,14 +54,14 @@ 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 int php_string_to_if_index(const char *val, unsigned *out) { -#if HAVE_IF_NAMETOINDEX +#ifdef HAVE_IF_NAMETOINDEX unsigned int ind; ind = if_nametoindex(val); @@ -475,7 +475,7 @@ static int _php_mcast_join_leave( join ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP, (char*)&mreq, sizeof(mreq)); } -#if HAVE_IPV6 +#ifdef HAVE_IPV6 else if (sock->type == AF_INET6) { struct ipv6_mreq mreq; memset(&mreq, 0, sizeof(struct ipv6_mreq)); @@ -543,7 +543,7 @@ static int _php_mcast_source_op( return setsockopt(sock->bsd_socket, level, _php_source_op_to_ipv4_op(sop), (char*)&mreqs, sizeof(mreqs)); } -#if HAVE_IPV6 +#ifdef HAVE_IPV6 else if (sock->type == AF_INET6) { php_error_docref(NULL, E_WARNING, "This platform does not support %s for IPv6 sockets", @@ -560,7 +560,7 @@ static int _php_mcast_source_op( #endif } -#if RFC3678_API +#ifdef RFC3678_API static int _php_source_op_to_rfc3678_op(enum source_op sop) { switch (sop) { @@ -722,7 +722,7 @@ int php_if_index_to_addr4(unsigned if_index, php_socket *php_sock, struct in_add #define ifr_ifindex ifr_index #endif -#if defined(SIOCGIFNAME) +#ifdef SIOCGIFNAME if_req.ifr_ifindex = if_index; if (ioctl(php_sock->bsd_socket, SIOCGIFNAME, &if_req) == -1) { #elif defined(HAVE_IF_INDEXTONAME) @@ -801,7 +801,7 @@ int php_add4_to_if_index(struct in_addr *addr, php_socket *php_sock, unsigned *i if ((((struct sockaddr*)&cur_req.ifr_addr)->sa_family == AF_INET) && (((struct sockaddr_in*)&cur_req.ifr_addr)->sin_addr.s_addr == addr->s_addr)) { -#if defined(SIOCGIFINDEX) +#ifdef SIOCGIFINDEX if (ioctl(php_sock->bsd_socket, SIOCGIFINDEX, (char*)&cur_req) == -1) { #elif defined(HAVE_IF_NAMETOINDEX) @@ -815,7 +815,7 @@ int php_add4_to_if_index(struct in_addr *addr, php_socket *php_sock, unsigned *i errno); goto err; } else { -#if defined(SIOCGIFINDEX) +#ifdef SIOCGIFINDEX *if_index = cur_req.ifr_ifindex; #else *if_index = index_tmp; diff --git a/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h index 459b9677a9889..63acbaf9c7222 100644 --- a/ext/sockets/php_sockets.h +++ b/ext/sockets/php_sockets.h @@ -20,11 +20,11 @@ #ifndef PHP_SOCKETS_H #define PHP_SOCKETS_H -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include "config.h" #endif -#if HAVE_SOCKETS +#ifdef HAVE_SOCKETS #include #ifdef PHP_WIN32 @@ -41,7 +41,7 @@ extern zend_module_entry sockets_module_entry; #ifdef PHP_WIN32 #include #else -#if HAVE_SYS_SOCKET_H +#ifdef HAVE_SYS_SOCKET_H #include #endif #endif diff --git a/ext/sockets/sendrecvmsg.c b/ext/sockets/sendrecvmsg.c index 01cb773acb1da..ba286b5a88957 100644 --- a/ext/sockets/sendrecvmsg.c +++ b/ext/sockets/sendrecvmsg.c @@ -109,17 +109,17 @@ static void init_ancillary_registry(void) key.cmsg_type = type; \ zend_hash_str_update_mem(&ancillary_registry.ht, (char*)&key, sizeof(key), (void*)&entry, sizeof(entry)) -#if defined(IPV6_PKTINFO) && HAVE_IPV6 +#if defined(IPV6_PKTINFO) && defined(HAVE_IPV6) PUT_ENTRY(sizeof(struct in6_pktinfo), 0, 0, from_zval_write_in6_pktinfo, to_zval_read_in6_pktinfo, IPPROTO_IPV6, IPV6_PKTINFO); #endif -#if defined(IPV6_HOPLIMIT) && HAVE_IPV6 +#if defined(IPV6_HOPLIMIT) && defined(HAVE_IPV6) PUT_ENTRY(sizeof(int), 0, 0, from_zval_write_int, to_zval_read_int, IPPROTO_IPV6, IPV6_HOPLIMIT); #endif -#if defined(IPV6_TCLASS) && HAVE_IPV6 +#if defined(IPV6_TCLASS) && defined(HAVE_IPV6) PUT_ENTRY(sizeof(int), 0, 0, from_zval_write_int, to_zval_read_int, IPPROTO_IPV6, IPV6_TCLASS); #endif @@ -320,7 +320,7 @@ PHP_FUNCTION(socket_cmsg_space) RETURN_LONG((zend_long)CMSG_SPACE(entry->size + n * entry->var_el_size)); } -#if HAVE_IPV6 +#ifdef HAVE_IPV6 int php_do_setsockopt_ipv6_rfc3542(php_socket *php_sock, int level, int optname, zval *arg4) { struct err_s err = {0}; @@ -417,11 +417,11 @@ int php_do_getsockopt_ipv6_rfc3542(php_socket *php_sock, int level, int optname, void php_socket_sendrecvmsg_init(INIT_FUNC_ARGS) { /* IPv6 ancillary data */ -#if defined(IPV6_RECVPKTINFO) && HAVE_IPV6 +#if defined(IPV6_RECVPKTINFO) && defined(HAVE_IPV6) REGISTER_LONG_CONSTANT("IPV6_RECVPKTINFO", IPV6_RECVPKTINFO, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IPV6_PKTINFO", IPV6_PKTINFO, CONST_CS | CONST_PERSISTENT); #endif -#if defined(IPV6_RECVHOPLIMIT) && HAVE_IPV6 +#if defined(IPV6_RECVHOPLIMIT) && defined(HAVE_IPV6) REGISTER_LONG_CONSTANT("IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IPV6_HOPLIMIT", IPV6_HOPLIMIT, CONST_CS | CONST_PERSISTENT); #endif @@ -430,7 +430,7 @@ void php_socket_sendrecvmsg_init(INIT_FUNC_ARGS) REGISTER_LONG_CONSTANT("IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS, CONST_CS | CONST_PERSISTENT); */ -#if defined(IPV6_RECVTCLASS) && HAVE_IPV6 +#if defined(IPV6_RECVTCLASS) && defined(HAVE_IPV6) REGISTER_LONG_CONSTANT("IPV6_RECVTCLASS", IPV6_RECVTCLASS, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IPV6_TCLASS", IPV6_TCLASS, CONST_CS | CONST_PERSISTENT); #endif diff --git a/ext/sockets/sockaddr_conv.c b/ext/sockets/sockaddr_conv.c index 65c8418fb3a6f..f55401dcb632c 100644 --- a/ext/sockets/sockaddr_conv.c +++ b/ext/sockets/sockaddr_conv.c @@ -11,12 +11,12 @@ extern int php_string_to_if_index(const char *val, unsigned *out); -#if HAVE_IPV6 +#ifdef HAVE_IPV6 /* Sets addr by hostname, or by ip in string form (AF_INET6) */ int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_sock) /* {{{ */ { struct in6_addr tmp; -#if HAVE_GETADDRINFO +#ifdef HAVE_GETADDRINFO struct addrinfo hints; struct addrinfo *addrinfo = NULL; #endif @@ -25,11 +25,11 @@ int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_ if (inet_pton(AF_INET6, string, &tmp)) { memcpy(&(sin6->sin6_addr.s6_addr), &(tmp.s6_addr), sizeof(struct in6_addr)); } else { -#if HAVE_GETADDRINFO +#ifdef HAVE_GETADDRINFO memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_INET6; -#if HAVE_AI_V4MAPPED +#ifdef HAVE_AI_V4MAPPED hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG; #else hints.ai_flags = AI_ADDRCONFIG; @@ -127,7 +127,7 @@ int php_set_inet46_addr(php_sockaddr_storage *ss, socklen_t *ss_len, char *strin return 1; } } -#if HAVE_IPV6 +#ifdef HAVE_IPV6 else if (php_sock->type == AF_INET6) { struct sockaddr_in6 t = {0}; if (php_set_inet6_addr(&t, string, php_sock)) { diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 8398e004d0b6c..2e804905a0e07 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -456,7 +456,7 @@ static PHP_MINIT_FUNCTION(sockets) REGISTER_LONG_CONSTANT("AF_UNIX", AF_UNIX, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("AF_INET", AF_INET, CONST_CS | CONST_PERSISTENT); -#if HAVE_IPV6 +#ifdef HAVE_IPV6 REGISTER_LONG_CONSTANT("AF_INET6", AF_INET6, CONST_CS | CONST_PERSISTENT); #endif REGISTER_LONG_CONSTANT("SOCK_STREAM", SOCK_STREAM, CONST_CS | CONST_PERSISTENT); @@ -571,7 +571,7 @@ static PHP_MINIT_FUNCTION(sockets) REGISTER_LONG_CONSTANT("IP_MULTICAST_IF", IP_MULTICAST_IF, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IP_MULTICAST_TTL", IP_MULTICAST_TTL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IP_MULTICAST_LOOP", IP_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT); -#if HAVE_IPV6 +#ifdef HAVE_IPV6 REGISTER_LONG_CONSTANT("IPV6_MULTICAST_IF", IPV6_MULTICAST_IF, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IPV6_MULTICAST_HOPS", IPV6_MULTICAST_HOPS, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("IPV6_MULTICAST_LOOP", IPV6_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT); @@ -588,28 +588,28 @@ static PHP_MINIT_FUNCTION(sockets) #endif REGISTER_LONG_CONSTANT("IPPROTO_IP", IPPROTO_IP, CONST_CS | CONST_PERSISTENT); -#if HAVE_IPV6 +#ifdef HAVE_IPV6 REGISTER_LONG_CONSTANT("IPPROTO_IPV6", IPPROTO_IPV6, CONST_CS | CONST_PERSISTENT); #endif REGISTER_LONG_CONSTANT("SOL_TCP", IPPROTO_TCP, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SOL_UDP", IPPROTO_UDP, CONST_CS | CONST_PERSISTENT); -#if HAVE_IPV6 +#ifdef HAVE_IPV6 REGISTER_LONG_CONSTANT("IPV6_UNICAST_HOPS", IPV6_UNICAST_HOPS, CONST_CS | CONST_PERSISTENT); #endif REGISTER_LONG_CONSTANT("AI_PASSIVE", AI_PASSIVE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("AI_CANONNAME", AI_CANONNAME, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("AI_NUMERICHOST", AI_NUMERICHOST, CONST_CS | CONST_PERSISTENT); -#if HAVE_AI_V4MAPPED +#ifdef HAVE_AI_V4MAPPED REGISTER_LONG_CONSTANT("AI_V4MAPPED", AI_V4MAPPED, CONST_CS | CONST_PERSISTENT); #endif -#if HAVE_AI_ALL +#ifdef HAVE_AI_ALL REGISTER_LONG_CONSTANT("AI_ALL", AI_ALL, CONST_CS | CONST_PERSISTENT); #endif REGISTER_LONG_CONSTANT("AI_ADDRCONFIG", AI_ADDRCONFIG, CONST_CS | CONST_PERSISTENT); -#if HAVE_AI_IDN +#ifdef HAVE_AI_IDN REGISTER_LONG_CONSTANT("AI_IDN", AI_IDN, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("AI_CANONIDN", AI_CANONIDN, CONST_CS | CONST_PERSISTENT); #endif @@ -1087,7 +1087,7 @@ PHP_FUNCTION(socket_getsockname) php_socket *php_sock; struct sockaddr *sa; struct sockaddr_in *sin; -#if HAVE_IPV6 +#ifdef HAVE_IPV6 struct sockaddr_in6 *sin6; #endif #ifdef HAVE_INET_NTOP @@ -1112,7 +1112,7 @@ PHP_FUNCTION(socket_getsockname) } switch (sa->sa_family) { -#if HAVE_IPV6 +#ifdef HAVE_IPV6 case AF_INET6: sin6 = (struct sockaddr_in6 *) sa; inet_ntop(AF_INET6, &sin6->sin6_addr, addrbuf, sizeof(addrbuf)); @@ -1164,7 +1164,7 @@ PHP_FUNCTION(socket_getpeername) php_socket *php_sock; struct sockaddr *sa; struct sockaddr_in *sin; -#if HAVE_IPV6 +#ifdef HAVE_IPV6 struct sockaddr_in6 *sin6; #endif #ifdef HAVE_INET_NTOP @@ -1189,7 +1189,7 @@ PHP_FUNCTION(socket_getpeername) } switch (sa->sa_family) { -#if HAVE_IPV6 +#ifdef HAVE_IPV6 case AF_INET6: sin6 = (struct sockaddr_in6 *) sa; inet_ntop(AF_INET6, &sin6->sin6_addr, addrbuf, sizeof(addrbuf)); @@ -1247,7 +1247,7 @@ PHP_FUNCTION(socket_create) } if (domain != AF_UNIX -#if HAVE_IPV6 +#ifdef HAVE_IPV6 && domain != AF_INET6 #endif && domain != AF_INET) { @@ -1298,7 +1298,7 @@ PHP_FUNCTION(socket_connect) ENSURE_SOCKET_VALID(php_sock); switch(php_sock->type) { -#if HAVE_IPV6 +#ifdef HAVE_IPV6 case AF_INET6: { struct sockaddr_in6 sin6 = {0}; @@ -1432,7 +1432,7 @@ PHP_FUNCTION(socket_bind) retval = bind(php_sock->bsd_socket, (struct sockaddr *)sa, sizeof(struct sockaddr_in)); break; } -#if HAVE_IPV6 +#ifdef HAVE_IPV6 case AF_INET6: { struct sockaddr_in6 *sa = (struct sockaddr_in6 *) sock_type; @@ -1542,7 +1542,7 @@ PHP_FUNCTION(socket_recvfrom) php_socket *php_sock; struct sockaddr_un s_un; struct sockaddr_in sin; -#if HAVE_IPV6 +#ifdef HAVE_IPV6 struct sockaddr_in6 sin6; #endif #ifdef HAVE_INET_NTOP @@ -1619,7 +1619,7 @@ PHP_FUNCTION(socket_recvfrom) ZEND_TRY_ASSIGN_REF_STRING(arg5, address ? address : "0.0.0.0"); ZEND_TRY_ASSIGN_REF_LONG(arg6, ntohs(sin.sin_port)); break; -#if HAVE_IPV6 +#ifdef HAVE_IPV6 case AF_INET6: slen = sizeof(sin6); memset(&sin6, 0, slen); @@ -1664,7 +1664,7 @@ PHP_FUNCTION(socket_sendto) php_socket *php_sock; struct sockaddr_un s_un; struct sockaddr_in sin; -#if HAVE_IPV6 +#ifdef HAVE_IPV6 struct sockaddr_in6 sin6; #endif int retval; @@ -1710,7 +1710,7 @@ PHP_FUNCTION(socket_sendto) retval = sendto(php_sock->bsd_socket, buf, ((size_t)len > buf_len) ? buf_len : (size_t)len, flags, (struct sockaddr *) &sin, sizeof(sin)); break; -#if HAVE_IPV6 +#ifdef HAVE_IPV6 case AF_INET6: if (port_is_null) { zend_argument_value_error(6, "cannot be null when the socket type is AF_INET6"); @@ -1781,7 +1781,7 @@ PHP_FUNCTION(socket_get_option) } } } -#if HAVE_IPV6 +#ifdef HAVE_IPV6 else if (level == IPPROTO_IPV6) { int ret = php_do_getsockopt_ipv6_rfc3542(php_sock, level, optname, return_value); if (ret == SUCCESS) { @@ -1908,7 +1908,7 @@ PHP_FUNCTION(socket_set_option) HANDLE_SUBCALL(res); } -#if HAVE_IPV6 +#ifdef HAVE_IPV6 else if (level == IPPROTO_IPV6) { int res = php_do_setsockopt_ipv6_mcast(php_sock, level, optname, arg4); if (res == 1) { @@ -2038,7 +2038,7 @@ PHP_FUNCTION(socket_create_pair) } if (domain != AF_INET -#if HAVE_IPV6 +#ifdef HAVE_IPV6 && domain != AF_INET6 #endif && domain != AF_UNIX) { @@ -2271,7 +2271,7 @@ PHP_FUNCTION(socket_export_stream) /* Determine if socket is using a protocol with one of the default registered * socket stream wrappers */ if (socket->type == PF_INET -#if HAVE_IPV6 +#ifdef HAVE_IPV6 || socket->type == PF_INET6 #endif ) { @@ -2448,7 +2448,7 @@ PHP_FUNCTION(socket_addrinfo_bind) } case AF_INET: -#if HAVE_IPV6 +#ifdef HAVE_IPV6 case AF_INET6: #endif { @@ -2511,7 +2511,7 @@ PHP_FUNCTION(socket_addrinfo_connect) } case AF_INET: -#if HAVE_IPV6 +#ifdef HAVE_IPV6 case AF_INET6: #endif { @@ -2568,7 +2568,7 @@ PHP_FUNCTION(socket_addrinfo_explain) add_assoc_string(&sockaddr, "sin_addr", addr); break; } -#if HAVE_IPV6 +#ifdef HAVE_IPV6 case AF_INET6: { struct sockaddr_in6 *sa = (struct sockaddr_in6 *) ai->addrinfo.ai_addr; diff --git a/ext/standard/base64.c b/ext/standard/base64.c index 7a237d09ecc2e..c80749efc3226 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -325,12 +325,12 @@ static zend_always_inline int php_base64_decode_impl(const unsigned char *in, si /* {{{ php_base64_encode */ -#if ZEND_INTRIN_AVX2_NATIVE +#ifdef ZEND_INTRIN_AVX2_NATIVE # undef ZEND_INTRIN_SSSE3_NATIVE # undef ZEND_INTRIN_SSSE3_RESOLVER # undef ZEND_INTRIN_SSSE3_FUNC_PROTO # undef ZEND_INTRIN_SSSE3_FUNC_PTR -#elif ZEND_INTRIN_AVX2_FUNC_PROTO && ZEND_INTRIN_SSSE3_NATIVE +#elif defined(ZEND_INTRIN_AVX2_FUNC_PROTO) && defined(ZEND_INTRIN_SSSE3_NATIVE) # undef ZEND_INTRIN_SSSE3_NATIVE # undef ZEND_INTRIN_SSSE3_RESOLVER # define ZEND_INTRIN_SSSE3_RESOLVER 1 @@ -341,7 +341,7 @@ static zend_always_inline int php_base64_decode_impl(const unsigned char *in, si # else # define ZEND_INTRIN_SSSE3_FUNC_DECL(func) ZEND_API func # endif -#elif ZEND_INTRIN_AVX2_FUNC_PTR && ZEND_INTRIN_SSSE3_NATIVE +#elif defined(ZEND_INTRIN_AVX2_FUNC_PTR) && defined(ZEND_INTRIN_SSSE3_NATIVE) # undef ZEND_INTRIN_SSSE3_NATIVE # undef ZEND_INTRIN_SSSE3_RESOLVER # define ZEND_INTRIN_SSSE3_RESOLVER 1 @@ -354,24 +354,24 @@ static zend_always_inline int php_base64_decode_impl(const unsigned char *in, si # endif #endif -#if ZEND_INTRIN_AVX2_NATIVE +#ifdef ZEND_INTRIN_AVX2_NATIVE # include -#elif ZEND_INTRIN_SSSE3_NATIVE +#elif defined(ZEND_INTRIN_SSSE3_NATIVE) # include -#elif (ZEND_INTRIN_SSSE3_RESOLVER || ZEND_INTRIN_AVX2_RESOLVER) -# if ZEND_INTRIN_AVX2_RESOLVER +#elif (defined(ZEND_INTRIN_SSSE3_RESOLVER) || defined(ZEND_INTRIN_AVX2_RESOLVER)) +# ifdef ZEND_INTRIN_AVX2_RESOLVER # include # else # include # endif /* (ZEND_INTRIN_SSSE3_RESOLVER || ZEND_INTRIN_AVX2_RESOLVER) */ # include "Zend/zend_cpuinfo.h" -# if ZEND_INTRIN_AVX2_RESOLVER +# ifdef ZEND_INTRIN_AVX2_RESOLVER ZEND_INTRIN_AVX2_FUNC_DECL(zend_string *php_base64_encode_avx2(const unsigned char *str, size_t length)); ZEND_INTRIN_AVX2_FUNC_DECL(zend_string *php_base64_decode_ex_avx2(const unsigned char *str, size_t length, bool strict)); # endif -# if ZEND_INTRIN_SSSE3_RESOLVER +# ifdef ZEND_INTRIN_SSSE3_RESOLVER ZEND_INTRIN_SSSE3_FUNC_DECL(zend_string *php_base64_encode_ssse3(const unsigned char *str, size_t length)); ZEND_INTRIN_SSSE3_FUNC_DECL(zend_string *php_base64_decode_ex_ssse3(const unsigned char *str, size_t length, bool strict)); # endif @@ -379,7 +379,7 @@ ZEND_INTRIN_SSSE3_FUNC_DECL(zend_string *php_base64_decode_ex_ssse3(const unsign zend_string *php_base64_encode_default(const unsigned char *str, size_t length); zend_string *php_base64_decode_ex_default(const unsigned char *str, size_t length, bool strict); -# if (ZEND_INTRIN_AVX2_FUNC_PROTO || ZEND_INTRIN_SSSE3_FUNC_PROTO) +# if (defined(ZEND_INTRIN_AVX2_FUNC_PROTO) || defined(ZEND_INTRIN_SSSE3_FUNC_PROTO)) PHPAPI zend_string *php_base64_encode(const unsigned char *str, size_t length) __attribute__((ifunc("resolve_base64_encode"))); PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length, bool strict) __attribute__((ifunc("resolve_base64_decode"))); @@ -389,12 +389,12 @@ typedef zend_string *(*base64_decode_func_t)(const unsigned char *, size_t, bool ZEND_NO_SANITIZE_ADDRESS ZEND_ATTRIBUTE_UNUSED /* clang mistakenly warns about this */ static base64_encode_func_t resolve_base64_encode(void) { -# if ZEND_INTRIN_AVX2_FUNC_PROTO +# ifdef ZEND_INTRIN_AVX2_FUNC_PROTO if (zend_cpu_supports_avx2()) { return php_base64_encode_avx2; } else # endif -#if ZEND_INTRIN_SSSE3_FUNC_PROTO +#ifdef ZEND_INTRIN_SSSE3_FUNC_PROTO if (zend_cpu_supports_ssse3()) { return php_base64_encode_ssse3; } @@ -405,12 +405,12 @@ static base64_encode_func_t resolve_base64_encode(void) { ZEND_NO_SANITIZE_ADDRESS ZEND_ATTRIBUTE_UNUSED /* clang mistakenly warns about this */ static base64_decode_func_t resolve_base64_decode(void) { -# if ZEND_INTRIN_AVX2_FUNC_PROTO +# ifdef ZEND_INTRIN_AVX2_FUNC_PROTO if (zend_cpu_supports_avx2()) { return php_base64_decode_ex_avx2; } else # endif -#if ZEND_INTRIN_SSSE3_FUNC_PROTO +#ifdef ZEND_INTRIN_SSSE3_FUNC_PROTO if (zend_cpu_supports_ssse3()) { return php_base64_decode_ex_ssse3; } @@ -431,13 +431,13 @@ PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length PHP_MINIT_FUNCTION(base64_intrin) { -# if ZEND_INTRIN_AVX2_FUNC_PTR +# ifdef ZEND_INTRIN_AVX2_FUNC_PTR if (zend_cpu_supports_avx2()) { php_base64_encode_ptr = php_base64_encode_avx2; php_base64_decode_ex_ptr = php_base64_decode_ex_avx2; } else # endif -#if ZEND_INTRIN_SSSE3_FUNC_PTR +#ifdef ZEND_INTRIN_SSSE3_FUNC_PTR if (zend_cpu_supports_ssse3()) { php_base64_encode_ptr = php_base64_encode_ssse3; php_base64_decode_ex_ptr = php_base64_decode_ex_ssse3; @@ -452,8 +452,8 @@ PHP_MINIT_FUNCTION(base64_intrin) # endif /* (ZEND_INTRIN_AVX2_FUNC_PROTO || ZEND_INTRIN_SSSE3_FUNC_PROTO) */ #endif /* ZEND_INTRIN_AVX2_NATIVE */ -#if ZEND_INTRIN_AVX2_NATIVE || ZEND_INTRIN_AVX2_RESOLVER -# if ZEND_INTRIN_AVX2_RESOLVER && defined(HAVE_FUNC_ATTRIBUTE_TARGET) +#if defined(ZEND_INTRIN_AVX2_NATIVE) || defined(ZEND_INTRIN_AVX2_RESOLVER) +# if defined(ZEND_INTRIN_AVX2_RESOLVER) && defined(HAVE_FUNC_ATTRIBUTE_TARGET) static __m256i php_base64_encode_avx2_reshuffle(__m256i in) __attribute__((target("avx2"))); static __m256i php_base64_encode_avx2_translate(__m256i in) __attribute__((target("avx2"))); # endif @@ -517,9 +517,9 @@ static __m256i php_base64_encode_avx2_translate(__m256i in) } #endif /* ZEND_INTRIN_AVX2_NATIVE || (ZEND_INTRIN_AVX2_RESOLVER && !ZEND_INTRIN_SSSE3_NATIVE) */ -#if ZEND_INTRIN_SSSE3_NATIVE || ZEND_INTRIN_SSSE3_RESOLVER +#if defined(ZEND_INTRIN_SSSE3_NATIVE) || defined(ZEND_INTRIN_SSSE3_RESOLVER) -# if ZEND_INTRIN_SSSE3_RESOLVER && defined(HAVE_FUNC_ATTRIBUTE_TARGET) +# if defined(ZEND_INTRIN_SSSE3_RESOLVER) && defined(HAVE_FUNC_ATTRIBUTE_TARGET) static __m128i php_base64_encode_ssse3_reshuffle(__m128i in) __attribute__((target("ssse3"))); static __m128i php_base64_encode_ssse3_translate(__m128i in) __attribute__((target("ssse3"))); # endif @@ -600,10 +600,10 @@ static __m128i php_base64_encode_ssse3_translate(__m128i in) #endif /* ZEND_INTRIN_SSSE3_NATIVE || (ZEND_INTRIN_SSSE3_RESOLVER && !ZEND_INTRIN_AVX2_NATIVE) */ -#if ZEND_INTRIN_AVX2_NATIVE || ZEND_INTRIN_AVX2_RESOLVER || ZEND_INTRIN_SSSE3_NATIVE || ZEND_INTRIN_SSSE3_RESOLVER -# if ZEND_INTRIN_AVX2_NATIVE || ZEND_INTRIN_SSSE3_NATIVE +#if defined(ZEND_INTRIN_AVX2_NATIVE) || defined(ZEND_INTRIN_AVX2_RESOLVER) || defined(ZEND_INTRIN_SSSE3_NATIVE) || defined(ZEND_INTRIN_SSSE3_RESOLVER) +# if defined(ZEND_INTRIN_AVX2_NATIVE) || defined(ZEND_INTRIN_SSSE3_NATIVE) PHPAPI zend_string *php_base64_encode(const unsigned char *str, size_t length) -# elif ZEND_INTRIN_AVX2_RESOLVER +# elif defined(ZEND_INTRIN_AVX2_RESOLVER) zend_string *php_base64_encode_avx2(const unsigned char *str, size_t length) # else /* ZEND_INTRIN_SSSE3_RESOLVER */ zend_string *php_base64_encode_ssse3(const unsigned char *str, size_t length) @@ -615,7 +615,7 @@ zend_string *php_base64_encode_ssse3(const unsigned char *str, size_t length) result = zend_string_safe_alloc(((length + 2) / 3), 4 * sizeof(char), 0, 0); o = (unsigned char *)ZSTR_VAL(result); -# if ZEND_INTRIN_AVX2_NATIVE || ZEND_INTRIN_AVX2_RESOLVER +# if defined(ZEND_INTRIN_AVX2_NATIVE) || defined(ZEND_INTRIN_AVX2_RESOLVER) if (length > 31) { __m256i s = _mm256_loadu_si256((__m256i *)c); @@ -647,7 +647,7 @@ zend_string *php_base64_encode_ssse3(const unsigned char *str, size_t length) return result; } -# if ZEND_INTRIN_SSSE3_RESOLVER && ZEND_INTRIN_AVX2_RESOLVER +# if defined(ZEND_INTRIN_SSSE3_RESOLVER) && defined(ZEND_INTRIN_AVX2_RESOLVER) zend_string *php_base64_encode_ssse3(const unsigned char *str, size_t length) { const unsigned char *c = str; @@ -670,8 +670,8 @@ zend_string *php_base64_encode_ssse3(const unsigned char *str, size_t length) /* }}} */ -#if ZEND_INTRIN_AVX2_NATIVE || ZEND_INTRIN_AVX2_RESOLVER -# if ZEND_INTRIN_AVX2_RESOLVER && defined(HAVE_FUNC_ATTRIBUTE_TARGET) +#if defined(ZEND_INTRIN_AVX2_NATIVE) || defined(ZEND_INTRIN_AVX2_RESOLVER) +# if defined(ZEND_INTRIN_AVX2_RESOLVER) && defined(HAVE_FUNC_ATTRIBUTE_TARGET) static __m256i php_base64_decode_avx2_reshuffle(__m256i in) __attribute__((target("avx2"))); # endif @@ -691,8 +691,8 @@ static __m256i php_base64_decode_avx2_reshuffle(__m256i in) } #endif -#if ZEND_INTRIN_SSSE3_NATIVE || ZEND_INTRIN_SSSE3_RESOLVER -# if ZEND_INTRIN_SSSE3_RESOLVER && defined(HAVE_FUNC_ATTRIBUTE_TARGET) +#if defined(ZEND_INTRIN_SSSE3_NATIVE) || defined(ZEND_INTRIN_SSSE3_RESOLVER) +# if defined(ZEND_INTRIN_SSSE3_RESOLVER) && defined(HAVE_FUNC_ATTRIBUTE_TARGET) static __m128i php_base64_decode_ssse3_reshuffle(__m128i in) __attribute__((target("ssse3"))); # endif @@ -773,10 +773,10 @@ static __m128i php_base64_decode_ssse3_reshuffle(__m128i in) #endif -#if ZEND_INTRIN_AVX2_NATIVE || ZEND_INTRIN_AVX2_RESOLVER || ZEND_INTRIN_SSSE3_NATIVE || ZEND_INTRIN_SSSE3_RESOLVER -# if ZEND_INTRIN_AVX2_NATIVE || ZEND_INTRIN_SSSE3_NATIVE +#if defined(ZEND_INTRIN_AVX2_NATIVE) || defined(ZEND_INTRIN_AVX2_RESOLVER) || defined(ZEND_INTRIN_SSSE3_NATIVE) || defined(ZEND_INTRIN_SSSE3_RESOLVER) +# if defined(ZEND_INTRIN_AVX2_NATIVE) || defined(ZEND_INTRIN_SSSE3_NATIVE) PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length, bool strict) -# elif ZEND_INTRIN_AVX2_RESOLVER +# elif defined(ZEND_INTRIN_AVX2_RESOLVER) zend_string *php_base64_decode_ex_avx2(const unsigned char *str, size_t length, bool strict) # else zend_string *php_base64_decode_ex_ssse3(const unsigned char *str, size_t length, bool strict) @@ -792,7 +792,7 @@ zend_string *php_base64_decode_ex_ssse3(const unsigned char *str, size_t length, /* See: "Faster Base64 Encoding and Decoding using AVX2 Instructions" * https://arxiv.org/pdf/1704.00605.pdf */ -# if ZEND_INTRIN_AVX2_NATIVE || ZEND_INTRIN_AVX2_RESOLVER +# if defined(ZEND_INTRIN_AVX2_NATIVE) || defined(ZEND_INTRIN_AVX2_RESOLVER) while (length > 31 + 11 + 2) { __m256i lut_lo, lut_hi, lut_roll; __m256i hi_nibbles, lo_nibbles, hi, lo; @@ -880,12 +880,12 @@ zend_string *php_base64_decode_ex_ssse3(const unsigned char *str, size_t length, # endif #endif /* ZEND_INTRIN_AVX2_NATIVE || ZEND_INTRIN_AVX2_RESOLVER || ZEND_INTRIN_SSSE3_NATIVE || ZEND_INTRIN_SSSE3_RESOLVER */ -#if !ZEND_INTRIN_AVX2_NATIVE && !ZEND_INTRIN_SSSE3_NATIVE -#if ZEND_INTRIN_AVX2_RESOLVER || ZEND_INTRIN_SSSE3_RESOLVER +#if !defined(ZEND_INTRIN_AVX2_NATIVE) && !defined(ZEND_INTRIN_SSSE3_NATIVE) +# if defined(ZEND_INTRIN_AVX2_RESOLVER) || defined(ZEND_INTRIN_SSSE3_RESOLVER) zend_string *php_base64_encode_default(const unsigned char *str, size_t length) -#else +# else PHPAPI zend_string *php_base64_encode(const unsigned char *str, size_t length) -#endif +# endif { unsigned char *p; zend_string *result; @@ -901,8 +901,8 @@ PHPAPI zend_string *php_base64_encode(const unsigned char *str, size_t length) } #endif -#if !ZEND_INTRIN_AVX2_NATIVE && !ZEND_INTRIN_SSSE3_NATIVE -#if ZEND_INTRIN_AVX2_RESOLVER || ZEND_INTRIN_SSSE3_RESOLVER +#if !defined(ZEND_INTRIN_AVX2_NATIVE) && !defined(ZEND_INTRIN_SSSE3_NATIVE) +# if defined(ZEND_INTRIN_AVX2_RESOLVER) || defined(ZEND_INTRIN_SSSE3_RESOLVER) zend_string *php_base64_decode_ex_default(const unsigned char *str, size_t length, bool strict) #else PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length, bool strict) diff --git a/ext/standard/base64.h b/ext/standard/base64.h index 5c4cfff42b442..5a590c3614ea2 100644 --- a/ext/standard/base64.h +++ b/ext/standard/base64.h @@ -57,7 +57,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if (ZEND_INTRIN_AVX2_FUNC_PTR || ZEND_INTRIN_SSSE3_FUNC_PTR) && !ZEND_INTRIN_AVX2_NATIVE +#if (defined(ZEND_INTRIN_AVX2_FUNC_PTR) || defined(ZEND_INTRIN_SSSE3_FUNC_PTR)) && !defined(ZEND_INTRIN_AVX2_NATIVE) PHP_MINIT_FUNCTION(base64_intrin); #endif diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c index d13eee14fbe9d..396bf80d2b1c6 100644 --- a/ext/standard/crc32.c +++ b/ext/standard/crc32.c @@ -98,7 +98,7 @@ PHPAPI uint32_t php_crc32_bulk_update(uint32_t crc, const char *p, size_t nr) } #endif -#if ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE || ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER +#if defined(ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE) || defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER) size_t nr_simd = crc32_x86_simd_update(X86_CRC32B, &crc, (const unsigned char *)p, nr); nr -= nr_simd; p += nr_simd; diff --git a/ext/standard/crc32_x86.c b/ext/standard/crc32_x86.c index fdcbed8782557..4a5198ea7cc3b 100644 --- a/ext/standard/crc32_x86.c +++ b/ext/standard/crc32_x86.c @@ -19,16 +19,16 @@ #include "crc32_x86.h" -#if ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE || ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER +#if defined(ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE) || defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER) # include # include #endif -#if ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER +#ifdef ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER # include "Zend/zend_cpuinfo.h" #endif -#if ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE || ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER +#if defined(ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE) || defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER) typedef struct _crc32_pclmul_bit_consts { uint64_t k1k2[2]; @@ -287,7 +287,7 @@ size_t crc32_pclmul_reflected_batch(uint32_t *crc, const unsigned char *p, size_ return (nr_in - nr); /* the nr processed */ } -# if ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE +# ifdef ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE size_t crc32_x86_simd_update(X86_CRC32_TYPE type, uint32_t *crc, const unsigned char *p, size_t nr) # else /* ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER */ size_t crc32_sse42_pclmul_update(X86_CRC32_TYPE type, uint32_t *crc, const unsigned char *p, size_t nr) diff --git a/ext/standard/crc32_x86.h b/ext/standard/crc32_x86.h index 6420030dbf5dc..91b5ba80e691e 100644 --- a/ext/standard/crc32_x86.h +++ b/ext/standard/crc32_x86.h @@ -35,11 +35,11 @@ typedef enum { X86_CRC32_MAX, } X86_CRC32_TYPE; -#if ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PTR +#ifdef ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PTR PHP_MINIT_FUNCTION(crc32_x86_intrin); #endif -#if ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE || ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER +#if defined(ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE) || defined(ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER) /* Return the size processed by SIMD routine */ size_t crc32_x86_simd_update(X86_CRC32_TYPE type, uint32_t *crc, const unsigned char *p, size_t nr); #else diff --git a/ext/standard/random.c b/ext/standard/random.c index bea2a474d4408..37518fc97c30e 100644 --- a/ext/standard/random.c +++ b/ext/standard/random.c @@ -31,7 +31,7 @@ #endif #if HAVE_SYS_PARAM_H # include -# if (__FreeBSD__ && __FreeBSD_version > 1200000) || (__DragonFly__ && __DragonFly_version >= 500700) || defined(__sun) +# if (defined(__FreeBSD__) && __FreeBSD_version > 1200000) || (defined(__DragonFly__) && __DragonFly_version >= 500700) || defined(__sun) # include # endif #endif diff --git a/main/internal_functions_win32.c b/main/internal_functions_win32.c index eebafc43d34fa..648c09054594f 100644 --- a/main/internal_functions_win32.c +++ b/main/internal_functions_win32.c @@ -58,39 +58,39 @@ #endif #include "ext/standard/reg.h" #include "ext/pcre/php_pcre.h" -#if HAVE_UODBC +#ifdef HAVE_UODBC #include "ext/odbc/php_odbc.h" #endif -#if HAVE_PHP_SESSION +#ifdef HAVE_PHP_SESSION #include "ext/session/php_session.h" #endif -#if HAVE_MBSTRING +#ifdef HAVE_MBSTRING #include "ext/mbstring/mbstring.h" #endif -#if HAVE_TOKENIZER +#ifdef HAVE_TOKENIZER #include "ext/tokenizer/php_tokenizer.h" #endif -#if HAVE_ZLIB +#ifdef HAVE_ZLIB #include "ext/zlib/php_zlib.h" #endif -#if HAVE_LIBXML +#ifdef HAVE_LIBXML #include "ext/libxml/php_libxml.h" -#if HAVE_DOM +#ifdef HAVE_DOM #include "ext/dom/php_dom.h" #endif -#if HAVE_SIMPLEXML +#ifdef HAVE_SIMPLEXML #include "ext/simplexml/php_simplexml.h" #endif #endif -#if HAVE_XML +#ifdef HAVE_XML #include "ext/xml/php_xml.h" #endif #include "ext/com_dotnet/php_com_dotnet.h" #include "ext/spl/php_spl.h" -#if HAVE_XML && HAVE_XMLREADER +#if defined(HAVE_XML) && defined(HAVE_XMLREADER) #include "ext/xmlreader/php_xmlreader.h" #endif -#if HAVE_XML && HAVE_XMLWRITER +#if defined(HAVE_XML) && defined(HAVE_XMLWRITER) #include "ext/xmlwriter/php_xmlwriter.h" #endif /* }}} */ @@ -98,58 +98,58 @@ /* {{{ php_builtin_extensions[] */ static zend_module_entry * const php_builtin_extensions[] = { phpext_standard_ptr -#if HAVE_BCMATH +#ifdef HAVE_BCMATH ,phpext_bcmath_ptr #endif -#if HAVE_CALENDAR +#ifdef HAVE_CALENDAR ,phpext_calendar_ptr #endif ,phpext_com_dotnet_ptr -#if HAVE_CTYPE +#ifdef HAVE_CTYPE ,phpext_ctype_ptr #endif ,phpext_date_ptr -#if HAVE_FTP +#ifdef HAVE_FTP ,phpext_ftp_ptr #endif ,phpext_hash_ptr -#if HAVE_ICONV +#ifdef HAVE_ICONV ,phpext_iconv_ptr #endif -#if HAVE_MBSTRING +#ifdef HAVE_MBSTRING ,phpext_mbstring_ptr #endif -#if HAVE_UODBC +#ifdef HAVE_UODBC ,phpext_odbc_ptr #endif ,phpext_pcre_ptr ,phpext_reflection_ptr -#if HAVE_PHP_SESSION +#ifdef HAVE_PHP_SESSION ,phpext_session_ptr #endif -#if HAVE_TOKENIZER +#ifdef HAVE_TOKENIZER ,phpext_tokenizer_ptr #endif -#if HAVE_ZLIB +#ifdef HAVE_ZLIB ,phpext_zlib_ptr #endif -#if HAVE_LIBXML +#ifdef HAVE_LIBXML ,phpext_libxml_ptr -#if HAVE_DOM +#ifdef HAVE_DOM ,phpext_dom_ptr #endif -#if HAVE_SIMPLEXML +#ifdef HAVE_SIMPLEXML ,phpext_simplexml_ptr #endif #endif -#if HAVE_XML +#ifdef HAVE_XML ,phpext_xml_ptr #endif ,phpext_spl_ptr -#if HAVE_XML && HAVE_XMLREADER +#if defined(HAVE_XML) && defined(HAVE_XMLREADER) ,phpext_xmlreader_ptr #endif -#if HAVE_XML && HAVE_XMLWRITER +#if defined(HAVE_XML) && defined(HAVE_XMLWRITER) ,phpext_xmlwriter_ptr #endif };