Skip to content

Commit 1953d13

Browse files
committed
Fix [-Wundef] warnigns in standard extension
1 parent 3fb64be commit 1953d13

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

+253
-254
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
{
@@ -2289,7 +2289,7 @@ PHP_FUNCTION(ignore_user_abort)
22892289
}
22902290
/* }}} */
22912291

2292-
#if HAVE_GETSERVBYNAME
2292+
#ifdef HAVE_GETSERVBYNAME
22932293
/* {{{ Returns port associated with service. Protocol must be "tcp" or "udp" */
22942294
PHP_FUNCTION(getservbyname)
22952295
{
@@ -2313,7 +2313,7 @@ PHP_FUNCTION(getservbyname)
23132313

23142314
serv = getservbyname(name, proto);
23152315

2316-
#if defined(_AIX)
2316+
#ifdef _AIX
23172317
/*
23182318
On AIX, imap is only known as imap2 in /etc/services, while on Linux imap is an alias for imap2.
23192319
If a request for imap gives no result, we try again with imap2.
@@ -2331,7 +2331,7 @@ PHP_FUNCTION(getservbyname)
23312331
/* }}} */
23322332
#endif
23332333

2334-
#if HAVE_GETSERVBYPORT
2334+
#ifdef HAVE_GETSERVBYPORT
23352335
/* {{{ Returns service name associated with port. Protocol must be "tcp" or "udp" */
23362336
PHP_FUNCTION(getservbyport)
23372337
{
@@ -2356,7 +2356,7 @@ PHP_FUNCTION(getservbyport)
23562356
/* }}} */
23572357
#endif
23582358

2359-
#if HAVE_GETPROTOBYNAME
2359+
#ifdef HAVE_GETPROTOBYNAME
23602360
/* {{{ Returns protocol number associated with name as per /etc/protocols */
23612361
PHP_FUNCTION(getprotobyname)
23622362
{
@@ -2379,7 +2379,7 @@ PHP_FUNCTION(getprotobyname)
23792379
/* }}} */
23802380
#endif
23812381

2382-
#if HAVE_GETPROTOBYNUMBER
2382+
#ifdef HAVE_GETPROTOBYNUMBER
23832383
/* {{{ Returns protocol name associated with protocol number proto */
23842384
PHP_FUNCTION(getprotobynumber)
23852385
{

ext/standard/basic_functions.stub.php

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

288288
function usleep(int $microseconds): void {}
289289

290-
#if HAVE_NANOSLEEP
290+
#ifdef HAVE_NANOSLEEP
291291
function time_nanosleep(int $seconds, int $nanoseconds): array|bool {}
292292

293293
function time_sleep_until(float $timestamp): bool {}
@@ -346,19 +346,19 @@ function connection_status(): int {}
346346

347347
function ignore_user_abort(bool $value = UNKNOWN): int {}
348348

349-
#if HAVE_GETSERVBYNAME
349+
#ifdef HAVE_GETSERVBYNAME
350350
function getservbyname(string $service, string $protocol): int|false {}
351351
#endif
352352

353-
#if HAVE_GETSERVBYPORT
353+
#ifdef HAVE_GETSERVBYPORT
354354
function getservbyport(int $port, string $protocol): string|false {}
355355
#endif
356356

357-
#if HAVE_GETPROTOBYNAME
357+
#ifdef HAVE_GETPROTOBYNAME
358358
function getprotobyname(string $name): int|false {}
359359
#endif
360360

361-
#if HAVE_GETPROTOBYNUMBER
361+
#ifdef HAVE_GETPROTOBYNUMBER
362362
function getprotobynumber(int $protocol): string|false {}
363363
#endif
364364

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

397397
/* datetime.c */
398398

399-
#if HAVE_STRPTIME
399+
#ifdef HAVE_STRPTIME
400400
function strptime(string $timestamp, string $format): array|false {}
401401
#endif
402402

@@ -412,7 +412,7 @@ function gethostbyname(string $hostname): string {}
412412

413413
function gethostbynamel(string $hostname): array|false {}
414414

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

418418
/** @alias dns_check_record */
@@ -444,7 +444,7 @@ function net_get_interfaces(): array|false {}
444444

445445
/* ftok.c */
446446

447-
#if HAVE_FTOK
447+
#ifdef HAVE_FTOK
448448
function ftok(string $pathname, string $proj): int {}
449449
#endif
450450

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

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

557-
#if HAVE_NL_LANGINFO
557+
#ifdef HAVE_NL_LANGINFO
558558
function nl_langinfo(int $item): string|false {}
559559
#endif
560560

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

738738
function chdir(string $directory): bool {}
739739

740-
#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
740+
#if defined(HAVE_CHROOT) && !defined(ZTS) && defined(ENABLE_CHROOT_FUNC)
741741
function chroot(string $directory): bool {}
742742
#endif
743743

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

944944
function chgrp(string $filename, string|int $group): bool {}
945945

946-
#if HAVE_LCHOWN
946+
#ifdef HAVE_LCHOWN
947947
function lchown(string $filename, string|int $user): bool {}
948948

949949
function lchgrp(string $filename, string|int $group): bool {}
950950
#endif
951951

952952
function chmod(string $filename, int $mode): bool {}
953953

954-
#if HAVE_UTIME
954+
#ifdef HAVE_UTIME
955955
function touch(string $filename, int $time = UNKNOWN, int $atime = UNKNOWN): bool {}
956956
#endif
957957

@@ -1320,7 +1320,7 @@ function stream_socket_enable_crypto($stream, bool $enable, ?int $crypto_type =
13201320
function stream_socket_shutdown($stream, int $how): bool {}
13211321
#endif
13221322

1323-
#if HAVE_SOCKETPAIR
1323+
#ifdef HAVE_SOCKETPAIR
13241324
function stream_socket_pair(int $domain, int $type, int $protocol): array|false {}
13251325
#endif
13261326

@@ -1388,7 +1388,7 @@ function sapi_windows_vt100_support($stream, ?bool $enable = null): bool {}
13881388
/** @param resource $stream */
13891389
function stream_set_chunk_size($stream, int $size): int {}
13901390

1391-
#if HAVE_SYS_TIME_H || defined(PHP_WIN32)
1391+
#if defined(HAVE_SYS_TIME_H) || defined(PHP_WIN32)
13921392
/** @param resource $socket */
13931393
function stream_set_timeout($socket, int $seconds, int $microseconds = 0): bool {}
13941394

0 commit comments

Comments
 (0)