Skip to content

Commit 5ee023e

Browse files
committed
Fix [-Wundef] warnigns in standard extension
1 parent e3bea13 commit 5ee023e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+250
-251
lines changed

ext/standard/basic_functions.c

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,22 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
6767
#include "win32/inet.h"
6868
#endif
6969

70-
#if HAVE_ARPA_INET_H
70+
#ifdef HAVE_ARPA_INET_H
7171
# include <arpa/inet.h>
7272
#endif
7373

74-
#if HAVE_UNISTD_H
74+
#ifdef HAVE_UNISTD_H
7575
# include <unistd.h>
7676
#endif
7777

7878
#include <string.h>
7979
#include <locale.h>
8080

81-
#if HAVE_SYS_MMAN_H
81+
#ifdef HAVE_SYS_MMAN_H
8282
# include <sys/mman.h>
8383
#endif
8484

85-
#if HAVE_SYS_LOADAVG_H
85+
#ifdef HAVE_SYS_LOADAVG_H
8686
# include <sys/loadavg.h>
8787
#endif
8888

@@ -91,7 +91,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
9191
#endif
9292

9393
#ifndef INADDR_NONE
94-
#define INADDR_NONE ((zend_ulong) -1)
94+
# define INADDR_NONE ((zend_ulong) -1)
9595
#endif
9696

9797
#include "zend_globals.h"
@@ -141,25 +141,25 @@ zend_module_entry basic_functions_module = { /* {{{ */
141141
};
142142
/* }}} */
143143

