Skip to content

Commit 9a28d97

Browse files
committed
Fix [-Wundef] warnings in OpCache extension
1 parent 00fd6fa commit 9a28d97

File tree

9 files changed

+41
-41
lines changed

9 files changed

+41
-41
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_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
@@ -308,7 +308,7 @@ static const func_info_t func_infos[] = {
308308
F1("stream_socket_accept", MAY_BE_FALSE | MAY_BE_RESOURCE),
309309
F1("stream_socket_get_name", MAY_BE_FALSE | MAY_BE_STRING),
310310
F1("stream_socket_recvfrom", MAY_BE_FALSE | MAY_BE_STRING),
311-
#if HAVE_SOCKETPAIR
311+
#ifdef HAVE_SOCKETPAIR
312312
F1("stream_socket_pair", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_RESOURCE),
313313
#endif
314314
F1("stream_get_contents", MAY_BE_FALSE | MAY_BE_STRING),
@@ -765,13 +765,13 @@ static const func_info_t func_infos[] = {
765765
F1("dgettext", MAY_BE_STRING),
766766
F1("dcgettext", MAY_BE_STRING),
767767
F1("bindtextdomain", MAY_BE_FALSE | MAY_BE_STRING),
768-
#if HAVE_NGETTEXT
768+
#ifdef HAVE_NGETTEXT
769769
F1("ngettext", MAY_BE_STRING),
770770
#endif
771-
#if HAVE_DNGETTEXT
771+
#ifdef HAVE_DNGETTEXT
772772
F1("dcngettext", MAY_BE_STRING),
773773
#endif
774-
#if HAVE_BIND_TEXTDOMAIN_CODESET
774+
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
775775
F1("bind_textdomain_codeset", MAY_BE_FALSE | MAY_BE_STRING),
776776
#endif
777777

@@ -802,14 +802,14 @@ static const func_info_t func_infos[] = {
802802
F1("imagecreatefromwebp", MAY_BE_FALSE | MAY_BE_OBJECT),
803803
#endif
804804
F1("imagecreatefromxbm", MAY_BE_FALSE | MAY_BE_OBJECT),
805-
#if defined(HAVE_GD_XPM)
805+
#ifdef HAVE_GD_XPM
806806
F1("imagecreatefromxpm", MAY_BE_FALSE | MAY_BE_OBJECT),
807807
#endif
808808
F1("imagecreatefromwbmp", MAY_BE_FALSE | MAY_BE_OBJECT),
809809
F1("imagecreatefromgd", MAY_BE_FALSE | MAY_BE_OBJECT),
810810
F1("imagecreatefromgd2", MAY_BE_FALSE | MAY_BE_OBJECT),
811811
F1("imagecreatefromgd2part", MAY_BE_FALSE | MAY_BE_OBJECT),
812-
#if defined(HAVE_GD_BMP)
812+
#ifdef HAVE_GD_BMP
813813
F1("imagecreatefrombmp", MAY_BE_FALSE | MAY_BE_OBJECT),
814814
#endif
815815
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
@@ -893,7 +893,7 @@ static int zend_get_stream_timestamp(const char *filename, zend_stat_t *statbuf)
893893
return SUCCESS;
894894
}
895895

896-
#if ZEND_WIN32
896+
#ifdef ZEND_WIN32
897897
static accel_time_t zend_get_file_handle_timestamp_win(zend_file_handle *file_handle, size_t *size)
898898
{
899899
static unsigned __int64 utc_base = 0;
@@ -2194,7 +2194,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
21942194
}
21952195
} else {
21962196

2197-
#if !ZEND_WIN32
2197+
#ifndef ZEND_WIN32
21982198
ZCSG(hits)++; /* TBFixed: may lose one hit */
21992199
persistent_script->dynamic_members.hits++; /* see above */
22002200
#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
@@ -214,7 +214,7 @@ static zend_bool zend_long_is_power_of_two(zend_long x)
214214

215215
#include "jit/zend_jit_x86.c"
216216

217-
#if _WIN32
217+
#ifdef _WIN32
218218
# include <Windows.h>
219219
#else
220220
# include <sys/mman.h>
@@ -3853,7 +3853,7 @@ ZEND_EXT_API void zend_jit_unprotect(void)
38533853
fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
38543854
}
38553855
}
3856-
#elif _WIN32
3856+
#elif defined(_WIN32)
38573857
if (!(JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
38583858
DWORD old;
38593859

@@ -3875,7 +3875,7 @@ ZEND_EXT_API void zend_jit_protect(void)
38753875
fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
38763876
}
38773877
}
3878-
#elif _WIN32
3878+
#elif defined(_WIN32)
38793879
if (!(JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
38803880
DWORD old;
38813881

@@ -4099,7 +4099,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
40994099
fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
41004100
}
41014101
}
4102-
#elif _WIN32
4102+
#elif defined(_WIN32)
41034103
if (JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP)) {
41044104
DWORD old;
41054105

@@ -4125,7 +4125,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
41254125
if (!reattached) {
41264126
zend_jit_unprotect();
41274127
*dasm_ptr = dasm_buf;
4128-
#if _WIN32
4128+
#ifdef _WIN32
41294129
/* reserve space for global labels */
41304130
*dasm_ptr = (void**)*dasm_ptr + zend_lb_MAX;
41314131
#endif
@@ -4150,7 +4150,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
41504150
if (!reattached) {
41514151
zend_jit_unprotect();
41524152
ret = zend_jit_make_stubs();
4153-
#if _WIN32
4153+
#ifdef _WIN32
41544154
/* save global labels */
41554155
memcpy(dasm_buf, dasm_labels, sizeof(void*) * zend_lb_MAX);
41564156
#endif
@@ -4160,7 +4160,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
41604160
return FAILURE;
41614161
}
41624162
} else {
4163-
#if _WIN32
4163+
#ifdef _WIN32
41644164
/* restore global labels */
41654165
memcpy(dasm_labels, dasm_buf, sizeof(void*) * zend_lb_MAX);
41664166
#endif

ext/opcache/jit/zend_jit_trace.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3441,7 +3441,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
34413441
if (opline->result_type == IS_CV) {
34423442
res_use_info = RES_USE_INFO();
34433443
} else {
3444-
#if USE_ABSTRACT_STACK_FOR_RES_USE_INFO
3444+
#ifdef USE_ABSTRACT_STACK_FOR_RES_USE_INFO
34453445
res_use_info = zend_jit_trace_type_to_info(STACK_VAR_TYPE(opline->result.var));
34463446
#else
34473447
res_use_info = -1;
@@ -3520,7 +3520,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
35203520
if (opline->result_type == IS_CV) {
35213521
res_use_info = RES_USE_INFO();
35223522
} else {
3523-
#if USE_ABSTRACT_STACK_FOR_RES_USE_INFO
3523+
#ifdef USE_ABSTRACT_STACK_FOR_RES_USE_INFO
35243524
res_use_info = zend_jit_trace_type_to_info(STACK_VAR_TYPE(opline->result.var));
35253525
#else
35263526
res_use_info = -1;
@@ -3591,7 +3591,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
35913591
if (opline->result_type == IS_CV) {
35923592
res_use_info = RES_USE_INFO();
35933593
} else {
3594-
#if USE_ABSTRACT_STACK_FOR_RES_USE_INFO
3594+
#ifdef USE_ABSTRACT_STACK_FOR_RES_USE_INFO
35953595
res_use_info = zend_jit_trace_type_to_info(STACK_VAR_TYPE(opline->result.var));
35963596
#else
35973597
res_use_info = -1;

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ const char* zend_reg_name[] = {
137137
# define GCC_GLOBAL_REGS 0
138138
#endif
139139

140-
#if ZTS
140+
#ifdef ZTS
141141
static size_t tsrm_ls_cache_tcb_offset = 0;
142142
static size_t tsrm_tls_index;
143143
static size_t tsrm_tls_offset;
@@ -2901,7 +2901,7 @@ static int zend_jit_setup(void)
29012901
return FAILURE;
29022902
}
29032903
} while(0);
2904-
# elif ZEND_WIN32
2904+
# elif defined(ZEND_WIN32)
29052905
tsrm_tls_index = _tls_index * sizeof(void*);
29062906

29072907
/* To find offset of "_tsrm_ls_cache" in TLS segment we perform a linear scan of local TLS memory */
@@ -3132,7 +3132,7 @@ static int zend_jit_trace_begin(dasm_State **Dst, uint32_t trace_num, zend_jit_t
31323132
{
31333133
zend_regset regset = ZEND_REGSET_SCRATCH;
31343134

3135-
#if ZTS
3135+
#ifdef ZTS
31363136
if (1) {
31373137
#else
31383138
if ((sizeof(void*) == 8 && !IS_32BIT(&EG(jit_trace_num)))) {
@@ -9614,9 +9614,9 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
96149614
| mov r0, EX:RX->func
96159615
}
96169616
| mov r2, aword [r0 + offsetof(zend_op_array, run_time_cache__ptr)]
9617-
#if ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR
9617+
#if defined(ZEND_MAP_PTR_KIND) && defined(ZEND_MAP_PTR_KIND_PTR) && ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR
96189618
| mov r2, aword [r2]
9619-
#elif ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR_OR_OFFSET
9619+
#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
96209620
if (func && !(func->op_array.fn_flags & ZEND_ACC_CLOSURE)) {
96219621
if (ZEND_MAP_PTR_IS_OFFSET(func->op_array.run_time_cache)) {
96229622
| MEM_OP2_2_ZTS add, r2, aword, compiler_globals, map_ptr_base, r1
@@ -15296,7 +15296,7 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1529615296
if (ssa_op == ssa->ops
1529715297
&& (JIT_G(current_trace)->stop == ZEND_JIT_TRACE_STOP_LOOP ||
1529815298
JIT_G(current_trace)->stop == ZEND_JIT_TRACE_STOP_RECURSIVE_CALL)) {
15299-
#if ZTS
15299+
#ifdef ZTS
1530015300
ZEND_REGSET_INCL(regset, ZREG_R0);
1530115301
#else
1530215302
if ((sizeof(void*) == 8 && !IS_32BIT(&EG(vm_interrupt)))) {
@@ -15309,7 +15309,7 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1530915309

1531015310
if ((ssa->cfg.blocks[b].flags & ZEND_BB_LOOP_HEADER) != 0
1531115311
&& ssa->cfg.blocks[b].start == ssa_op - ssa->ops) {
15312-
#if ZTS
15312+
#ifdef ZTS
1531315313
ZEND_REGSET_INCL(regset, ZREG_R0);
1531415314
#else
1531515315
if ((sizeof(void*) == 8 && !IS_32BIT(&EG(vm_interrupt)))) {

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
@@ -436,7 +436,7 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
436436
} else {
437437
php_info_print_table_row(2, "File Cache", "Disabled");
438438
}
439-
#if HAVE_JIT
439+
#ifdef HAVE_JIT
440440
if (JIT_G(enabled)) {
441441
if (JIT_G(on)) {
442442
php_info_print_table_row(2, "JIT", "On");
@@ -689,7 +689,7 @@ ZEND_FUNCTION(opcache_get_status)
689689
add_assoc_zval(return_value, "scripts", &scripts);
690690
}
691691
}
692-
#if HAVE_JIT
692+
#ifdef HAVE_JIT
693693
zend_jit_status(return_value);
694694
#endif
695695
}
@@ -770,7 +770,7 @@ ZEND_FUNCTION(opcache_get_configuration)
770770
#ifndef ZEND_WIN32
771771
add_assoc_string(&directives, "opcache.preload_user", STRING_NOT_NULL(ZCG(accel_directives).preload_user));
772772
#endif
773-
#if ZEND_WIN32
773+
#ifdef ZEND_WIN32
774774
add_assoc_string(&directives, "opcache.cache_id", STRING_NOT_NULL(ZCG(accel_directives).cache_id));
775775
#endif
776776
#ifdef HAVE_JIT

ext/opcache/zend_file_cache.c

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

46-
#if HAVE_UNISTD_H
46+
#ifdef HAVE_UNISTD_H
4747
#include <unistd.h>
4848
#endif
4949

0 commit comments

Comments
 (0)