Skip to content

Commit c5ea1f1

Browse files
committed
Fix [-Wundef] warnigns in standard extension
1 parent c88f231 commit c5ea1f1

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

+256
-257
lines changed

ext/standard/basic_functions.c

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

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

73-
#if HAVE_UNISTD_H
73+
#ifdef HAVE_UNISTD_H
7474
# include <unistd.h>
7575
#endif
7676

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

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

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

@@ -90,7 +90,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
9090
#endif
9191

9292
#ifndef INADDR_NONE
93-
#define INADDR_NONE ((zend_ulong) -1)
93+
# define INADDR_NONE ((zend_ulong) -1)
9494
#endif
9595

9696
#include "zend_globals.h"
@@ -142,25 +142,25 @@ zend_module_entry basic_functions_module = { /* {{{ */
142142
};
143143
/* }}} */
144144

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

150150
if (pe->previous_value) {
151-
# if defined(PHP_WIN32)
151+
# ifdef PHP_WIN32
152152
/* MSVCRT has a bug in putenv() when setting a variable that
153153
* is already set; if the SetEnvironmentVariable() API call
154154
* fails, the Crt will double free() a string.
155155
* We try to avoid this by setting our own value first */
156156
SetEnvironmentVariable(pe->key, "bugbug");
157157
# endif
158158
putenv(pe->previous_value);
159-
# if defined(PHP_WIN32)
159+
# ifdef PHP_WIN32
160160
efree(pe->previous_value);
161161
# endif
162162
} else {
163-
# if HAVE_UNSETENV
163+
# ifdef HAVE_UNSETENV
164164
unsetenv(pe->key);
165165
# elif defined(PHP_WIN32)
166166
SetEnvironmentVariable(pe->key, NULL);
@@ -275,14 +275,14 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
275275
{
276276
#ifdef ZTS
277277
ts_allocate_id(&basic_globals_id, sizeof(php_basic_globals), (ts_allocate_ctor) basic_globals_ctor, (ts_allocate_dtor) basic_globals_dtor);
278-
#ifdef PHP_WIN32
278+
# ifdef PHP_WIN32
279279
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 );
280-
#endif
280+
# endif
281281
#else
282282
basic_globals_ctor(&basic_globals);
283-
#ifdef PHP_WIN32
283+
# ifdef PHP_WIN32
284284
php_win32_core_globals_ctor(&the_php_win32_core_globals);
285-
#endif
285+
# endif
286286
#endif
287287

288288
BG(incomplete_class) = incomplete_class_entry = php_create_incomplete_class();
@@ -337,7 +337,7 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
337337
REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_EVEN", PHP_ROUND_HALF_EVEN, CONST_CS | CONST_PERSISTENT);
338338
REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_ODD", PHP_ROUND_HALF_ODD, CONST_CS | CONST_PERSISTENT);
339339

340-
#if ENABLE_TEST_CLASS
340+
#ifdef ENABLE_TEST_CLASS
341341
test_class_startup();
342342
#endif
343343

@@ -354,19 +354,19 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
354354
BASIC_MINIT_SUBMODULE(password)
355355
BASIC_MINIT_SUBMODULE(mt_rand)
356356

357-
#if defined(ZTS)
357+
#ifdef ZTS
358358
BASIC_MINIT_SUBMODULE(localeconv)
359359
#endif
360360

361-
#if defined(HAVE_NL_LANGINFO)
361+
#ifdef HAVE_NL_LANGINFO
362362
BASIC_MINIT_SUBMODULE(nl_langinfo)
363363
#endif
364364

365-
#if ZEND_INTRIN_SSE4_2_FUNC_PTR
365+
#ifdef ZEND_INTRIN_SSE4_2_FUNC_PTR
366366
BASIC_MINIT_SUBMODULE(string_intrin)
367367
#endif
368368

369-
#if ZEND_INTRIN_AVX2_FUNC_PTR || ZEND_INTRIN_SSSE3_FUNC_PTR
369+
#if defined(ZEND_INTRIN_AVX2_FUNC_PTR) || defined(ZEND_INTRIN_SSSE3_FUNC_PTR)
370370
BASIC_MINIT_SUBMODULE(base64_intrin)
371371
#endif
372372

@@ -397,8 +397,8 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
397397
php_register_url_stream_wrapper("http", &php_stream_http_wrapper);
398398
php_register_url_stream_wrapper("ftp", &php_stream_ftp_wrapper);
399399

400-
#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC
401-
# if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS
400+
#if defined(PHP_WIN32) || defined(HAVE_DNS_SEARCH_FUNC)
401+
# if defined(PHP_WIN32) || defined(HAVE_FULL_DNS_FUNCS)
402402
BASIC_MINIT_SUBMODULE(dns)
403403
# endif
404404
#endif
@@ -438,7 +438,7 @@ PHP_MSHUTDOWN_FUNCTION(basic) /* {{{ */
438438
BASIC_MSHUTDOWN_SUBMODULE(url_scanner_ex)
439439
BASIC_MSHUTDOWN_SUBMODULE(file)
440440
BASIC_MSHUTDOWN_SUBMODULE(standard_filters)
441-
#if defined(ZTS)
441+
#ifdef ZTS
442442
BASIC_MSHUTDOWN_SUBMODULE(localeconv)
443443
#endif
444444
BASIC_MSHUTDOWN_SUBMODULE(crypt)
@@ -874,7 +874,7 @@ PHP_FUNCTION(putenv)
874874
pe.previous_value = NULL;
875875
for (env = environ; env != NULL && *env != NULL; env++) {
876876
if (!strncmp(*env, pe.key, pe.key_len) && (*env)[pe.key_len] == '=') { /* found it */
877-
#if defined(PHP_WIN32)
877+
#ifdef PHP_WIN32
878878
/* must copy previous value because MSVCRT's putenv can free the string without notice */
879879
pe.previous_value = estrdup(*env);
880880
#else
@@ -884,7 +884,7 @@ PHP_FUNCTION(putenv)
884884
}
885885
}
886886

887-
#if HAVE_UNSETENV
887+
#ifdef HAVE_UNSETENV
888888
if (!p) { /* no '=' means we want to unset it */
889889
unsetenv(pe.putenv_string);
890890
}
@@ -930,15 +930,15 @@ PHP_FUNCTION(putenv)
930930
}
931931
#endif
932932
tsrm_env_unlock();
933-
#if defined(PHP_WIN32)
933+
#ifdef PHP_WIN32
934934
free(keyw);
935935
free(valw);
936936
#endif
937937
RETURN_TRUE;
938938
} else {
939939
efree(pe.putenv_string);
940940
efree(pe.key);
941-
#if defined(PHP_WIN32)
941+
#ifdef PHP_WIN32
942942
free(keyw);
943943
free(valw);
944944
#endif
@@ -1243,13 +1243,13 @@ PHP_FUNCTION(usleep)
12431243
RETURN_THROWS();
12441244
}
12451245

