diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 1bf59ae5f9b24..6d8b765578b41 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1302,20 +1302,20 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, bool gmt) ta.tm_yday = timelib_day_of_year(ts->y, ts->m, ts->d); if (gmt) { ta.tm_isdst = 0; -#if HAVE_STRUCT_TM_TM_GMTOFF +#ifdef HAVE_STRUCT_TM_TM_GMTOFF ta.tm_gmtoff = 0; #endif -#if HAVE_STRUCT_TM_TM_ZONE +#ifdef HAVE_STRUCT_TM_TM_ZONE ta.tm_zone = "GMT"; #endif } else { offset = timelib_get_time_zone_info(timestamp, tzi); ta.tm_isdst = offset->is_dst; -#if HAVE_STRUCT_TM_TM_GMTOFF +#ifdef HAVE_STRUCT_TM_TM_GMTOFF ta.tm_gmtoff = offset->offset; #endif -#if HAVE_STRUCT_TM_TM_ZONE +#ifdef HAVE_STRUCT_TM_TM_ZONE ta.tm_zone = offset->abbr; #endif } diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index d2279d27bf769..78f48d84e96ad 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -58,7 +58,7 @@ #ifdef PHP_ICONV_IMPL #define PHP_ICONV_IMPL_VALUE PHP_ICONV_IMPL -#elif HAVE_LIBICONV +#elif defined(HAVE_LIBICONV) #define PHP_ICONV_IMPL_VALUE "libiconv" #else #define PHP_ICONV_IMPL_VALUE "unknown" diff --git a/ext/random/csprng.c b/ext/random/csprng.c index 1bb31bffa20ff..429fe88a84201 100644 --- a/ext/random/csprng.c +++ b/ext/random/csprng.c @@ -52,7 +52,7 @@ # endif #endif -#if HAVE_COMMONCRYPTO_COMMONRANDOM_H +#ifdef HAVE_COMMONCRYPTO_COMMONRANDOM_H # include # include #endif @@ -71,7 +71,7 @@ PHPAPI zend_result php_random_bytes(void *bytes, size_t size, bool should_throw) } return FAILURE; } -#elif HAVE_COMMONCRYPTO_COMMONRANDOM_H +#elif defined(HAVE_COMMONCRYPTO_COMMONRANDOM_H) /* * Purposely prioritized upon arc4random_buf for modern macOs releases * arc4random api on this platform uses `ccrng_generate` which returns diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c index cc0ae36ecb5e4..198ec02583edc 100644 --- a/ext/sockets/conversions.c +++ b/ext/sockets/conversions.c @@ -1261,7 +1261,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 1cfdf1e18d481..4d13b9e94ca3f 100644 --- a/ext/sockets/multicast.c +++ b/ext/sockets/multicast.c @@ -61,7 +61,7 @@ static int _php_source_op_to_ipv4_op(enum source_op sop); zend_result 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); diff --git a/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h index 42db7679522ed..d7a79714a2c91 100644 --- a/ext/sockets/php_sockets.h +++ b/ext/sockets/php_sockets.h @@ -24,7 +24,7 @@ # include "config.h" #endif -#if HAVE_SOCKETS +#ifdef HAVE_SOCKETS #include #ifdef PHP_WIN32 diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 1de50d9f88788..b532e942710fa 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -51,7 +51,7 @@ # include # define set_errno(a) (errno = a) # include "php_sockets.h" -# if HAVE_IF_NAMETOINDEX +# ifdef HAVE_IF_NAMETOINDEX # include # endif # if defined(HAVE_LINUX_SOCK_DIAG_H) diff --git a/main/streams/cast.c b/main/streams/cast.c index 238212c745ed4..d4a0b22899ddf 100644 --- a/main/streams/cast.c +++ b/main/streams/cast.c @@ -128,7 +128,7 @@ static int stream_cookie_closer(void *cookie) } #endif /* elif defined(HAVE_FOPENCOOKIE) */ -#if HAVE_FOPENCOOKIE +#ifdef HAVE_FOPENCOOKIE static cookie_io_functions_t stream_cookie_functions = { stream_cookie_reader, stream_cookie_writer, @@ -220,7 +220,7 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show goto exit_success; } -#if HAVE_FOPENCOOKIE +#ifdef HAVE_FOPENCOOKIE /* if just checking, say yes we can be a FILE*, but don't actually create it yet */ if (ret == NULL) { goto exit_success; diff --git a/main/streams/userspace.c b/main/streams/userspace.c index 2a7380ce8f3a6..d765448d7a636 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -816,7 +816,7 @@ static int statbuf_from_array(zval *array, php_stream_statbuf *ssb) STAT_PROP_ENTRY(nlink); STAT_PROP_ENTRY(uid); STAT_PROP_ENTRY(gid); -#if HAVE_STRUCT_STAT_ST_RDEV +#ifdef HAVE_STRUCT_STAT_ST_RDEV STAT_PROP_ENTRY(rdev); #endif STAT_PROP_ENTRY(size); diff --git a/sapi/fuzzer/fuzzer-exif.c b/sapi/fuzzer/fuzzer-exif.c index cb16bb90233a0..e35ee9af23e1e 100644 --- a/sapi/fuzzer/fuzzer-exif.c +++ b/sapi/fuzzer/fuzzer-exif.c @@ -31,7 +31,7 @@ #include "fuzzer-sapi.h" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { -#if HAVE_EXIF +#ifdef HAVE_EXIF php_stream *stream; zval stream_zv;