144-
#if defined(HAVE_PUTENV)
144+
#ifdef HAVE_PUTENV
145145
static void php_putenv_destructor(zval *zv) /* {{{ */
146146
{
147147
putenv_entry *pe = Z_PTR_P(zv);
148148

149149
if (pe->previous_value) {
150-
# if defined(PHP_WIN32)
150+
# ifdef PHP_WIN32
151151
/* MSVCRT has a bug in putenv() when setting a variable that
152152
* is already set; if the SetEnvironmentVariable() API call
153153
* fails, the Crt will double free() a string.
154154
* We try to avoid this by setting our own value first */
155155
SetEnvironmentVariable(pe->key, "bugbug");
156156
# endif
157157
putenv(pe->previous_value);
158-
# if defined(PHP_WIN32)
158+
# ifdef PHP_WIN32
159159
efree(pe->previous_value);
160160
# endif
161161
} else {
162-
# if HAVE_UNSETENV
162+
# ifdef HAVE_UNSETENV
163163
unsetenv(pe->key);
164164
# elif defined(PHP_WIN32)
165165
SetEnvironmentVariable(pe->key, NULL);
@@ -273,14 +273,14 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
273273
{
274274
#ifdef ZTS
275275
ts_allocate_id(&basic_globals_id, sizeof(php_basic_globals), (ts_allocate_ctor) basic_globals_ctor, (ts_allocate_dtor) basic_globals_dtor);
276-
#ifdef PHP_WIN32
276+
# ifdef PHP_WIN32
277277
ts_allocate_id(&php_win32_core_globals_id, sizeof(php_win32_core_globals), (ts_allocate_ctor)php_win32_core_globals_ctor, (ts_allocate_dtor)php_win32_core_globals_dtor );
278-
#endif
278+
# endif
279279
#else
280280
basic_globals_ctor(&basic_globals);
281-
#ifdef PHP_WIN32
281+
# ifdef PHP_WIN32
282282
php_win32_core_globals_ctor(&the_php_win32_core_globals);
283-
#endif
283+
# endif
284284
#endif
285285

286286
php_register_incomplete_class();
@@ -335,7 +335,7 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
335335
REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_EVEN", PHP_ROUND_HALF_EVEN, CONST_CS | CONST_PERSISTENT);
336336
REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_ODD", PHP_ROUND_HALF_ODD, CONST_CS | CONST_PERSISTENT);
337337

338-
#if ENABLE_TEST_CLASS
338+
#ifdef ENABLE_TEST_CLASS
339339
test_class_startup();
340340
#endif
341341

@@ -352,23 +352,23 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
352352
BASIC_MINIT_SUBMODULE(password)
353353
BASIC_MINIT_SUBMODULE(mt_rand)
354354

355-
#if defined(ZTS)
355+
#ifdef ZTS
356356
BASIC_MINIT_SUBMODULE(localeconv)
357357
#endif
358358

359-
#if defined(HAVE_NL_LANGINFO)
359+
#ifdef HAVE_NL_LANGINFO
360360
BASIC_MINIT_SUBMODULE(nl_langinfo)
361361
#endif
362362

363-
#if ZEND_INTRIN_SSE4_2_FUNC_PTR
363+
#ifdef ZEND_INTRIN_SSE4_2_FUNC_PTR
364364
BASIC_MINIT_SUBMODULE(string_intrin)
365365
#endif
366366

367-
#if ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PTR
367+
#ifdef ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PTR
368368
BASIC_MINIT_SUBMODULE(crc32_x86_intrin)
369369
#endif
370370

371-
#if ZEND_INTRIN_AVX2_FUNC_PTR || ZEND_INTRIN_SSSE3_FUNC_PTR
371+
#if defined(ZEND_INTRIN_AVX2_FUNC_PTR) || defined(ZEND_INTRIN_SSSE3_FUNC_PTR)
372372
BASIC_MINIT_SUBMODULE(base64_intrin)
373373
#endif
374374

@@ -399,8 +399,8 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
399399
php_register_url_stream_wrapper("http", &php_stream_http_wrapper);
400400
php_register_url_stream_wrapper("ftp", &php_stream_ftp_wrapper);
401401

402-
#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC
403-
# if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS
402+
#if defined(PHP_WIN32) || defined(HAVE_DNS_SEARCH_FUNC)
403+
# if defined(PHP_WIN32) || defined(HAVE_FULL_DNS_FUNCS)
404404
BASIC_MINIT_SUBMODULE(dns)
405405
# endif
406406
#endif
@@ -440,7 +440,7 @@ PHP_MSHUTDOWN_FUNCTION(basic) /* {{{ */
440440
BASIC_MSHUTDOWN_SUBMODULE(url_scanner_ex)
441441
BASIC_MSHUTDOWN_SUBMODULE(file)
442442
BASIC_MSHUTDOWN_SUBMODULE(standard_filters)
443-
#if defined(ZTS)
443+
#ifdef ZTS
444444
BASIC_MSHUTDOWN_SUBMODULE(localeconv)
445445
#endif
446446
BASIC_MSHUTDOWN_SUBMODULE(crypt)
@@ -876,7 +876,7 @@ PHP_FUNCTION(putenv)
876876
pe.previous_value = NULL;
877877
for (env = environ; env != NULL && *env != NULL; env++) {
878878
if (!strncmp(*env, pe.key, pe.key_len) && (*env)[pe.key_len] == '=') { /* found it */
879-
#if defined(PHP_WIN32)
879+
#ifdef PHP_WIN32
880880
/* must copy previous value because MSVCRT's putenv can free the string without notice */
881881
pe.previous_value = estrdup(*env);
882882
#else
@@ -886,7 +886,7 @@ PHP_FUNCTION(putenv)
886886
}
887887
}
888888

889-
#if HAVE_UNSETENV
889+
#ifdef HAVE_UNSETENV
890890
if (!p) { /* no '=' means we want to unset it */
891891
unsetenv(pe.putenv_string);
892892
}
@@ -932,15 +932,15 @@ PHP_FUNCTION(putenv)
932932
}
933933
#endif
934934
tsrm_env_unlock();
935-
#if defined(PHP_WIN32)
935+
#ifdef PHP_WIN32
936936
free(keyw);
937937
free(valw);
938938
#endif
939939
RETURN_TRUE;
940940
} else {
941941
efree(pe.putenv_string);
942942
efree(pe.key);
943-
#if defined(PHP_WIN32)
943+
#ifdef PHP_WIN32
944944
free(keyw);
945945
free(valw);
946946
#endif
@@ -1245,13 +1245,13 @@ PHP_FUNCTION(usleep)
12451245
RETURN_THROWS();
12461246
}
12471247

1248-
#if HAVE_USLEEP
1248+
#ifdef HAVE_USLEEP
12491249
usleep((unsigned int)num);
12501250
#endif
12511251
}
12521252
/* }}} */
12531253

