Skip to content

Commit e993b6f

Browse files
committed
Fix [-Wundef] warnigns in standard extension
1 parent 65abd84 commit e993b6f

Some content is hidden

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

42 files changed

+257
-258
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)
@@ -881,7 +881,7 @@ PHP_FUNCTION(putenv)
881881
pe.previous_value = NULL;
882882
for (env = environ; env != NULL && *env != NULL; env++) {
883883
if (!strncmp(*env, pe.key, pe.key_len) && (*env)[pe.key_len] == '=') { /* found it */
884-
#if defined(PHP_WIN32)
884+
#ifdef PHP_WIN32
885885
/* must copy previous value because MSVCRT's putenv can free the string without notice */
886886
pe.previous_value = estrdup(*env);
887887
#else
@@ -891,7 +891,7 @@ PHP_FUNCTION(putenv)
891891
}
892892
}
893893

894-
#if HAVE_UNSETENV
894+
#ifdef HAVE_UNSETENV
895895
if (!p) { /* no '=' means we want to unset it */
896896
unsetenv(pe.putenv_string);
897897
}
@@ -936,15 +936,15 @@ PHP_FUNCTION(putenv)
936936
}
937937
#endif
938938
tsrm_env_unlock();
939-
#if defined(PHP_WIN32)
939+
#ifdef PHP_WIN32
940940
free(keyw);
941941
free(valw);
942942
#endif
943943
RETURN_TRUE;
944944
} else {
945945
efree(pe.putenv_string);
946946
efree(pe.key);
947-
#if defined(PHP_WIN32)
947+
#ifdef PHP_WIN32
948948
free(keyw);
949949
free(valw);
950950
#endif
@@ -1242,7 +1242,7 @@ PHP_FUNCTION(sleep)
12421242
Delay for a given number of micro seconds */
12431243
PHP_FUNCTION(usleep)
12441244
{
1245-
#if HAVE_USLEEP
1245+
#ifdef HAVE_USLEEP
12461246
zend_long num;
12471247

12481248
ZEND_PARSE_PARAMETERS_START(1, 1)
@@ -1263,7 +1263,7 @@ PHP_FUNCTION(usleep)
12631263
}
12641264
/* }}} */
12651265

1266-
#if HAVE_NANOSLEEP
1266+
#ifdef HAVE_NANOSLEEP
12671267
/* {{{ proto mixed time_nanosleep(int seconds, int nanoseconds)
12681268
Delay for a number of seconds and nano seconds */
12691269
PHP_FUNCTION(time_nanosleep)
@@ -2333,7 +2333,7 @@ PHP_FUNCTION(ignore_user_abort)
23332333
}
23342334
/* }}} */
23352335

2336-
#if HAVE_GETSERVBYNAME
2336+
#ifdef HAVE_GETSERVBYNAME
23372337
/* {{{ proto int|false getservbyname(string service, string protocol)
23382338
Returns port associated with service. Protocol must be "tcp" or "udp" */
23392339
PHP_FUNCTION(getservbyname)
@@ -2358,7 +2358,7 @@ PHP_FUNCTION(getservbyname)
23582358

23592359
serv = getservbyname(name, proto);
23602360

2361-
#if defined(_AIX)
2361+
#ifdef _AIX
23622362
/*
23632363
On AIX, imap is only known as imap2 in /etc/services, while on Linux imap is an alias for imap2.
23642364
If a request for imap gives no result, we try again with imap2.
@@ -2376,7 +2376,7 @@ PHP_FUNCTION(getservbyname)
23762376
/* }}} */
23772377
#endif
23782378

2379-
#if HAVE_GETSERVBYPORT
2379+
#ifdef HAVE_GETSERVBYPORT
23802380
/* {{{ proto string|false getservbyport(int port, string protocol)
23812381
Returns service name associated with port. Protocol must be "tcp" or "udp" */
23822382
PHP_FUNCTION(getservbyport)
@@ -2402,7 +2402,7 @@ PHP_FUNCTION(getservbyport)
24022402
/* }}} */
24032403
#endif
24042404

2405-
#if HAVE_GETPROTOBYNAME
2405+
#ifdef HAVE_GETPROTOBYNAME
24062406
/* {{{ proto int|false getprotobyname(string name)
24072407
Returns protocol number associated with name as per /etc/protocols */
24082408
PHP_FUNCTION(getprotobyname)
@@ -2426,7 +2426,7 @@ PHP_FUNCTION(getprotobyname)
24262426
/* }}} */
24272427
#endif
24282428