1246-
#if HAVE_USLEEP
1246+
#ifdef HAVE_USLEEP
12471247
usleep((unsigned int)num);
12481248
#endif
12491249
}
12501250
/* }}} */
12511251

1252-
#if HAVE_NANOSLEEP
1252+
#ifdef HAVE_NANOSLEEP
12531253
/* {{{ Delay for a number of seconds and nano seconds */
12541254
PHP_FUNCTION(time_nanosleep)
12551255
{
@@ -2293,7 +2293,7 @@ PHP_FUNCTION(ignore_user_abort)
22932293
}
22942294
/* }}} */
22952295

2296-
#if HAVE_GETSERVBYNAME
2296+
#ifdef HAVE_GETSERVBYNAME
22972297
/* {{{ Returns port associated with service. Protocol must be "tcp" or "udp" */
22982298
PHP_FUNCTION(getservbyname)
22992299
{
@@ -2317,7 +2317,7 @@ PHP_FUNCTION(getservbyname)
23172317

23182318
serv = getservbyname(name, proto);
23192319

2320-
#if defined(_AIX)
2320+
#ifdef _AIX
23212321
/*
23222322
On AIX, imap is only known as imap2 in /etc/services, while on Linux imap is an alias for imap2.
23232323
If a request for imap gives no result, we try again with imap2.
@@ -2335,7 +2335,7 @@ PHP_FUNCTION(getservbyname)
23352335
/* }}} */
23362336
#endif
23372337

2338-
#if HAVE_GETSERVBYPORT
2338+
#ifdef HAVE_GETSERVBYPORT
23392339
/* {{{ Returns service name associated with port. Protocol must be "tcp" or "udp" */
23402340
PHP_FUNCTION(getservbyport)
23412341
{
@@ -2360,7 +2360,7 @@ PHP_FUNCTION(getservbyport)
23602360
/* }}} */
23612361
#endif
23622362

2363-
#if HAVE_GETPROTOBYNAME
2363+
#ifdef HAVE_GETPROTOBYNAME
23642364
/* {{{ Returns protocol number associated with name as per /etc/protocols */
23652365
PHP_FUNCTION(getprotobyname)
23662366
{
@@ -2383,7 +2383,7 @@ PHP_FUNCTION(getprotobyname)
23832383
/* }}} */
23842384
#endif
23852385

2386-
#if HAVE_GETPROTOBYNUMBER
2386+
#ifdef HAVE_GETPROTOBYNUMBER
23872387
/* {{{ Returns protocol name associated with protocol number proto */
23882388
PHP_FUNCTION(getprotobynumber)
23892389
{

ext/standard/basic_functions.stub.php

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

274274
function usleep(int $microseconds): void {}
275275

276-
#if HAVE_NANOSLEEP
276+
#ifdef HAVE_NANOSLEEP
277277
function time_nanosleep(int $seconds, int $nanoseconds): array|bool {}
278278

279279
function time_sleep_until(float $timestamp): bool {}
@@ -332,19 +332,19 @@ function connection_status(): int {}
332332

333333
function ignore_user_abort(bool $value = UNKNOWN): int {}
334334

335-
#if HAVE_GETSERVBYNAME
335+
#ifdef HAVE_GETSERVBYNAME
336336
function getservbyname(string $service, string $protocol): int|false {}
337337
#endif
338338

339-
#if HAVE_GETSERVBYPORT
339+
#ifdef HAVE_GETSERVBYPORT
340340
function getservbyport(int $port, string $protocol): string|false {}
341341
#endif
342342

343-
#if HAVE_GETPROTOBYNAME
343+
#ifdef HAVE_GETPROTOBYNAME
344344
function getprotobyname(string $name): int|false {}
345345
#endif
346346

347-
#if HAVE_GETPROTOBYNUMBER
347+
#ifdef HAVE_GETPROTOBYNUMBER
348348
function getprotobynumber(int $protocol): string|false {}
349349
#endif
350350

@@ -382,7 +382,7 @@ function crypt(string $str, string $salt = UNKNOWN): string {}
382382

383383
/* datetime.c */
384384

385-
#if HAVE_STRPTIME
385+
#ifdef HAVE_STRPTIME
386386
function strptime(string $timestamp, string $format): array|false {}
387387
#endif
388388

@@ -398,7 +398,7 @@ function gethostbyname(string $hostname): string {}
398398

399399
function gethostbynamel(string $hostname): array|false {}
400400

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

404404
/** @alias dns_check_record */
@@ -430,7 +430,7 @@ function net_get_interfaces(): array|false {}
430430

431431
/* ftok.c */
432432

433-
#if HAVE_FTOK
433+
#ifdef HAVE_FTOK
434434
function ftok(string $pathname, string $proj): int {}
435435
#endif
436436

@@ -540,7 +540,7 @@ function strspn(string $str, string $mask, int $start = 0, int $len = UNKNOWN):
540540

541541
function strcspn(string $str, string $mask, int $start = 0, int $len = UNKNOWN): int|false {}
542542

543-
#if HAVE_NL_LANGINFO
543+
#ifdef HAVE_NL_LANGINFO
544544
function nl_langinfo(int $item): string|false {}
545545
#endif
546546

@@ -723,7 +723,7 @@ function closedir($dir_handle = UNKNOWN): void {}
723723

724724
function chdir(string $directory): bool {}
725725

726-
#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
726+
#if defined(HAVE_CHROOT) && !defined(ZTS) && defined(ENABLE_CHROOT_FUNC)
727727
function chroot(string $directory): bool {}
728728
#endif
729729

@@ -929,15 +929,15 @@ function chown(string $filename, $user): bool {}
929929

930930
function chgrp(string $filename, $group): bool {}
931931

932-
#if HAVE_LCHOWN
932+
#ifdef HAVE_LCHOWN
933933
function lchown(string $filename, $user): bool {}
934934

935935
function lchgrp(string $filename, $group): bool {}
936936
#endif
937937

938938
function chmod(string $filename, int $mode): bool {}
939939

940-
#if HAVE_UTIME
940+
#ifdef HAVE_UTIME
941941
function touch(string $filename, int $time = UNKNOWN, int $atime = UNKNOWN): bool {}
942942
#endif
943943

@@ -1306,7 +1306,7 @@ function stream_socket_enable_crypto($stream, bool $enable, ?int $crypto_type =
13061306
function stream_socket_shutdown($stream, int $how): bool {}
13071307
#endif
13081308

1309-
#if HAVE_SOCKETPAIR
1309+
#ifdef HAVE_SOCKETPAIR
13101310
function stream_socket_pair(int $domain, int $type, int $protocol): array|false {}
13111311
#endif
13121312

@@ -1374,7 +1374,7 @@ function sapi_windows_vt100_support($stream, ?bool $enable = null): bool {}
13741374
/** @param resource $stream */
13751375
function stream_set_chunk_size($stream, int $size): int {}
13761376

1377-
#if HAVE_SYS_TIME_H || defined(PHP_WIN32)
1377+
#if defined(HAVE_SYS_TIME_H) || defined(PHP_WIN32)
13781378
/** @param resource $socket */
13791379
function stream_set_timeout($socket, int $seconds, int $microseconds = 0): bool {}
13801380

0 commit comments

Comments
 (0)