1254-
#if HAVE_NANOSLEEP
1254+
#ifdef HAVE_NANOSLEEP
12551255
/* {{{ Delay for a number of seconds and nano seconds */
12561256
PHP_FUNCTION(time_nanosleep)
12571257
{
@@ -2271,7 +2271,7 @@ PHP_FUNCTION(ignore_user_abort)
22712271
}
22722272
/* }}} */
22732273

2274-
#if HAVE_GETSERVBYNAME
2274+
#ifdef HAVE_GETSERVBYNAME
22752275
/* {{{ Returns port associated with service. Protocol must be "tcp" or "udp" */
22762276
PHP_FUNCTION(getservbyname)
22772277
{
@@ -2295,7 +2295,7 @@ PHP_FUNCTION(getservbyname)
22952295

22962296
serv = getservbyname(name, proto);
22972297

2298-
#if defined(_AIX)
2298+
#ifdef _AIX
22992299
/*
23002300
On AIX, imap is only known as imap2 in /etc/services, while on Linux imap is an alias for imap2.
23012301
If a request for imap gives no result, we try again with imap2.
@@ -2313,7 +2313,7 @@ PHP_FUNCTION(getservbyname)
23132313
/* }}} */
23142314
#endif
23152315

2316-
#if HAVE_GETSERVBYPORT
2316+
#ifdef HAVE_GETSERVBYPORT
23172317
/* {{{ Returns service name associated with port. Protocol must be "tcp" or "udp" */
23182318
PHP_FUNCTION(getservbyport)
23192319
{
@@ -2338,7 +2338,7 @@ PHP_FUNCTION(getservbyport)
23382338
/* }}} */
23392339
#endif
23402340

2341-
#if HAVE_GETPROTOBYNAME
2341+
#ifdef HAVE_GETPROTOBYNAME
23422342
/* {{{ Returns protocol number associated with name as per /etc/protocols */
23432343
PHP_FUNCTION(getprotobyname)
23442344
{
@@ -2361,7 +2361,7 @@ PHP_FUNCTION(getprotobyname)
23612361
/* }}} */
23622362
#endif
23632363

2364-
#if HAVE_GETPROTOBYNUMBER
2364+
#ifdef HAVE_GETPROTOBYNUMBER
23652365
/* {{{ Returns protocol name associated with protocol number proto */
23662366
PHP_FUNCTION(getprotobynumber)
23672367
{

ext/standard/basic_functions.stub.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ function sleep(int $seconds): int {}
281281

282282
function usleep(int $microseconds): void {}
283283

284-
#if HAVE_NANOSLEEP
284+
#ifdef HAVE_NANOSLEEP
285285
function time_nanosleep(int $seconds, int $nanoseconds): array|bool {}
286286

287287
function time_sleep_until(float $timestamp): bool {}
@@ -340,19 +340,19 @@ function connection_status(): int {}
340340

341341
function ignore_user_abort(?bool $value = null): int {}
342342

343-
#if HAVE_GETSERVBYNAME
343+
#ifdef HAVE_GETSERVBYNAME
344344
function getservbyname(string $service, string $protocol): int|false {}
345345
#endif
346346

347-
#if HAVE_GETSERVBYPORT
347+
#ifdef HAVE_GETSERVBYPORT
348348
function getservbyport(int $port, string $protocol): string|false {}
349349
#endif
350350

351-
#if HAVE_GETPROTOBYNAME
351+
#ifdef HAVE_GETPROTOBYNAME
352352
function getprotobyname(string $name): int|false {}
353353
#endif
354354

355-
#if HAVE_GETPROTOBYNUMBER
355+
#ifdef HAVE_GETPROTOBYNUMBER
356356
function getprotobynumber(int $protocol): string|false {}
357357
#endif
358358

@@ -390,7 +390,7 @@ function crypt(string $str, string $salt): string {}
390390

391391
/* datetime.c */
392392

393-
#if HAVE_STRPTIME
393+
#ifdef HAVE_STRPTIME
394394
function strptime(string $timestamp, string $format): array|false {}
395395
#endif
396396

@@ -406,7 +406,7 @@ function gethostbyname(string $hostname): string {}
406406

407407
function gethostbynamel(string $hostname): array|false {}
408408

409-
#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC
409+
#if defined(PHP_WIN32) || defined(HAVE_DNS_SEARCH_FUNC)
410410
function dns_check_record(string $hostname, string $type = "MX"): bool {}
411411

412412
/** @alias dns_check_record */
@@ -438,7 +438,7 @@ function net_get_interfaces(): array|false {}
438438

439439
/* ftok.c */
440440

441-
#if HAVE_FTOK
441+
#ifdef HAVE_FTOK
442442
function ftok(string $pathname, string $proj): int {}
443443
#endif
444444

@@ -546,7 +546,7 @@ function strspn(string $str, string $mask, int $start = 0, ?int $len = null): in
546546

547547
function strcspn(string $str, string $mask, int $start = 0, ?int $len = null): int {}
548548

549-
#if HAVE_NL_LANGINFO
549+
#ifdef HAVE_NL_LANGINFO
550550
function nl_langinfo(int $item): string|false {}
551551
#endif
552552

@@ -713,7 +713,7 @@ function closedir($dir_handle = null): void {}
713713

714714
function chdir(string $directory): bool {}
715715

716-
#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
716+
#if defined(HAVE_CHROOT) && !defined(ZTS) && defined(ENABLE_CHROOT_FUNC)
717717
function chroot(string $directory): bool {}
718718
#endif
719719

@@ -919,15 +919,15 @@ function chown(string $filename, string|int $user): bool {}
919919

920920
function chgrp(string $filename, string|int $group): bool {}
921921

922-
#if HAVE_LCHOWN
922+
#ifdef HAVE_LCHOWN
923923
function lchown(string $filename, string|int $user): bool {}
924924

925925
function lchgrp(string $filename, string|int $group): bool {}
926926
#endif
927927

928928
function chmod(string $filename, int $mode): bool {}
929929

930-
#if HAVE_UTIME
930+
#ifdef HAVE_UTIME
931931
function touch(string $filename, ?int $time = null, ?int $atime = null): bool {}
932932
#endif
933933

@@ -1288,7 +1288,7 @@ function stream_socket_enable_crypto($stream, bool $enable, ?int $crypto_type =
12881288
function stream_socket_shutdown($stream, int $how): bool {}
12891289
#endif
12901290

1291-
#if HAVE_SOCKETPAIR
1291+
#ifdef HAVE_SOCKETPAIR
12921292
function stream_socket_pair(int $domain, int $type, int $protocol): array|false {}
12931293
#endif
12941294

@@ -1357,7 +1357,7 @@ function sapi_windows_vt100_support($stream, ?bool $enable = null): bool {}
13571357
/** @param resource $stream */
13581358
function stream_set_chunk_size($stream, int $size): int {}
13591359

1360-
#if HAVE_SYS_TIME_H || defined(PHP_WIN32)
1360+
#if defined(HAVE_SYS_TIME_H) || defined(PHP_WIN32)
13611361
/** @param resource $socket */
13621362
function stream_set_timeout($socket, int $seconds, int $microseconds = 0): bool {}
13631363

0 commit comments

Comments
 (0)