Skip to content

Commit b3121c4

Browse files
committed
Fix [-Wundef] warnings in OpCache extension
1 parent a5d3284 commit b3121c4

File tree

9 files changed

+43
-43
lines changed

9 files changed

+43
-43
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
@@ -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),
@@ -804,13 +804,13 @@ static const func_info_t func_infos[] = {
804804
F1("dgettext", MAY_BE_STRING),
805805
F1("dcgettext", MAY_BE_STRING),
806806
F1("bindtextdomain", MAY_BE_FALSE | MAY_BE_STRING),
807-
#if HAVE_NGETTEXT
807+
#ifdef HAVE_NGETTEXT
808808
F1("ngettext", MAY_BE_STRING),
809809
#endif
810-
#if HAVE_DNGETTEXT
810+
#ifdef HAVE_DNGETTEXT
811811
F1("dcngettext", MAY_BE_STRING),
812812
#endif
813-
#if HAVE_BIND_TEXTDOMAIN_CODESET
813+
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
814814
F1("bind_textdomain_codeset", MAY_BE_FALSE | MAY_BE_STRING),
815815
#endif
816816

@@ -841,14 +841,14 @@ static const func_info_t func_infos[] = {
841841
F1("imagecreatefromwebp", MAY_BE_FALSE | MAY_BE_OBJECT),
842842
#endif
843843
F1("imagecreatefromxbm", MAY_BE_FALSE | MAY_BE_OBJECT),
844-
#if defined(HAVE_GD_XPM)
844+
#ifdef HAVE_GD_XPM
845845
F1("imagecreatefromxpm", MAY_BE_FALSE | MAY_BE_OBJECT),
846846
#endif
847847
F1("imagecreatefromwbmp", MAY_BE_FALSE | MAY_BE_OBJECT),
848848
F1("imagecreatefromgd", MAY_BE_FALSE | MAY_BE_OBJECT),
849849
F1("imagecreatefromgd2", MAY_BE_FALSE | MAY_BE_OBJECT),
850850
F1("imagecreatefromgd2part", MAY_BE_FALSE | MAY_BE_OBJECT),
851-
#if defined(HAVE_GD_BMP)
851+
#ifdef HAVE_GD_BMP
852852
F1("imagecreatefrombmp", MAY_BE_FALSE | MAY_BE_OBJECT),
853853
#endif
854854
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;
@@ -2197,7 +2197,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
21972197
}
21982198
} else {
21992199

2200-
#if !ZEND_WIN32
2200+
#ifndef ZEND_WIN32
22012201
ZCSG(hits)++; /* TBFixed: may lose one hit */
22022202
persistent_script->dynamic_members.hits++; /* see above */
22032203
#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
@@ -187,7 +187,7 @@ static zend_bool zend_long_is_power_of_two(zend_long x)
187187

188188
#include "jit/zend_jit_x86.c"
189189

190-
#if _WIN32
190+
#ifdef _WIN32
191191
# include <Windows.h>
192192
#else
193193
# include <sys/mman.h>
@@ -3663,7 +3663,7 @@ ZEND_EXT_API void zend_jit_unprotect(void)
36633663
fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
36643664
}
36653665
}
3666-
#elif _WIN32
3666+
#elif defined(_WIN32)
36673667
if (!(JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
36683668
DWORD old;
36693669

@@ -3685,7 +3685,7 @@ ZEND_EXT_API void zend_jit_protect(void)
36853685
fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
36863686
}
36873687
}
3688-
#elif _WIN32
3688+
#elif defined(_WIN32)
36893689
if (!(JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
36903690
DWORD old;
36913691

@@ -3909,7 +3909,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
39093909
fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
39103910
}
39113911
}
3912-
#elif _WIN32
3912+
#elif defined(_WIN32)
39133913
if (JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP)) {
39143914
DWORD old;
39153915

@@ -3935,7 +3935,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
39353935
if (!reattached) {
39363936
zend_jit_unprotect();
39373937
*dasm_ptr = dasm_buf;
3938-
#if _WIN32
3938+
#ifdef _WIN32
39393939
/* reserve space for global labels */
39403940
*dasm_ptr = (void**)*dasm_ptr + zend_lb_MAX;
39413941
#endif
@@ -3960,7 +3960,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
39603960
if (!reattached) {
39613961
zend_jit_unprotect();
39623962
ret = zend_jit_make_stubs();
3963-
#if _WIN32
3963+
#ifdef _WIN32
39643964
/* save global labels */
39653965
memcpy(dasm_buf, dasm_labels, sizeof(void*) * zend_lb_MAX);
39663966
#endif
@@ -3970,7 +3970,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
39703970
return FAILURE;
39713971
}
39723972
} else {
3973-
#if _WIN32
3973+
#ifdef _WIN32
39743974
/* restore global labels */
39753975
memcpy(dasm_labels, dasm_buf, sizeof(void*) * zend_lb_MAX);
39763976
#endif

ext/opcache/jit/zend_jit_trace.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3366,7 +3366,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
33663366
if (opline->result_type == IS_CV) {
33673367
res_use_info = RES_USE_INFO();
33683368
} else {
3369-
#if USE_ABSTRACT_STACK_FOR_RES_USE_INFO
3369+
#ifdef USE_ABSTRACT_STACK_FOR_RES_USE_INFO
33703370
res_use_info = zend_jit_trace_type_to_info(STACK_VAR_TYPE(opline->result.var));
33713371
#else
33723372
res_use_info = -1;
@@ -3445,7 +3445,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
34453445
if (opline->result_type == IS_CV) {
34463446
res_use_info = RES_USE_INFO();
34473447
} else {
3448-
#if USE_ABSTRACT_STACK_FOR_RES_USE_INFO
3448+
#ifdef USE_ABSTRACT_STACK_FOR_RES_USE_INFO
34493449
res_use_info = zend_jit_trace_type_to_info(STACK_VAR_TYPE(opline->result.var));
34503450
#else
34513451
res_use_info = -1;
@@ -3516,7 +3516,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
35163516
if (opline->result_type == IS_CV) {
35173517
res_use_info = RES_USE_INFO();
35183518
} else {
3519-
#if USE_ABSTRACT_STACK_FOR_RES_USE_INFO
3519+
#ifdef USE_ABSTRACT_STACK_FOR_RES_USE_INFO
35203520
res_use_info = zend_jit_trace_type_to_info(STACK_VAR_TYPE(opline->result.var));
35213521
#else
35223522
res_use_info = -1;

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 9 additions & 9 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;
@@ -2641,7 +2641,7 @@ static const zend_jit_stub zend_jit_stubs[] = {
26412641
#endif
26422642
};
26432643

2644-
#if ZTS && defined(ZEND_WIN32)
2644+
#if defined(ZTS) && defined(ZEND_WIN32)
26452645
extern uint32_t _tls_index;
26462646
extern char *_tls_start;
26472647
extern char *_tls_end;
@@ -2659,7 +2659,7 @@ static int zend_jit_setup(void)
26592659
}
26602660
}
26612661

2662-
#if ZTS
2662+
#ifdef ZTS
26632663
# ifdef _WIN64
26642664
tsrm_tls_index = _tls_index * sizeof(void*);
26652665

@@ -2684,7 +2684,7 @@ static int zend_jit_setup(void)
26842684
return FAILURE;
26852685
}
26862686
} while(0);
2687-
# elif ZEND_WIN32
2687+
# elif defined(ZEND_WIN32)
26882688
tsrm_tls_index = _tls_index * sizeof(void*);
26892689

26902690
/* To find offset of "_tsrm_ls_cache" in TLS segment we perform a linear scan of local TLS memory */
@@ -2912,7 +2912,7 @@ static int zend_jit_trace_begin(dasm_State **Dst, uint32_t trace_num, zend_jit_t
29122912
{
29132913
zend_regset regset = ZEND_REGSET_SCRATCH;
29142914

2915-
#if ZTS
2915+
#ifdef ZTS
29162916
if (1) {
29172917
#else
29182918
if ((sizeof(void*) == 8 && !IS_32BIT(&EG(jit_trace_num)))) {
@@ -8915,9 +8915,9 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
89158915
| mov r0, EX:RX->func
89168916
}
89178917
| mov r2, aword [r0 + offsetof(zend_op_array, run_time_cache__ptr)]
8918-
#if ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR
8918+
#if defined(ZEND_MAP_PTR_KIND) && defined(ZEND_MAP_PTR_KIND_PTR) && ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR
89198919
| mov r2, aword [r2]
8920-
#elif ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR_OR_OFFSET
8920+
#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
89218921
if (func && !(func->op_array.fn_flags & ZEND_ACC_CLOSURE)) {
89228922
if (ZEND_MAP_PTR_IS_OFFSET(func->op_array.run_time_cache)) {
89238923
| MEM_OP2_2_ZTS add, r2, aword, compiler_globals, map_ptr_base, r1
@@ -13314,7 +13314,7 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1331413314
if (ssa_op == ssa->ops
1331513315
&& (JIT_G(current_trace)->stop == ZEND_JIT_TRACE_STOP_LOOP ||
1331613316
JIT_G(current_trace)->stop == ZEND_JIT_TRACE_STOP_RECURSIVE_CALL)) {
13317-
#if ZTS
13317+
#ifdef ZTS
1331813318
ZEND_REGSET_INCL(regset, ZREG_R0);
1331913319
#else
1332013320
if ((sizeof(void*) == 8 && !IS_32BIT(&EG(vm_interrupt)))) {
@@ -13327,7 +13327,7 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1332713327

1332813328
if ((ssa->cfg.blocks[b].flags & ZEND_BB_LOOP_HEADER) != 0
1332913329
&& ssa->cfg.blocks[b].start == ssa_op - ssa->ops) {
13330-
#if ZTS
13330+
#ifdef ZTS
1333113331
ZEND_REGSET_INCL(regset, ZREG_R0);
1333213332
#else
1333313333
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
@@ -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)