Skip to content

Commit c1c3a9f

Browse files
committed
Fix [-Wundef] warnings in OpCache extension
1 parent 35a06bb commit c1c3a9f

File tree

8 files changed

+38
-38
lines changed

8 files changed

+38
-38
lines changed

ext/opcache/Optimizer/zend_func_info.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ static const func_info_t func_infos[] = {
118118
FN("constant", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_STRING | MAY_BE_RESOURCE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
119119
F1("bin2hex", MAY_BE_STRING),
120120
F1("hex2bin", MAY_BE_FALSE | MAY_BE_STRING),
121-
#if HAVE_NANOSLEEP
121+
#ifdef HAVE_NANOSLEEP
122122
F1("time_nanosleep", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
123123
#endif
124-
#if HAVE_STRPTIME
124+
#ifdef HAVE_STRPTIME
125125
F1("strptime", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
126126
#endif
127127
F1("wordwrap", MAY_BE_STRING),
@@ -172,7 +172,7 @@ static const func_info_t func_infos[] = {
172172
F1("strip_tags", MAY_BE_STRING),
173173
F1("explode", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
174174
F1("localeconv", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
175-
#if HAVE_NL_LANGINFO
175+
#ifdef HAVE_NL_LANGINFO
176176
F1("nl_langinfo", MAY_BE_FALSE | MAY_BE_STRING),
177177
#endif
178178
F1("soundex", MAY_BE_FALSE | MAY_BE_STRING),
@@ -203,10 +203,10 @@ static const func_info_t func_infos[] = {
203203
F1("proc_get_status", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
204204
#endif
205205
F1("random_bytes", MAY_BE_STRING),
206-
#if HAVE_GETSERVBYPORT
206+
#ifdef HAVE_GETSERVBYPORT
207207
F1("getservbyport", MAY_BE_FALSE | MAY_BE_STRING),
208208
#endif
209-
#if HAVE_GETPROTOBYNUMBER
209+
#ifdef HAVE_GETPROTOBYNUMBER
210210
F1("getprotobynumber", MAY_BE_FALSE | MAY_BE_STRING),
211211
#endif
212212
F1("base64_decode", MAY_BE_FALSE | MAY_BE_STRING),
@@ -281,8 +281,8 @@ static const func_info_t func_infos[] = {
281281
#ifdef HAVE_GETHOSTNAME
282282
F1("gethostname", MAY_BE_FALSE | MAY_BE_STRING),
283283
#endif
284-
#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC
285-
# if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS
284+
#if defined(PHP_WIN32) || defined(HAVE_DNS_SEARCH_FUNC)
285+
# if defined(PHP_WIN32) || defined(HAVE_FULL_DNS_FUNCS)
286286
F1("dns_get_record", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
287287
# endif
288288
#endif
@@ -309,7 +309,7 @@ static const func_info_t func_infos[] = {
309309
F1("stream_socket_accept", MAY_BE_FALSE | MAY_BE_RESOURCE),
310310
F1("stream_socket_get_name", MAY_BE_FALSE | MAY_BE_STRING),
311311
F1("stream_socket_recvfrom", MAY_BE_FALSE | MAY_BE_STRING),
312-
#if HAVE_SOCKETPAIR
312+
#ifdef HAVE_SOCKETPAIR
313313
F1("stream_socket_pair", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_RESOURCE),
314314
#endif
315315
F1("stream_get_contents", MAY_BE_FALSE | MAY_BE_STRING),
@@ -812,13 +812,13 @@ static const func_info_t func_infos[] = {
812812
F1("dgettext", MAY_BE_FALSE | MAY_BE_STRING),
813813
F1("dcgettext", MAY_BE_FALSE | MAY_BE_STRING),
814814
F1("bindtextdomain", MAY_BE_FALSE | MAY_BE_STRING),
815-
#if HAVE_NGETTEXT
815+
#ifdef HAVE_NGETTEXT
816816
F1("ngettext", MAY_BE_FALSE | MAY_BE_STRING),
817817
#endif
818-
#if HAVE_DNGETTEXT
818+
#ifdef HAVE_DNGETTEXT
819819
F1("dcngettext", MAY_BE_FALSE | MAY_BE_STRING),
820820
#endif
821-
#if HAVE_BIND_TEXTDOMAIN_CODESET
821+
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
822822
F1("bind_textdomain_codeset", MAY_BE_FALSE | MAY_BE_STRING),
823823
#endif
824824

@@ -849,14 +849,14 @@ static const func_info_t func_infos[] = {
849849
F1("imagecreatefromwebp", MAY_BE_FALSE | MAY_BE_OBJECT),
850850
#endif
851851
F1("imagecreatefromxbm", MAY_BE_FALSE | MAY_BE_OBJECT),
852-
#if defined(HAVE_GD_XPM)
852+
#ifdef HAVE_GD_XPM
853853
F1("imagecreatefromxpm", MAY_BE_FALSE | MAY_BE_OBJECT),
854854
#endif
855855
F1("imagecreatefromwbmp", MAY_BE_FALSE | MAY_BE_OBJECT),
856856
F1("imagecreatefromgd", MAY_BE_FALSE | MAY_BE_OBJECT),
857857
F1("imagecreatefromgd2", MAY_BE_FALSE | MAY_BE_OBJECT),
858858
F1("imagecreatefromgd2part", MAY_BE_FALSE | MAY_BE_OBJECT),
859-
#if defined(HAVE_GD_BMP)
859+
#ifdef HAVE_GD_BMP
860860
F1("imagecreatefrombmp", MAY_BE_FALSE | MAY_BE_OBJECT),
861861
#endif
862862
F0("imagecolorset", MAY_BE_NULL | MAY_BE_FALSE),

ext/opcache/ZendAccelerator.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ static int zend_get_stream_timestamp(const char *filename, zend_stat_t *statbuf)
896896
return SUCCESS;
897897
}
898898

899-
#if ZEND_WIN32
899+
#ifdef ZEND_WIN32
900900
static accel_time_t zend_get_file_handle_timestamp_win(zend_file_handle *file_handle, size_t *size)
901901
{
902902
static unsigned __int64 utc_base = 0;
@@ -2211,7 +2211,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
22112211
}
22122212
} else {
22132213

2214-
#if !ZEND_WIN32
2214+
#ifndef ZEND_WIN32
22152215
ZCSG(hits)++; /* TBFixed: may lose one hit */
22162216
persistent_script->dynamic_members.hits++; /* see above */
22172217
#else

ext/opcache/ZendAccelerator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
/* 8 - Standalone Open Source Zend OPcache */
3737
#define ACCELERATOR_API_NO 8
3838

39-
#if ZEND_WIN32
39+
#ifdef ZEND_WIN32
4040
# include "zend_config.w32.h"
4141
#else
4242
#include "zend_config.h"
@@ -97,7 +97,7 @@ extern int lock_file;
9797
# define ENABLE_FILE_CACHE_FALLBACK 0
9898
#endif
9999

100-
#if ZEND_WIN32
100+
#ifdef ZEND_WIN32
101101
typedef unsigned __int64 accel_time_t;
102102
#else
103103
typedef time_t accel_time_t;

ext/opcache/jit/vtune/ittnotify_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
337337
#define __itt_fstrdup(s) strdup(s)
338338
#define __itt_thread_id() pthread_self()
339339
#define __itt_thread_yield() sched_yield()
340-
#if ITT_ARCH==ITT_ARCH_IA64
340+
#if defined(ITT_ARCH_IA64) && ITT_ARCH==ITT_ARCH_IA64
341341
#ifdef __INTEL_COMPILER
342342
#define __TBB_machine_fetchadd4(addr, val) __fetchadd4_acq((void *)addr, val)
343343
#else /* __INTEL_COMPILER */

ext/opcache/jit/zend_jit.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static zend_bool zend_long_is_power_of_two(zend_long x)
184184

185185
#include "jit/zend_jit_x86.c"
186186

187-
#if _WIN32
187+
#ifdef _WIN32
188188
# include <Windows.h>
189189
#else
190190
# include <sys/mman.h>
@@ -3531,7 +3531,7 @@ ZEND_EXT_API void zend_jit_unprotect(void)
35313531
fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
35323532
}
35333533
}
3534-
#elif _WIN32
3534+
#elif defined(_WIN32)
35353535
if (!(JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
35363536
DWORD old;
35373537

@@ -3550,7 +3550,7 @@ ZEND_EXT_API void zend_jit_protect(void)
35503550
fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
35513551
}
35523552
}
3553-
#elif _WIN32
3553+
#elif defined(_WIN32)
35543554
if (!(JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
35553555
DWORD old;
35563556

@@ -3763,7 +3763,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
37633763
fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
37643764
}
37653765
}
3766-
#elif _WIN32
3766+
#elif defined(_WIN32)
37673767
if (JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP)) {
37683768
DWORD old;
37693769

@@ -3783,7 +3783,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
37833783
if (!reattached) {
37843784
zend_jit_unprotect();
37853785
*dasm_ptr = dasm_buf;
3786-
#if _WIN32
3786+
#ifdef _WIN32
37873787
/* reserve space for global labels */
37883788
*dasm_ptr = (void**)*dasm_ptr + zend_lb_MAX;
37893789
#endif
@@ -3808,7 +3808,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
38083808
if (!reattached) {
38093809
zend_jit_unprotect();
38103810
ret = zend_jit_make_stubs();
3811-
#if _WIN32
3811+
#ifdef _WIN32
38123812
/* save global labels */
38133813
memcpy(dasm_buf, dasm_labels, sizeof(void*) * zend_lb_MAX);
38143814
#endif
@@ -3818,7 +3818,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
38183818
return FAILURE;
38193819
}
38203820
} else {
3821-
#if _WIN32
3821+
#ifdef _WIN32
38223822
/* restore global labels */
38233823
memcpy(dasm_labels, dasm_buf, sizeof(void*) * zend_lb_MAX);
38243824
#endif

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ const char* zend_reg_name[] = {
130130
# define GCC_GLOBAL_REGS 0
131131
#endif
132132

133-
#if ZTS
133+
#ifdef ZTS
134134
static size_t tsrm_ls_cache_tcb_offset = 0;
135135
static size_t tsrm_tls_index;
136136
static size_t tsrm_tls_offset;
@@ -2582,7 +2582,7 @@ static const zend_jit_stub zend_jit_stubs[] = {
25822582
#endif
25832583
};
25842584

2585-
#if ZTS && defined(ZEND_WIN32)
2585+
#if defined(ZTS) && defined(ZEND_WIN32)
25862586
extern uint32_t _tls_index;
25872587
extern char *_tls_start;
25882588
extern char *_tls_end;
@@ -2600,7 +2600,7 @@ static int zend_jit_setup(void)
26002600
}
26012601
}
26022602

2603-
#if ZTS
2603+
#ifdef ZTS
26042604
# ifdef _WIN64
26052605
tsrm_tls_index = _tls_index * sizeof(void*);
26062606

@@ -2625,7 +2625,7 @@ static int zend_jit_setup(void)
26252625
return FAILURE;
26262626
}
26272627
} while(0);
2628-
# elif ZEND_WIN32
2628+
# elif defined(ZEND_WIN32)
26292629
tsrm_tls_index = _tls_index * sizeof(void*);
26302630

26312631
/* To find offset of "_tsrm_ls_cache" in TLS segment we perform a linear scan of local TLS memory */
@@ -8430,9 +8430,9 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
84308430
| mov r0, EX:RX->func
84318431
}
84328432
| mov r2, aword [r0 + offsetof(zend_op_array, run_time_cache__ptr)]
8433-
#if ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR
8433+
#if defined(ZEND_MAP_PTR_KIND) && defined(ZEND_MAP_PTR_KIND_PTR) && ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR
84348434
| mov r2, aword [r2]
8435-
#elif ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR_OR_OFFSET
8435+
#elif defined(ZEND_MAP_PTR_KIND) && defined(ZEND_MAP_PTR_KIND_PTR_OR_OFFSET) && ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR_OR_OFFSET
84368436
if (func && !(func->op_array.fn_flags & ZEND_ACC_CLOSURE)) {
84378437
if (ZEND_MAP_PTR_IS_OFFSET(func->op_array.run_time_cache)) {
84388438
| MEM_OP2_2_ZTS add, r2, aword, compiler_globals, map_ptr_base, r1
@@ -11753,7 +11753,7 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1175311753
}
1175411754
}
1175511755

11756-
#if ZTS
11756+
#ifdef ZTS
1175711757
/* %r0 is used to check EG(vm_interrupt) */
1175811758
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) {
1175911759
if (ssa_op == ssa->ops

ext/opcache/zend_accelerator_module.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "ext/standard/php_filestat.h"
3434
#include "opcache_arginfo.h"
3535

36-
#if HAVE_JIT
36+
#ifdef HAVE_JIT
3737
#include "jit/zend_jit.h"
3838
#endif
3939

@@ -283,7 +283,7 @@ ZEND_INI_BEGIN()
283283
#ifndef ZEND_WIN32
284284
STD_PHP_INI_ENTRY("opcache.preload_user" , "" , PHP_INI_SYSTEM, OnUpdateStringUnempty, accel_directives.preload_user, zend_accel_globals, accel_globals)
285285
#endif
286-
#if ZEND_WIN32
286+
#ifdef ZEND_WIN32
287287
STD_PHP_INI_ENTRY("opcache.cache_id" , "" , PHP_INI_SYSTEM, OnUpdateString, accel_directives.cache_id, zend_accel_globals, accel_globals)
288288
#endif
289289
#ifdef HAVE_JIT
@@ -435,7 +435,7 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
435435
} else {
436436
php_info_print_table_row(2, "File Cache", "Disabled");
437437
}
438-
#if HAVE_JIT
438+
#ifdef HAVE_JIT
439439
if (JIT_G(enabled)) {
440440
if (JIT_G(on)) {
441441
php_info_print_table_row(2, "JIT", "On");
@@ -690,7 +690,7 @@ ZEND_FUNCTION(opcache_get_status)
690690
add_assoc_zval(return_value, "scripts", &scripts);
691691
}
692692
}
693-
#if HAVE_JIT
693+
#ifdef HAVE_JIT
694694
zend_jit_status(return_value);
695695
#endif
696696
}
@@ -772,7 +772,7 @@ ZEND_FUNCTION(opcache_get_configuration)
772772
#ifndef ZEND_WIN32
773773
add_assoc_string(&directives, "opcache.preload_user", STRING_NOT_NULL(ZCG(accel_directives).preload_user));
774774
#endif
775-
#if ZEND_WIN32
775+
#ifdef ZEND_WIN32
776776
add_assoc_string(&directives, "opcache.cache_id", STRING_NOT_NULL(ZCG(accel_directives).cache_id));
777777
#endif
778778
#ifdef HAVE_JIT

ext/opcache/zend_file_cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#include <sys/stat.h>
4343
#include <fcntl.h>
4444

45-
#if HAVE_UNISTD_H
45+
#ifdef HAVE_UNISTD_H
4646
#include <unistd.h>
4747
#endif
4848

0 commit comments

Comments
 (0)