1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

Sync #if/ifdef/defined (#14371)

These are either undefined or defined to value 1 in Autotools and
Windows:
- HAVE_COMMONCRYPTO_COMMONRANDOM_H
- HAVE_EXIF
- HAVE_FOPENCOOKIE
- HAVE_IF_NAMETOINDEX
- HAVE_LIBICONV
- HAVE_SOCKETS
- HAVE_STRUCT_STAT_ST_RDEV
- HAVE_STRUCT_TM_TM_GMTOFF
- HAVE_STRUCT_TM_TM_ZONE

Follow up of GH-5526 (-Wundef)
This commit is contained in:
Peter Kokot
2024-06-07 23:45:17 +02:00
committed by GitHub
parent 58f3b676f5
commit da86eec3db
10 changed files with 15 additions and 15 deletions

View File

@@ -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
}

View File

@@ -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"

View File

@@ -53,7 +53,7 @@
# endif
#endif
#if HAVE_COMMONCRYPTO_COMMONRANDOM_H
#ifdef HAVE_COMMONCRYPTO_COMMONRANDOM_H
# include <CommonCrypto/CommonCryptoError.h>
# include <CommonCrypto/CommonRandom.h>
#endif
@@ -74,7 +74,7 @@ ZEND_ATTRIBUTE_NONNULL PHPAPI zend_result php_random_bytes_ex(void *bytes, size_
snprintf(errstr, errstr_size, "Failed to retrieve randomness from the operating system (BCryptGenRandom)");
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

View File

@@ -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));

View File

@@ -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);

View File

@@ -24,7 +24,7 @@
# include "config.h"
#endif
#if HAVE_SOCKETS
#ifdef HAVE_SOCKETS
#include <php.h>
#ifdef PHP_WIN32

View File

@@ -51,7 +51,7 @@
# include <sys/uio.h>
# define set_errno(a) (errno = a)
# include "php_sockets.h"
# if HAVE_IF_NAMETOINDEX
# ifdef HAVE_IF_NAMETOINDEX
# include <net/if.h>
# endif
# if defined(HAVE_LINUX_SOCK_DIAG_H)

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;