2429-
#if HAVE_GETPROTOBYNUMBER
2429+
#ifdef HAVE_GETPROTOBYNUMBER
24302430
/* {{{ proto string|false getprotobynumber(int proto)
24312431
Returns protocol name associated with protocol number proto */
24322432
PHP_FUNCTION(getprotobynumber)

ext/standard/basic_functions.stub.php

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

270270
function usleep(int $microseconds): void {}
271271

272-
#if HAVE_NANOSLEEP
272+
#ifdef HAVE_NANOSLEEP
273273
function time_nanosleep(int $seconds, int $nanoseconds): array|bool {}
274274

275275
function time_sleep_until(float $timestamp): bool {}
@@ -328,19 +328,19 @@ function connection_status(): int {}
328328

329329
function ignore_user_abort(bool $value = UNKNOWN): int {}
330330

331-
#if HAVE_GETSERVBYNAME
331+
#ifdef HAVE_GETSERVBYNAME
332332
function getservbyname(string $service, string $protocol): int|false {}
333333
#endif
334334

335-
#if HAVE_GETSERVBYPORT
335+
#ifdef HAVE_GETSERVBYPORT
336336
function getservbyport(int $port, string $protocol): string|false {}
337337
#endif
338338

339-
#if HAVE_GETPROTOBYNAME
339+
#ifdef HAVE_GETPROTOBYNAME
340340
function getprotobyname(string $name): int|false {}
341341
#endif
342342

343-
#if HAVE_GETPROTOBYNUMBER
343+
#ifdef HAVE_GETPROTOBYNUMBER
344344
function getprotobynumber(int $protocol): string|false {}
345345
#endif
346346

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

379379
/* datetime.c */
380380

381-
#if HAVE_STRPTIME
381+
#ifdef HAVE_STRPTIME
382382
function strptime(string $timestamp, string $format): array|false {}
383383
#endif
384384

@@ -394,7 +394,7 @@ function gethostbyname(string $hostname): string {}
394394

395395
function gethostbynamel(string $hostname): array|false {}
396396

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

400400
/** @alias dns_check_record */
@@ -414,7 +414,7 @@ function net_get_interfaces(): array|false {}
414414

415415
/* ftok.c */
416416

417-
#if HAVE_FTOK
417+
#ifdef HAVE_FTOK
418418
function ftok(string $pathname, string $proj): int {}
419419
#endif
420420

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

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

523-
#if HAVE_NL_LANGINFO
523+
#ifdef HAVE_NL_LANGINFO
524524
function nl_langinfo(int $item): string|false {}
525525
#endif
526526

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

703703
function chdir(string $directory): bool {}
704704

705-
#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
705+
#if defined(HAVE_CHROOT) && !defined(ZTS) && defined(ENABLE_CHROOT_FUNC)
706706
function chroot(string $directory): bool {}
707707
#endif
708708

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

899899
function chgrp(string $filename, $group): bool {}
900900

901-
#if HAVE_LCHOWN
901+
#ifdef HAVE_LCHOWN
902902
function lchown(string $filename, $user): bool {}
903903

904904
function lchgrp(string $filename, $group): bool {}
905905
#endif
906906

907907
function chmod(string $filename, int $mode): bool {}
908908

909-
#if HAVE_UTIME
909+
#ifdef HAVE_UTIME
910910
function touch(string $filename, int $time = UNKNOWN, int $atime = UNKNOWN): bool {}
911911
#endif
912912

@@ -1252,7 +1252,7 @@ function stream_socket_enable_crypto($stream, bool $enable, ?int $crypto_type =
12521252
function stream_socket_shutdown($stream, int $how): bool {}
12531253
#endif
12541254

1255-
#if HAVE_SOCKETPAIR
1255+
#ifdef HAVE_SOCKETPAIR
12561256
function stream_socket_pair(int $domain, int $type, int $protocol): array|false {}
12571257
#endif
12581258

@@ -1320,7 +1320,7 @@ function sapi_windows_vt100_support($stream, bool $enable): bool {}
13201320
/** @param resource $stream */
13211321
function stream_set_chunk_size($stream, int $size): int {}
13221322

1323-
#if HAVE_SYS_TIME_H || defined(PHP_WIN32)
1323+
#if defined(HAVE_SYS_TIME_H) || defined(PHP_WIN32)
13241324
/** @param resource $socket */
13251325
function stream_set_timeout($socket, int $seconds, int $microseconds = 0): bool {}
13261326

0 commit comments

Comments
 (0)