diff --git a/Zend/Optimizer/block_pass.c b/Zend/Optimizer/block_pass.c index 41f6234652ba..4fe6d872028e 100644 --- a/Zend/Optimizer/block_pass.c +++ b/Zend/Optimizer/block_pass.c @@ -22,6 +22,7 @@ #include "Optimizer/zend_optimizer.h" #include "Optimizer/zend_optimizer_internal.h" #include "zend_API.h" +#include "zend_arena.h" #include "zend_constants.h" #include "zend_execute.h" #include "zend_vm.h" diff --git a/Zend/Optimizer/compact_literals.c b/Zend/Optimizer/compact_literals.c index 9248f0b82244..db0ef752ee22 100644 --- a/Zend/Optimizer/compact_literals.c +++ b/Zend/Optimizer/compact_literals.c @@ -23,6 +23,7 @@ #include "Optimizer/zend_optimizer.h" #include "Optimizer/zend_optimizer_internal.h" +#include "zend_arena.h" #include "zend_API.h" #include "zend_constants.h" #include "zend_execute.h" diff --git a/Zend/Optimizer/dce.c b/Zend/Optimizer/dce.c index 15c9cf5e6e22..4419126e76e9 100644 --- a/Zend/Optimizer/dce.c +++ b/Zend/Optimizer/dce.c @@ -22,6 +22,7 @@ #include "Optimizer/zend_ssa.h" #include "Optimizer/zend_func_info.h" #include "Optimizer/zend_call_graph.h" +#include "zend_arena.h" #include "zend_bitset.h" /* This pass implements a form of dead code elimination (DCE). The algorithm optimistically assumes diff --git a/Zend/Optimizer/dfa_pass.c b/Zend/Optimizer/dfa_pass.c index ac99455c1f80..0b006598e3e1 100644 --- a/Zend/Optimizer/dfa_pass.c +++ b/Zend/Optimizer/dfa_pass.c @@ -19,6 +19,7 @@ #include "Optimizer/zend_optimizer.h" #include "Optimizer/zend_optimizer_internal.h" #include "zend_API.h" +#include "zend_arena.h" #include "zend_constants.h" #include "zend_execute.h" #include "zend_vm.h" diff --git a/Zend/Optimizer/optimize_func_calls.c b/Zend/Optimizer/optimize_func_calls.c index 200b5a6ff83f..98fdecf6d86f 100644 --- a/Zend/Optimizer/optimize_func_calls.c +++ b/Zend/Optimizer/optimize_func_calls.c @@ -23,10 +23,8 @@ #include "Optimizer/zend_optimizer.h" #include "Optimizer/zend_optimizer_internal.h" -#include "zend_API.h" -#include "zend_constants.h" -#include "zend_execute.h" -#include "zend_vm.h" +#include "zend_arena.h" +#include "zend_execute.h" // for zend_vm_calc_used_stack() typedef struct _optimizer_call_info { zend_function *func; diff --git a/Zend/Optimizer/optimize_temp_vars_5.c b/Zend/Optimizer/optimize_temp_vars_5.c index 33d418ffbd99..899ba3d345d2 100644 --- a/Zend/Optimizer/optimize_temp_vars_5.c +++ b/Zend/Optimizer/optimize_temp_vars_5.c @@ -21,6 +21,7 @@ #include "Optimizer/zend_optimizer.h" #include "Optimizer/zend_optimizer_internal.h" +#include "zend_arena.h" #include "zend_API.h" #include "zend_constants.h" #include "zend_execute.h" diff --git a/Zend/Optimizer/sccp.c b/Zend/Optimizer/sccp.c index b039501c921f..ee755998b7d8 100644 --- a/Zend/Optimizer/sccp.c +++ b/Zend/Optimizer/sccp.c @@ -18,8 +18,11 @@ */ #include "zend_API.h" +#include "zend_arena.h" +#include "zend_multiply.h" #include "zend_exceptions.h" #include "zend_ini.h" +#include "zend_optimizer.h" #include "zend_type_info.h" #include "Optimizer/zend_optimizer_internal.h" #include "Optimizer/zend_call_graph.h" diff --git a/Zend/Optimizer/scdf.c b/Zend/Optimizer/scdf.c index 54925e8287b6..fb7337a10099 100644 --- a/Zend/Optimizer/scdf.c +++ b/Zend/Optimizer/scdf.c @@ -16,8 +16,9 @@ +----------------------------------------------------------------------+ */ -#include "Optimizer/zend_optimizer_internal.h" #include "Optimizer/scdf.h" +#include "Optimizer/zend_optimizer_internal.h" +#include "zend_arena.h" /* This defines a generic framework for sparse conditional dataflow propagation. The algorithm is * based on "Sparse conditional constant propagation" by Wegman and Zadeck. We're using a diff --git a/Zend/Optimizer/scdf.h b/Zend/Optimizer/scdf.h index 0d90147e84cb..6e212b5378ea 100644 --- a/Zend/Optimizer/scdf.h +++ b/Zend/Optimizer/scdf.h @@ -20,6 +20,11 @@ #define _SCDF_H #include "zend_bitset.h" +#include "zend_long.h" +#include "zend_ssa.h" + +typedef struct _zend_op_array zend_op_array; +typedef struct _zend_optimizer_ctx zend_optimizer_ctx; typedef struct _scdf_ctx { zend_op_array *op_array; diff --git a/Zend/Optimizer/zend_call_graph.c b/Zend/Optimizer/zend_call_graph.c index c2b7b00cbee1..70342c065474 100644 --- a/Zend/Optimizer/zend_call_graph.c +++ b/Zend/Optimizer/zend_call_graph.c @@ -16,15 +16,11 @@ +----------------------------------------------------------------------+ */ -#include "zend_compile.h" -#include "zend_extensions.h" -#include "Optimizer/zend_optimizer.h" -#include "zend_optimizer_internal.h" -#include "zend_inference.h" #include "zend_call_graph.h" +#include "zend_arena.h" +#include "zend_bitset.h" #include "zend_func_info.h" -#include "zend_inference.h" -#include "zend_call_graph.h" +#include "zend_optimizer_internal.h" static void zend_op_array_calc(zend_op_array *op_array, void *context) { diff --git a/Zend/Optimizer/zend_call_graph.h b/Zend/Optimizer/zend_call_graph.h index 5b1634d561dc..7dd6430dd4e8 100644 --- a/Zend/Optimizer/zend_call_graph.h +++ b/Zend/Optimizer/zend_call_graph.h @@ -20,8 +20,9 @@ #define ZEND_CALL_GRAPH_H #include "zend_ssa.h" -#include "zend_func_info.h" -#include "zend_optimizer.h" + +typedef struct _zend_func_info zend_func_info; +typedef struct _zend_call_info zend_call_info; typedef struct _zend_send_arg_info { zend_op *opline; diff --git a/Zend/Optimizer/zend_cfg.c b/Zend/Optimizer/zend_cfg.c index 219738e6f692..bba2d0ac0a12 100644 --- a/Zend/Optimizer/zend_cfg.c +++ b/Zend/Optimizer/zend_cfg.c @@ -16,13 +16,12 @@ +----------------------------------------------------------------------+ */ -#include "zend_compile.h" #include "zend_cfg.h" -#include "zend_func_info.h" -#include "zend_worklist.h" -#include "zend_optimizer.h" +#include "zend_func_info.h" // for ZEND_FUNC_FREE_LOOP_VAR +#include "zend_globals.h" // struct _zend_executor_globals +#include "zend_globals_macros.h" // for EG() #include "zend_optimizer_internal.h" -#include "zend_sort.h" +#include "zend_worklist.h" static void zend_mark_reachable(zend_op *opcodes, zend_cfg *cfg, zend_basic_block *b) /* {{{ */ { diff --git a/Zend/Optimizer/zend_cfg.h b/Zend/Optimizer/zend_cfg.h index 93d455060686..cf0a591b3630 100644 --- a/Zend/Optimizer/zend_cfg.h +++ b/Zend/Optimizer/zend_cfg.h @@ -19,6 +19,13 @@ #ifndef ZEND_CFG_H #define ZEND_CFG_H +#include "zend_portability.h" // for BEGIN_EXTERN_C + +#include + +typedef struct _zend_arena zend_arena; +typedef struct _zend_op_array zend_op_array; + /* zend_basic_block.flags */ #define ZEND_BB_START (1<<0) /* first block */ #define ZEND_BB_FOLLOW (1<<1) /* follows the next block */ diff --git a/Zend/Optimizer/zend_func_info.c b/Zend/Optimizer/zend_func_info.c index f125f4956b11..654635b5aebe 100644 --- a/Zend/Optimizer/zend_func_info.c +++ b/Zend/Optimizer/zend_func_info.c @@ -17,17 +17,9 @@ +----------------------------------------------------------------------+ */ -#include "zend_compile.h" -#include "zend_extensions.h" -#include "zend_ssa.h" -#include "zend_optimizer_internal.h" -#include "zend_inference.h" -#include "zend_call_graph.h" #include "zend_func_info.h" -#include "zend_inference.h" -#ifdef _WIN32 -#include "win32/ioutil.h" -#endif +#include "zend_extensions.h" // for zend_get_resource_handle() +#include "zend_inference.h" // for zend_get_return_info_from_signature_only(), _ssa_op1_info() typedef uint32_t (*info_func_t)(const zend_call_info *call_info, const zend_ssa *ssa); diff --git a/Zend/Optimizer/zend_func_info.h b/Zend/Optimizer/zend_func_info.h index b53683bdf5e7..34cf591aada6 100644 --- a/Zend/Optimizer/zend_func_info.h +++ b/Zend/Optimizer/zend_func_info.h @@ -19,7 +19,7 @@ #ifndef ZEND_FUNC_INFO_H #define ZEND_FUNC_INFO_H -#include "zend_ssa.h" +#include "zend_call_graph.h" /* func/cfg flags */ #define ZEND_FUNC_INDIRECT_VAR_ACCESS (1<<0) /* accesses variables by name */ @@ -43,6 +43,7 @@ typedef struct _zend_func_info zend_func_info; typedef struct _zend_call_info zend_call_info; +typedef struct _zend_ssa zend_ssa; #define ZEND_FUNC_INFO(op_array) \ ((zend_func_info*)((op_array)->reserved[zend_func_info_rid])) diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index 7ae93147f1e8..ac9f4bc9be0a 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -16,13 +16,15 @@ +----------------------------------------------------------------------+ */ -#include "zend_compile.h" -#include "zend_generators.h" #include "zend_inference.h" +#include "zend_closures.h" // for zend_ce_closure +#include "zend_generators.h" // for zend_ce_generator #include "zend_func_info.h" +#include "zend_globals.h" // struct _zend_executor_globals +#include "zend_globals_macros.h" // for EG() #include "zend_call_graph.h" -#include "zend_closures.h" #include "zend_worklist.h" +#include "zend_optimizer.h" #include "zend_optimizer_internal.h" /* The used range inference algorithm is described in: diff --git a/Zend/Optimizer/zend_inference.h b/Zend/Optimizer/zend_inference.h index 226680019793..1c634ce54ddd 100644 --- a/Zend/Optimizer/zend_inference.h +++ b/Zend/Optimizer/zend_inference.h @@ -19,12 +19,11 @@ #ifndef ZEND_INFERENCE_H #define ZEND_INFERENCE_H -#include "zend_optimizer.h" +#include "zend_cfg.h" // for CRT_CONSTANT() +#include "zend_compile.h" // for struct _zend_op +#include "zend_portability.h" // for BEGIN_EXTERN_C #include "zend_ssa.h" -#include "zend_bitset.h" - -/* Bitmask for type inference (zend_ssa_var_info.type) */ -#include "zend_type_info.h" +#include "zend_type_info.h" // for MAY_BE_* #include diff --git a/Zend/Optimizer/zend_optimizer.c b/Zend/Optimizer/zend_optimizer.c index 956a13d65839..c2640292f46e 100644 --- a/Zend/Optimizer/zend_optimizer.c +++ b/Zend/Optimizer/zend_optimizer.c @@ -21,17 +21,16 @@ #include "Optimizer/zend_optimizer.h" #include "Optimizer/zend_optimizer_internal.h" -#include "zend_API.h" -#include "zend_constants.h" -#include "zend_execute.h" -#include "zend_vm.h" -#include "zend_cfg.h" -#include "zend_func_info.h" -#include "zend_call_graph.h" -#include "zend_inference.h" -#include "zend_dump.h" -#include "php.h" +#include "php_globals.h" // for PG() +#include "zend_API.h" // for ZVAL_EMPTY_STRING() +#include "zend_arena.h" +#include "zend_call_graph.h" // for struct _zend_func_info +#include "zend_dump.h" // for zend_dump_op_array() +#include "zend_inference.h" // for OP1_INFO(), ... +#include "zend_ini.h" #include "zend_observer.h" +#include "zend_virtual_cwd.h" //for IS_ABSOLUTE_PATH() +#include "zend_vm.h" #ifndef ZEND_OPTIMIZER_MAX_REGISTERED_PASSES # define ZEND_OPTIMIZER_MAX_REGISTERED_PASSES 32 diff --git a/Zend/Optimizer/zend_optimizer.h b/Zend/Optimizer/zend_optimizer.h index 16bfd75520d8..ae794b1ae665 100644 --- a/Zend/Optimizer/zend_optimizer.h +++ b/Zend/Optimizer/zend_optimizer.h @@ -22,8 +22,11 @@ #ifndef ZEND_OPTIMIZER_H #define ZEND_OPTIMIZER_H -#include "zend.h" -#include "zend_compile.h" +#include "zend_compile.h" // for zend_op_array +#include "zend_hash.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C + +typedef struct _zend_string zend_string; #define ZEND_OPTIMIZER_PASS_1 (1<<0) /* Simple local optimizations */ #define ZEND_OPTIMIZER_PASS_2 (1<<1) /* */ diff --git a/Zend/Optimizer/zend_ssa.c b/Zend/Optimizer/zend_ssa.c index 67165a9b26d7..84f0d4d260fe 100644 --- a/Zend/Optimizer/zend_ssa.c +++ b/Zend/Optimizer/zend_ssa.c @@ -17,12 +17,13 @@ +----------------------------------------------------------------------+ */ -#include "zend_compile.h" -#include "zend_dfg.h" #include "zend_ssa.h" +#include "zend_arena.h" +#include "zend_optimizer_internal.h" +#include "zend_dfg.h" #include "zend_dump.h" -#include "zend_inference.h" -#include "Optimizer/zend_optimizer_internal.h" +#include "zend_inference.h" // for zend_sub_will_overflow() +#include "zend_type_info.h" // for MAY_BE_REF static bool dominates(const zend_basic_block *blocks, int a, int b) { while (blocks[b].level > blocks[a].level) { diff --git a/Zend/Optimizer/zend_ssa.h b/Zend/Optimizer/zend_ssa.h index ce33a3732fee..b536b6576fa8 100644 --- a/Zend/Optimizer/zend_ssa.h +++ b/Zend/Optimizer/zend_ssa.h @@ -19,10 +19,15 @@ #ifndef ZEND_SSA_H #define ZEND_SSA_H -#include "zend_optimizer.h" #include "zend_cfg.h" +#include "zend_compile.h" // for struct _zend_op +#include "zend_long.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C #include "zend_result.h" +typedef struct _zend_class_entry zend_class_entry; +typedef struct _zend_script zend_script; + typedef struct _zend_ssa_range { zend_long min; zend_long max; diff --git a/Zend/zend.c b/Zend/zend.c index 9bfd9178f52b..7539f6394222 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -18,25 +18,23 @@ */ #include "zend.h" -#include "zend_extensions.h" -#include "zend_modules.h" -#include "zend_constants.h" -#include "zend_list.h" -#include "zend_API.h" -#include "zend_exceptions.h" -#include "zend_builtin_functions.h" -#include "zend_ini.h" -#include "zend_vm.h" -#include "zend_dtrace.h" -#include "zend_virtual_cwd.h" -#include "zend_smart_str.h" -#include "zend_smart_string.h" -#include "zend_cpuinfo.h" -#include "zend_attributes.h" -#include "zend_observer.h" -#include "zend_fibers.h" -#include "zend_call_stack.h" -#include "Optimizer/zend_optimizer.h" +#include "zend_attributes.h" // for zend_attributes_shutdown() +#include "zend_builtin_functions.h" // for zend_startup_builtin_functions() +#include "zend_cpuinfo.h" // for zend_cpu_startup() +#include "zend_constants.h" // for ZEND_CONSTANT_DTOR +#include "zend_errors.h" // for E_ALL, ... +#include "zend_exceptions.h" // for zend_throw_exception_hook +#include "zend_extensions.h" // for zend_startup_extensions_mechanism() +#include "zend_globals.h" // for EG() +#include "zend_ini.h" // for ZEND_INI_MH() +#include "zend_fibers.h" // for ZEND_FIBER_DEFAULT_C_STACK_SIZE +#include "zend_observer.h" // for zend_observer_activate() +#include "zend_smart_str.h" // for smart_str_*() +#include "zend_smart_string.h" // for smart_string_*() +#include "zend_strtod.h" // for zend_startup_strtod() +#include "zend_virtual_cwd.h" // for virtual_cwd_startup() +#include "zend_vm.h" // for ZEND_VM_SET_OPCODE_HANDLER() +#include "Optimizer/zend_optimizer.h" // for zend_optimizer_startup() static size_t global_map_ptr_last = 0; static bool startup_done = false; diff --git a/Zend/zend.h b/Zend/zend.h index a0c0fc2126d3..a9b4a7b05efa 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -24,22 +24,18 @@ #define ZEND_ENGINE_3 -#include "zend_types.h" -#include "zend_map_ptr.h" -#include "zend_errors.h" -#include "zend_alloc.h" -#include "zend_llist.h" -#include "zend_string.h" -#include "zend_hash.h" -#include "zend_ast.h" -#include "zend_gc.h" -#include "zend_variables.h" -#include "zend_iterators.h" -#include "zend_stream.h" -#include "zend_smart_str_public.h" -#include "zend_smart_string_public.h" -#include "zend_signal.h" -#include "zend_type_code.h" +#include "zend_error.h" // TODO remove +#include "zend_map_ptr.h" // for ZEND_MAP_PTR_DEF() +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_result.h" +#include "zend_signal.h" // for ZEND_SIGNAL_[UN]BLOCK_INTERRUPTIONS() +#include "zend_smart_str_public.h" // for smart_str +#include "zend_smart_string_public.h" // for smart_string +#include "zend_types.h" // for HashTable, ... +#include "TSRM/TSRM.h" // for TSRMLS_MAIN_CACHE_EXTERN + +#include +#include #define zend_sprintf sprintf @@ -81,6 +77,10 @@ struct _zend_unserialize_data; typedef struct _zend_serialize_data zend_serialize_data; typedef struct _zend_unserialize_data zend_unserialize_data; +typedef struct _zend_class_iterator_funcs zend_class_iterator_funcs; +typedef struct _zend_class_arrayaccess_funcs zend_class_arrayaccess_funcs; +typedef struct _zend_object_iterator zend_object_iterator; +typedef struct _zend_file_handle zend_file_handle; typedef struct _zend_class_name { zend_string *name; @@ -343,16 +343,6 @@ extern ZEND_API zend_string *(*zend_resolve_path)(zend_string *filename); extern ZEND_API zend_result (*zend_post_startup_cb)(void); extern ZEND_API void (*zend_post_shutdown_cb)(void); -ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); -ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); -/* For custom format specifiers like H */ -ZEND_API ZEND_COLD void zend_error_unchecked(int type, const char *format, ...); -/* If filename is NULL the default filename is used. */ -ZEND_API ZEND_COLD void zend_error_at(int type, zend_string *filename, uint32_t lineno, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 4, 5); -ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_at_noreturn(int type, zend_string *filename, uint32_t lineno, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 4, 5); -ZEND_API ZEND_COLD void zend_error_zstr(int type, zend_string *message); -ZEND_API ZEND_COLD void zend_error_zstr_at(int type, zend_string *filename, uint32_t lineno, zend_string *message); - ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); ZEND_API ZEND_COLD void zend_type_error(const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 1, 2); ZEND_API ZEND_COLD void zend_argument_count_error(const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 1, 2); diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 5247ca1a379a..cb4655e0754c 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -19,15 +19,13 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_execute.h" #include "zend_API.h" -#include "zend_modules.h" +#include "zend_arena.h" +#include "zend_objects.h" // for zend_objects_new() #include "zend_extensions.h" #include "zend_constants.h" -#include "zend_interfaces.h" +#include "zend_interfaces.h" // for zend_ce_stringable #include "zend_exceptions.h" -#include "zend_closures.h" #include "zend_inheritance.h" #include "zend_ini.h" #include "zend_enum.h" diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 8341febd6ac7..d84e977919f8 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -22,14 +22,16 @@ #ifndef ZEND_API_H #define ZEND_API_H -#include "zend_char.h" -#include "zend_modules.h" -#include "zend_list.h" +#include "zend_compile.h" // for zif_handler +#include "zend_execute.h" // for get_active_function_or_method_name() +#include "zend_globals.h" // for struct _zend_compiler_globals used by ZEND_MAP_PTR_GET_IMM() +#include "zend_globals_macros.h" // for CG() used by ZEND_MAP_PTR_GET_IMM() +#include "zend_modules.h" // for SHUTDOWN_FUNC_ARGS +#include "zend_object_handlers.h" // for struct _zend_object_handlers +#include "zend_portability.h" // for BEGIN_EXTERN_C #include "zend_operators.h" -#include "zend_variables.h" -#include "zend_execute.h" -#include "zend_type_info.h" -#include "zend_type_code.h" + +typedef struct _zend_module_entry zend_module_entry; BEGIN_EXTERN_C() diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 4cb9386eed17..3b37b12f3d16 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -51,14 +51,17 @@ * with more specialized routines when the requested size is known. */ -#include "zend.h" #include "zend_alloc.h" -#include "zend_globals.h" -#include "zend_operators.h" -#include "zend_multiply.h" +#include "zend.h" // for zend_try #include "zend_bitset.h" +#include "zend_long.h" +#include "zend_globals.h" #include "zend_mmap.h" -#include +#include "zend_multiply.h" // for zend_safe_address_guarded() + +#if ZEND_DEBUG && defined(HAVE_KILL) && defined(HAVE_GETPID) +# include +#endif #ifdef HAVE_UNISTD_H # include @@ -78,7 +81,8 @@ #include #include #include -#include + +#include // for jmp_buf (used by zend_try) #ifndef _WIN32 # include @@ -139,6 +143,14 @@ static size_t _real_page_size = ZEND_MM_PAGE_SIZE; # define ZEND_MM_ERROR 1 /* report system errors */ #endif +#if ZEND_MM_CUSTOM +# include "zend_hash.h" +#endif + +#if ZEND_MM_ERROR +# include +#endif + #ifndef ZEND_MM_CHECK # define ZEND_MM_CHECK(condition, message) do { \ if (UNEXPECTED(!(condition))) { \ diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index 30fea71e2efa..3fa430eeb083 100644 --- a/Zend/zend_alloc.h +++ b/Zend/zend_alloc.h @@ -24,9 +24,8 @@ #include "zend_portability.h" #include "zend_result.h" -#include - -#include "../TSRM/TSRM.h" +#include +#include #ifndef ZEND_MM_ALIGNMENT # error "ZEND_MM_ALIGNMENT was not defined during configure" diff --git a/Zend/zend_arena.h b/Zend/zend_arena.h index a44082e52fb9..c9fa1fb0525b 100644 --- a/Zend/zend_arena.h +++ b/Zend/zend_arena.h @@ -19,7 +19,11 @@ #ifndef _ZEND_ARENA_H_ #define _ZEND_ARENA_H_ -#include "zend.h" +#include "zend_alloc.h" +#include "zend_multiply.h" // for zend_safe_address() +#include "zend_error.h" + +#include // for size_t #ifndef ZEND_TRACK_ARENA_ALLOC diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 9290ca3805ab..5a060f6764eb 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -18,13 +18,13 @@ */ #include "zend_ast.h" -#include "zend_API.h" -#include "zend_operators.h" -#include "zend_language_parser.h" -#include "zend_smart_str.h" -#include "zend_exceptions.h" +#include "zend_API.h" // for array_set_zval_key +#include "zend_arena.h" #include "zend_constants.h" #include "zend_enum.h" +#include "zend_language_parser.h" // for T_* +#include "zend_smart_str.h" +#include "zend_exceptions.h" // for zend_throw_error ZEND_API zend_ast_process_t zend_ast_process = NULL; diff --git a/Zend/zend_ast.h b/Zend/zend_ast.h index ca12afd6b214..5afdaa658111 100644 --- a/Zend/zend_ast.h +++ b/Zend/zend_ast.h @@ -21,7 +21,9 @@ #ifndef ZEND_AST_H #define ZEND_AST_H -#include "zend.h" +#include "zend_types.h" // for zval + +#include #ifndef ZEND_AST_SPEC # define ZEND_AST_SPEC 1 diff --git a/Zend/zend_attributes.c b/Zend/zend_attributes.c index 2dbcb47392e9..15cb324ef628 100644 --- a/Zend/zend_attributes.c +++ b/Zend/zend_attributes.c @@ -17,11 +17,9 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_API.h" #include "zend_attributes.h" +#include "zend_API.h" // needed by zend_attributes_arginfo.h #include "zend_attributes_arginfo.h" -#include "zend_exceptions.h" #include "zend_smart_str.h" ZEND_API zend_class_entry *zend_ce_attribute; diff --git a/Zend/zend_attributes.h b/Zend/zend_attributes.h index fc02a7d656e2..78698ef147c3 100644 --- a/Zend/zend_attributes.h +++ b/Zend/zend_attributes.h @@ -20,6 +20,13 @@ #ifndef ZEND_ATTRIBUTES_H #define ZEND_ATTRIBUTES_H +#include "zend.h" // for struct _zend_class_entry +#include "zend_compile.h" // for ZEND_USER_CLASS +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_types.h" // for zval + +#include + #define ZEND_ATTRIBUTE_TARGET_CLASS (1<<0) #define ZEND_ATTRIBUTE_TARGET_FUNCTION (1<<1) #define ZEND_ATTRIBUTE_TARGET_METHOD (1<<2) @@ -37,6 +44,9 @@ #define ZEND_ATTRIBUTE_SIZE(argc) \ (sizeof(zend_attribute) + sizeof(zend_attribute_arg) * (argc) - sizeof(zend_attribute_arg)) +typedef struct _zend_class_constant zend_class_constant; +typedef struct _zend_property_info zend_property_info; + BEGIN_EXTERN_C() extern ZEND_API zend_class_entry *zend_ce_attribute; diff --git a/Zend/zend_build.h b/Zend/zend_build.h index c604fb311a74..f7f88cf46a53 100644 --- a/Zend/zend_build.h +++ b/Zend/zend_build.h @@ -19,6 +19,12 @@ #ifndef ZEND_BUILD_H #define ZEND_BUILD_H +#ifdef PHP_WIN32 +#include "config.w32.h" +#else +#include "zend_config.h" +#endif + #define ZEND_TOSTR_(x) #x #define ZEND_TOSTR(x) ZEND_TOSTR_(x) diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 93cd9040dd3a..a914579fc9f0 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -17,20 +17,17 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_API.h" -#include "zend_attributes.h" -#include "zend_gc.h" #include "zend_builtin_functions.h" +#include "zend_API.h" // for ZEND_MINIT_FUNCTION +#include "zend_attributes.h" // for zend_add_class_attribute() +#include "zend_closures.h" // for zend_ce_closure #include "zend_constants.h" -#include "zend_ini.h" -#include "zend_interfaces.h" -#include "zend_exceptions.h" +#include "zend_exceptions.h" // for zend_register_default_classes() #include "zend_extensions.h" -#include "zend_closures.h" #include "zend_generators.h" +#include "zend_ini.h" +#include "zend_interfaces.h" // for zend_call_method_with_1_params() #include "zend_builtin_functions_arginfo.h" -#include "zend_smart_str.h" /* }}} */ diff --git a/Zend/zend_builtin_functions.h b/Zend/zend_builtin_functions.h index b037891299e1..42644717354e 100644 --- a/Zend/zend_builtin_functions.h +++ b/Zend/zend_builtin_functions.h @@ -20,8 +20,11 @@ #ifndef ZEND_BUILTIN_FUNCTIONS_H #define ZEND_BUILTIN_FUNCTIONS_H +#include "zend_portability.h" // for BEGIN_EXTERN_C #include "zend_result.h" +typedef struct _zval_struct zval; + zend_result zend_startup_builtin_functions(void); BEGIN_EXTERN_C() diff --git a/Zend/zend_call_stack.c b/Zend/zend_call_stack.c index dadaa60dcb20..738dfbec5172 100644 --- a/Zend/zend_call_stack.c +++ b/Zend/zend_call_stack.c @@ -18,11 +18,11 @@ /* Inspired from Chromium's stack_util.cc */ -#include "zend.h" -#include "zend_globals.h" -#include "zend_portability.h" #include "zend_call_stack.h" +#include "zend_globals.h" + #include + #ifdef ZEND_WIN32 # include # include diff --git a/Zend/zend_call_stack.h b/Zend/zend_call_stack.h index c71395bd6d42..14254f6fcfe7 100644 --- a/Zend/zend_call_stack.h +++ b/Zend/zend_call_stack.h @@ -19,12 +19,16 @@ #ifndef ZEND_CALL_STACK_H #define ZEND_CALL_STACK_H -#include "zend.h" -#include "zend_portability.h" +#include "zend_portability.h" // for zend_always_inline + #ifdef __APPLE__ # include #endif +#include +#include +#include + #ifdef ZEND_CHECK_STACK_LIMIT typedef struct _zend_call_stack { diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 4c326a6c79b1..03601ce3fc78 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -18,14 +18,11 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_API.h" #include "zend_closures.h" -#include "zend_exceptions.h" -#include "zend_interfaces.h" -#include "zend_objects.h" -#include "zend_objects_API.h" -#include "zend_globals.h" +#include "zend_API.h" //for ZEND_METHOD() +#include "zend_arena.h" +#include "zend_compile.h" // for union _zend_function +#include "zend_objects.h" // for zend_object_std_init() #include "zend_closures_arginfo.h" typedef struct _zend_closure { diff --git a/Zend/zend_closures.h b/Zend/zend_closures.h index 2d093fa61680..af24387f5e0d 100644 --- a/Zend/zend_closures.h +++ b/Zend/zend_closures.h @@ -20,6 +20,17 @@ #ifndef ZEND_CLOSURES_H #define ZEND_CLOSURES_H +#include "zend_portability.h" // for BEGIN_EXTERN_C + +#include + +typedef struct _zend_class_entry zend_class_entry; +typedef struct _zend_execute_data zend_execute_data; +typedef union _zend_function zend_function; +typedef struct _zend_object zend_object; +typedef struct _zend_string zend_string; +typedef struct _zval_struct zval; + BEGIN_EXTERN_C() /* This macro depends on zend_closure structure layout */ diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 711f33b568ba..01cac3477a3a 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -18,23 +18,23 @@ +----------------------------------------------------------------------+ */ -#include -#include "zend.h" -#include "zend_attributes.h" #include "zend_compile.h" +#include "zend_API.h" // for zend_get_object_type() +#include "zend_arena.h" +#include "zend_attributes.h" #include "zend_constants.h" -#include "zend_llist.h" -#include "zend_API.h" -#include "zend_exceptions.h" -#include "zend_interfaces.h" -#include "zend_virtual_cwd.h" -#include "zend_multibyte.h" -#include "zend_language_scanner.h" -#include "zend_inheritance.h" -#include "zend_vm.h" #include "zend_enum.h" -#include "zend_observer.h" -#include "zend_call_stack.h" +#include "zend_exceptions.h" // for zend_throw_exception_ex() +#include "zend_globals.h" // struct _zend_compiler_globals +#include "zend_globals_macros.h" // for CG() +#include "zend_inheritance.h" // for zend_do_link_class() +#include "zend_language_parser.h" +#include "zend_language_scanner.h" +#include "zend_list.h" // for zend_init_rsrc_list() +#include "zend_observer.h" // for zend_observer_function_declared_notify() +#include "zend_type_info.h" // for MAY_BE_* +#include "zend_virtual_cwd.h" // for IS_SLASH_P, DEFAULT_SLASH +#include "zend_vm.h" // for ZEND_VM_SET_OPCODE_HANDLER() #define SET_NODE(target, src) do { \ target ## _type = (src)->op_type; \ diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 22221f2265c3..2b4f020d3f09 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -20,14 +20,12 @@ #ifndef ZEND_COMPILE_H #define ZEND_COMPILE_H -#include "zend.h" +#include "zend.h" // for INTERNAL_FUNCTION_PARAMETERS #include "zend_ast.h" +#include "zend_portability.h" //for ZEND_FASTCALL -#include #include -#include "zend_llist.h" - #define SET_UNUSED(op) do { \ op ## _type = IS_UNUSED; \ op.num = (uint32_t) -1; \ @@ -759,8 +757,6 @@ struct _zend_execute_data { #define ZEND_EXTRA_VALUE 1 -#include "zend_globals.h" - typedef enum _zend_compile_position { ZEND_COMPILE_POSITION_AT_SHEBANG = 0, ZEND_COMPILE_POSITION_AT_OPEN_TAG, diff --git a/Zend/zend_cpuinfo.c b/Zend/zend_cpuinfo.c index 809e379c8605..9707ec2c88aa 100644 --- a/Zend/zend_cpuinfo.c +++ b/Zend/zend_cpuinfo.c @@ -17,6 +17,10 @@ */ #include "zend_cpuinfo.h" +#include "zend_portability.h" // for ZEND_ASSERT() + +#include +#include typedef struct _zend_cpu_info { uint32_t eax; diff --git a/Zend/zend_cpuinfo.h b/Zend/zend_cpuinfo.h index 31e7c54e0b6f..7a4ab2e3e1b8 100644 --- a/Zend/zend_cpuinfo.h +++ b/Zend/zend_cpuinfo.h @@ -19,7 +19,11 @@ #ifndef ZEND_CPU_INFO_H #define ZEND_CPU_INFO_H -#include "zend.h" +#ifdef PHP_WIN32 +# include "zend_config.w32.h" +#else +# include "php_config.h" // for ZEND_API +#endif #define ZEND_CPU_EBX_MASK (1<<30) #define ZEND_CPU_EDX_MASK (1U<<31) @@ -237,7 +241,7 @@ static inline int zend_cpu_supports_avx512(void) { return 0; } -static zend_always_inline int zend_cpu_supports_avx512_vbmi(void) { +static inline int zend_cpu_supports_avx512_vbmi(void) { /* TODO: avx512_vbmi use ECX of cpuid 7 */ return 0; } diff --git a/Zend/zend_default_classes.c b/Zend/zend_default_classes.c index 7ab9b8325a39..d862a94226fd 100644 --- a/Zend/zend_default_classes.c +++ b/Zend/zend_default_classes.c @@ -17,12 +17,9 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_API.h" +#include "zend_exceptions.h" #include "zend_attributes.h" -#include "zend_builtin_functions.h" #include "zend_interfaces.h" -#include "zend_exceptions.h" #include "zend_closures.h" #include "zend_generators.h" #include "zend_weakrefs.h" diff --git a/Zend/zend_enum.c b/Zend/zend_enum.c index 435ebfeaf109..13e61bb5f36e 100644 --- a/Zend/zend_enum.c +++ b/Zend/zend_enum.c @@ -16,13 +16,13 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_API.h" -#include "zend_compile.h" +#include "zend_enum.h" +#include "zend_arena.h" // ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX2 +#include "zend_API.h" // for INIT_CLASS_ENTRY_EX() #include "zend_enum_arginfo.h" #include "zend_interfaces.h" -#include "zend_enum.h" -#include "zend_extensions.h" +#include "zend_extensions.h" // for zend_internal_run_time_cache_reserved_size() +#include "zend_objects.h" // for zend_objects_new() #include "zend_observer.h" #define ZEND_ENUM_DISALLOW_MAGIC_METHOD(propertyName, methodName) \ diff --git a/Zend/zend_enum.h b/Zend/zend_enum.h index 7b58592d42bd..3aabc14f4e2e 100644 --- a/Zend/zend_enum.h +++ b/Zend/zend_enum.h @@ -19,8 +19,11 @@ #ifndef ZEND_ENUM_H #define ZEND_ENUM_H -#include "zend.h" -#include "zend_types.h" +#include "zend_compile.h" // for OBJ_PROP_NUM +#include "zend_portability.h" // for BEGIN_EXTERN_C + +typedef struct _zend_class_entry zend_class_entry; +typedef struct _zend_function_entry zend_function_entry; #include diff --git a/Zend/zend_error.h b/Zend/zend_error.h new file mode 100644 index 000000000000..a683fe1cf3ae --- /dev/null +++ b/Zend/zend_error.h @@ -0,0 +1,41 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.00 of the Zend license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.zend.com/license/2_00.txt. | + | If you did not receive a copy of the Zend license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@zend.com so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ +*/ + +#ifndef ZEND_ERROR_H +#define ZEND_ERROR_H + +#include "zend_errors.h" // for E_* (as zend_error_noreturn() parameter) +#include "zend_portability.h" // for BEGIN_EXTERN_C + +#include + +typedef struct _zend_string zend_string; + +BEGIN_EXTERN_C() + +ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); +ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); +/* For custom format specifiers like H */ +ZEND_API ZEND_COLD void zend_error_unchecked(int type, const char *format, ...); +/* If filename is NULL the default filename is used. */ +ZEND_API ZEND_COLD void zend_error_at(int type, zend_string *filename, uint32_t lineno, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 4, 5); +ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_at_noreturn(int type, zend_string *filename, uint32_t lineno, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 4, 5); +ZEND_API ZEND_COLD void zend_error_zstr(int type, zend_string *message); +ZEND_API ZEND_COLD void zend_error_zstr_at(int type, zend_string *filename, uint32_t lineno, zend_string *message); + +END_EXTERN_C() + +#endif /* ZEND_H */ diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 174234e2f438..cbaa7ffc519f 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -19,16 +19,18 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_API.h" -#include "zend_builtin_functions.h" -#include "zend_interfaces.h" #include "zend_exceptions.h" -#include "zend_vm.h" -#include "zend_dtrace.h" +#include "zend_API.h" +#include "zend_builtin_functions.h" // for zend_fetch_debug_backtrace() +#include "zend_interfaces.h" // for zend_ce_stringable #include "zend_smart_str.h" -#include "zend_exceptions_arginfo.h" -#include "zend_observer.h" +#include "zend_exceptions_arginfo.h" // for register_class_*() +#include "zend_objects.h" // for zend_objects_new() +#include "zend_observer.h" // for zend_observer_error_notify() + +#ifdef HAVE_DTRACE +#include "zend_dtrace.h" +#endif ZEND_API zend_class_entry *zend_ce_throwable; ZEND_API zend_class_entry *zend_ce_exception; diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h index 0c701c3326ca..17aaa78d07fb 100644 --- a/Zend/zend_exceptions.h +++ b/Zend/zend_exceptions.h @@ -22,8 +22,18 @@ #ifndef ZEND_EXCEPTIONS_H #define ZEND_EXCEPTIONS_H +#include "zend_long.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C #include "zend_result.h" +#include + +typedef struct _zend_class_entry zend_class_entry; +typedef struct _zend_object zend_object; +typedef struct _zend_string zend_string; +typedef struct _zval_struct zval; +typedef struct _zend_array HashTable; + BEGIN_EXTERN_C() extern ZEND_API zend_class_entry *zend_ce_throwable; diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index e15469c539e9..5ce8fe0384df 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -20,34 +20,26 @@ #define ZEND_INTENSIVE_DEBUGGING 0 -#include -#include - -#include "zend.h" -#include "zend_compile.h" #include "zend_execute.h" -#include "zend_API.h" -#include "zend_ptr_stack.h" +#include "zend_API.h" // for ZEND_FUNCTION() +#include "zend_arena.h" #include "zend_constants.h" #include "zend_extensions.h" #include "zend_ini.h" +#include "zend_iterators.h" #include "zend_exceptions.h" -#include "zend_interfaces.h" #include "zend_closures.h" -#include "zend_generators.h" -#include "zend_vm.h" -#include "zend_dtrace.h" -#include "zend_inheritance.h" -#include "zend_type_info.h" +#include "zend_generators.h" // for zend_ce_generator +#include "zend_inheritance.h" // for zend_do_link_class() #include "zend_smart_str.h" #include "zend_observer.h" -#include "zend_system_id.h" -#include "zend_call_stack.h" -#include "Optimizer/zend_func_info.h" /* Virtual current working directory support */ #include "zend_virtual_cwd.h" +#include +#include + #ifdef HAVE_GCC_GLOBAL_REGS # if defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 && defined(i386) # define ZEND_VM_FP_GLOBAL_REG "%esi" @@ -5406,6 +5398,14 @@ static zend_always_inline zend_execute_data *_zend_vm_stack_push_call_frame(uint /* This callback disables optimization of "vm_stack_data" variable in VM */ ZEND_API void (ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data) = NULL; +#include "zend_fibers.h" // needed by zend_vm_execute.h +#include "zend_interfaces.h" // needed by zend_vm_execute.h +#include "zend_objects.h" // needed by zend_vm_execute.h + +#ifdef HAVE_DTRACE +#include "zend_dtrace.h" // needed by zend_vm_execute.h for DTRACE_EXCEPTION_CAUGHT() +#endif + #include "zend_vm_execute.h" ZEND_API zend_result zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler) diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index db6bdaff86f6..b2e0acf58c0d 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -21,11 +21,14 @@ #ifndef ZEND_EXECUTE_H #define ZEND_EXECUTE_H -#include "zend_compile.h" -#include "zend_hash.h" -#include "zend_operators.h" +#include "zend_compile.h" // for zend_op_array +#include "zend_globals.h" // for struct _zend_executor_globals +#include "zend_globals_macros.h" // for EG() +#include "zend_list.h" // for zend_rsrc_list_get_rsrc_type() +#include "zend_portability.h" // for BEGIN_EXTERN_C #include "zend_type_code.h" -#include "zend_variables.h" +#include "zend_types.h" // for zend_execute_data +#include "zend_variables.h" // for rc_dtor_func() #include @@ -189,6 +192,7 @@ ZEND_API zend_result ZEND_FASTCALL zval_update_constant_ex(zval *pp, zend_class_ ZEND_API zend_result ZEND_FASTCALL zval_update_constant_with_ctx(zval *pp, zend_class_entry *scope, zend_ast_evaluate_ctx *ctx); /* dedicated Zend executor functions - do not use! */ +typedef struct _zend_vm_stack *zend_vm_stack; struct _zend_vm_stack { zval *top; zval *end; diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index c279cdc3caff..84ef0a810b72 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -18,26 +18,20 @@ +----------------------------------------------------------------------+ */ -#include -#include - -#include "zend.h" -#include "zend_compile.h" #include "zend_execute.h" -#include "zend_API.h" -#include "zend_stack.h" +#include "zend_API.h" // for zend_fcall_info #include "zend_constants.h" +#include "zend_closures.h" // for ZEND_CLOSURE_OBJECT() +#include "zend_exceptions.h" // for zend_rethrow_exception() #include "zend_extensions.h" -#include "zend_exceptions.h" -#include "zend_closures.h" -#include "zend_generators.h" -#include "zend_vm.h" -#include "zend_float.h" -#include "zend_fibers.h" -#include "zend_weakrefs.h" -#include "zend_inheritance.h" -#include "zend_observer.h" -#include "zend_call_stack.h" +#include "zend_fibers.h" // for zend_fiber_init() +#include "zend_observer.h" // for ZEND_OBSERVER_*() +#include "zend_stream.h" // for zend_stream_shutdown() +#include "zend_weakrefs.h" // for zend_weakrefs_init() + +#include +#include + #ifdef HAVE_SYS_TIME_H #include #endif diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c index ffcd32aa08fd..0276582b4ae8 100644 --- a/Zend/zend_extensions.c +++ b/Zend/zend_extensions.c @@ -18,7 +18,10 @@ */ #include "zend_extensions.h" -#include "zend_system_id.h" +#include "zend_arena.h" +#include "zend_globals.h" // for struct _zend_compiler_globals +#include "zend_globals_macros.h" // for CG() +#include "zend_system_id.h" // for zend_add_system_entropy() ZEND_API zend_llist zend_extensions; ZEND_API uint32_t zend_extension_flags = 0; diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index 50ac657bb803..61d86d16bb59 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -20,10 +20,17 @@ #ifndef ZEND_EXTENSIONS_H #define ZEND_EXTENSIONS_H -#include "zend_compile.h" -#include "zend_build.h" +#include "zend_build.h" // for ZEND_TOSTR() +#include "zend_portability.h" // for BEGIN_EXTERN_C #include "zend_result.h" +#include // for size_t +#include + +typedef struct _zend_execute_data zend_execute_data; +typedef struct _zend_op_array zend_op_array; +typedef struct _zend_llist zend_llist; + /* The constants below are derived from ext/opcache/ZendAccelerator.h diff --git a/Zend/zend_fibers.c b/Zend/zend_fibers.c index 99b044adbd55..866ad4fc8a7f 100644 --- a/Zend/zend_fibers.c +++ b/Zend/zend_fibers.c @@ -17,20 +17,18 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_API.h" -#include "zend_ini.h" -#include "zend_vm.h" +#include "zend_fibers.h" #include "zend_exceptions.h" -#include "zend_builtin_functions.h" +#include "zend_ini.h" +#include "zend_mmap.h" // for zend_mmap_set_name() #include "zend_observer.h" -#include "zend_mmap.h" -#include "zend_compile.h" -#include "zend_closures.h" - -#include "zend_fibers.h" +#include "zend_objects.h" // for zend_object_std_init() #include "zend_fibers_arginfo.h" +#ifdef ZEND_WIN32 +# include "win32/winutil.h" // for php_win32_error_to_msg() +#endif + #ifdef HAVE_VALGRIND # include #endif @@ -44,6 +42,9 @@ # include # include +# include +# include // for strerror() + # if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) # define MAP_ANONYMOUS MAP_ANON # endif diff --git a/Zend/zend_fibers.h b/Zend/zend_fibers.h index 5c81f44a642e..d4ee514a87da 100644 --- a/Zend/zend_fibers.h +++ b/Zend/zend_fibers.h @@ -20,14 +20,18 @@ #ifndef ZEND_FIBERS_H #define ZEND_FIBERS_H -#include "zend_API.h" -#include "zend_types.h" +#include "zend_API.h" // for struct zend_fcall_info +#include "zend_portability.h" // for BEGIN_EXTERN_C + +#include #define ZEND_FIBER_GUARD_PAGES 1 #define ZEND_FIBER_DEFAULT_C_STACK_SIZE (4096 * (((sizeof(void *)) < 8) ? 256 : 512)) #define ZEND_FIBER_VM_STACK_SIZE (1024 * sizeof(zval)) +typedef struct _zend_fiber_context zend_fiber_context; + BEGIN_EXTERN_C() typedef enum { diff --git a/Zend/zend_float.c b/Zend/zend_float.c index 90af0c4a5f90..ca2ed83282de 100644 --- a/Zend/zend_float.c +++ b/Zend/zend_float.c @@ -16,9 +16,9 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_compile.h" #include "zend_float.h" +#include "zend_globals.h" // struct _zend_executor_globals +#include "zend_globals_macros.h" // for EG() ZEND_API void zend_init_fpu(void) /* {{{ */ { diff --git a/Zend/zend_float.h b/Zend/zend_float.h index c8e91122a359..d4d67592a5f1 100644 --- a/Zend/zend_float.h +++ b/Zend/zend_float.h @@ -19,6 +19,8 @@ #ifndef ZEND_FLOAT_H #define ZEND_FLOAT_H +#include "zend_portability.h" // for BEGIN_EXTERN_C + BEGIN_EXTERN_C() /* diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c index 2ed34b3e4812..007506e35802 100644 --- a/Zend/zend_gc.c +++ b/Zend/zend_gc.c @@ -66,9 +66,14 @@ * * @see http://researcher.watson.ibm.com/researcher/files/us-bacon/Bacon01Concurrent.pdf */ -#include "zend.h" -#include "zend_API.h" -#include "zend_fibers.h" + +#include "zend_gc.h" +#include "zend_alloc.h" // for ZEND_MM_OVERHEAD +#include "zend_fibers.h" // for zend_fiber_switch_block() +#include "zend_globals.h" // for struct _zend_executor_globals +#include "zend_globals_macros.h" // for EG() +#include "zend_objects.h" // for zend_objects_destroy_object() +#include "zend_error.h" #ifndef GC_BENCH # define GC_BENCH 0 diff --git a/Zend/zend_gc.h b/Zend/zend_gc.h index 0589e193f4a1..eb8b3cb468ca 100644 --- a/Zend/zend_gc.h +++ b/Zend/zend_gc.h @@ -20,6 +20,12 @@ #ifndef ZEND_GC_H #define ZEND_GC_H +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_types.h" // for GC_TYPE_INFO() + +#include +#include + BEGIN_EXTERN_C() typedef struct _zend_gc_status { diff --git a/Zend/zend_gdb.c b/Zend/zend_gdb.c index 02afb6bc6f7b..5535969646a8 100644 --- a/Zend/zend_gdb.c +++ b/Zend/zend_gdb.c @@ -17,17 +17,23 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" #include "zend_gdb.h" +#include "zend_portability.h" // for zend_never_inline -#include -#include -#include -#include +#include +#include // for malloc(), free() + +#ifdef __linux__ +# include // for open() +# include // for sprintf() +# include // for strstr() +# include // for read(), readlink() +#endif #if defined(__FreeBSD__) # include # include +# include // for getpid() #endif enum { diff --git a/Zend/zend_gdb.h b/Zend/zend_gdb.h index aad0fefb097b..2e09b8fa8151 100644 --- a/Zend/zend_gdb.h +++ b/Zend/zend_gdb.h @@ -20,6 +20,15 @@ #ifndef ZEND_GDB #define ZEND_GDB +#ifdef PHP_WIN32 +# include "zend_config.w32.h" +#else +# include "php_config.h" // for ZEND_API +#endif + +#include +#include // for size_t + ZEND_API bool zend_gdb_register_code(const void *object, size_t size); ZEND_API void zend_gdb_unregister_all(void); ZEND_API bool zend_gdb_present(void); diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index f0f6e59bf9f2..9f8cfb9215a1 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -17,14 +17,15 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_API.h" -#include "zend_interfaces.h" -#include "zend_exceptions.h" #include "zend_generators.h" -#include "zend_closures.h" -#include "zend_generators_arginfo.h" +#include "zend_API.h" // for ZEND_METHOD() +#include "zend_closures.h" // for ZEND_CLOSURE_OBJECT() +#include "zend_exceptions.h" // for zend_throw_exception_object() +#include "zend_execute.h" // for zend_vm_stack_push_call_frame(() +#include "zend_interfaces.h" // for zend_ce_iterator() +#include "zend_objects.h" // for zend_object_std_init() #include "zend_observer.h" +#include "zend_generators_arginfo.h" // for register_class_Generator() ZEND_API zend_class_entry *zend_ce_generator; ZEND_API zend_class_entry *zend_ce_ClosedGeneratorException; diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index b3fb44c35335..9b95119bcb21 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -20,8 +20,17 @@ #ifndef ZEND_GENERATORS_H #define ZEND_GENERATORS_H +#include "zend_compile.h" // for struct _zend_execute_data +#include "zend_portability.h" // for BEGIN_EXTERN_C + #include +typedef struct _zend_class_entry zend_class_entry; +typedef struct _zend_execute_data zend_execute_data; +typedef struct _zend_object zend_object; +typedef struct _zval_struct zval; +typedef struct _zend_array HashTable; + BEGIN_EXTERN_C() extern ZEND_API zend_class_entry *zend_ce_generator; diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index 9243597c27c1..f5165aa54f1d 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -20,29 +20,31 @@ #ifndef ZEND_GLOBALS_H #define ZEND_GLOBALS_H - -#include -#include - #include "zend_globals_macros.h" #include "zend_atomic.h" +#include "zend_gc.h" // for zend_get_gc_buffer #include "zend_stack.h" #include "zend_ptr_stack.h" -#include "zend_hash.h" #include "zend_llist.h" -#include "zend_objects.h" #include "zend_objects_API.h" -#include "zend_modules.h" -#include "zend_float.h" -#include "zend_multibyte.h" -#include "zend_multiply.h" -#include "zend_arena.h" +#include "zend_float.h" // for XPFPA_HAVE_CW, XPFPA_CW_DATATYPE +#include "zend_multibyte.h" // for zend_encoding_filter + +#ifdef ZEND_CHECK_STACK_LIMIT #include "zend_call_stack.h" +#endif + +#include // for JMP_BUF +#include /* Define ZTS if you want a thread-safe Zend */ /*#undef ZTS*/ +typedef struct _zend_arena zend_arena; +typedef struct _zend_objects_store zend_objects_store; +typedef struct _zend_array HashTable; + #ifdef ZTS BEGIN_EXTERN_C() diff --git a/Zend/zend_globals_macros.h b/Zend/zend_globals_macros.h index 59b3daca53fd..98f4940f4791 100644 --- a/Zend/zend_globals_macros.h +++ b/Zend/zend_globals_macros.h @@ -20,6 +20,12 @@ #ifndef ZEND_GLOBALS_MACROS_H #define ZEND_GLOBALS_MACROS_H +#include "zend_portability.h" + +#ifdef ZTS +# include "TSRM.h" +#endif + typedef struct _zend_compiler_globals zend_compiler_globals; typedef struct _zend_executor_globals zend_executor_globals; typedef struct _zend_php_scanner_globals zend_php_scanner_globals; diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 93d10119519b..db1c0a6b49d5 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -18,6 +18,7 @@ +----------------------------------------------------------------------+ */ +#include "zend_hash.h" #include "zend.h" #include "zend_globals.h" #include "zend_variables.h" diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index dfcf9c0c8b50..dcb3755ec564 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -21,10 +21,15 @@ #ifndef ZEND_HASH_H #define ZEND_HASH_H -#include "zend.h" -#include "zend_sort.h" +#include "zend_alloc.h" // for pefree() +#include "zend_long.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_sort.h" // for zend_sort() +#include "zend_string.h" // for ZSTR_VAL() #include "zend_type_code.h" +#include + #define HASH_KEY_IS_STRING 1 #define HASH_KEY_IS_LONG 2 #define HASH_KEY_NON_EXISTENT 3 diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c index 501eed575713..316ab7adb0fc 100644 --- a/Zend/zend_highlight.c +++ b/Zend/zend_highlight.c @@ -17,13 +17,13 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include -#include "zend_compile.h" #include "zend_highlight.h" -#include "zend_ptr_stack.h" -#include "zend_globals.h" -#include "zend_exceptions.h" +#include "zend.h" // for ZEND_PUTS() +#include "zend_exceptions.h" // for zend_clear_exception() +#include "zend_globals.h" // for zend_php_scanner_globals +#include "zend_globals_macros.h" // for LANG_SCNG() +#include "zend_language_parser.h" // for T_* +#include "zend_variables.h" // for zval_ptr_dtor_str() ZEND_API void zend_html_putc(char c) { diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h index dd48ae1f3978..a05df74810e8 100644 --- a/Zend/zend_highlight.h +++ b/Zend/zend_highlight.h @@ -20,6 +20,7 @@ #ifndef ZEND_HIGHLIGHT_H #define ZEND_HIGHLIGHT_H +#include "zend_portability.h" // for BEGIN_EXTERN_C #include "zend_result.h" #define HL_COMMENT_COLOR "#FF8000" /* orange */ @@ -28,6 +29,7 @@ #define HL_STRING_COLOR "#DD0000" /* red */ #define HL_KEYWORD_COLOR "#007700" /* green */ +typedef struct _zend_string zend_string; typedef struct _zend_syntax_highlighter_ini { char *highlight_html; diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 61b1e06e7cb6..26dc0e8365c2 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -17,19 +17,19 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_API.h" -#include "zend_compile.h" -#include "zend_execute.h" #include "zend_inheritance.h" -#include "zend_interfaces.h" -#include "zend_smart_str.h" -#include "zend_operators.h" -#include "zend_exceptions.h" -#include "zend_enum.h" +#include "zend_API.h" // for zend_get_object_type_uc() +#include "zend_arena.h" #include "zend_attributes.h" +#include "zend_compile.h" #include "zend_constants.h" +#include "zend_enum.h" +#include "zend_exceptions.h" +#include "zend_execute.h" // for zend_lookup_class_ex() +#include "zend_interfaces.h" // for zend_ce_stringable +#include "zend_globals.h" // for CG() #include "zend_observer.h" +#include "zend_smart_str.h" ZEND_API zend_class_entry* (*zend_inheritance_cache_get)(zend_class_entry *ce, zend_class_entry *parent, zend_class_entry **traits_and_interfaces) = NULL; ZEND_API zend_class_entry* (*zend_inheritance_cache_add)(zend_class_entry *ce, zend_class_entry *proto, zend_class_entry *parent, zend_class_entry **traits_and_interfaces, HashTable *dependencies) = NULL; diff --git a/Zend/zend_inheritance.h b/Zend/zend_inheritance.h index 1ecd6017f150..76ab5e0476e8 100644 --- a/Zend/zend_inheritance.h +++ b/Zend/zend_inheritance.h @@ -20,7 +20,15 @@ #ifndef ZEND_INHERITANCE_H #define ZEND_INHERITANCE_H -#include "zend.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C + +#include + +typedef struct _zend_class_entry zend_class_entry; +typedef union _zend_function zend_function; +typedef struct _zend_string zend_string; +typedef struct _zval_struct zval; +typedef struct _zend_array HashTable; BEGIN_EXTERN_C() diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 35f30eca2a86..53dfc196ed80 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -16,16 +16,15 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_sort.h" -#include "zend_API.h" #include "zend_ini.h" -#include "zend_alloc.h" -#include "zend_operators.h" -#include "zend_strtod.h" +#include "zend.h" // for zend_try +#include "zend_globals.h" #include "zend_modules.h" #include "zend_smart_str.h" +#include "zend_strtod.h" + #include +#include static HashTable *registered_zend_ini_directives; diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h index deb61dae370a..be5777dc90d9 100644 --- a/Zend/zend_ini.h +++ b/Zend/zend_ini.h @@ -19,14 +19,27 @@ #ifndef ZEND_INI_H #define ZEND_INI_H +#include "zend_long.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C #include "zend_result.h" +#include +#include + #define ZEND_INI_USER (1<<0) #define ZEND_INI_PERDIR (1<<1) #define ZEND_INI_SYSTEM (1<<2) #define ZEND_INI_ALL (ZEND_INI_USER|ZEND_INI_PERDIR|ZEND_INI_SYSTEM) +// forward declarations +typedef struct _zend_file_handle zend_file_handle; +typedef struct _zend_ini_entry zend_ini_entry; +typedef struct _zend_module_entry zend_module_entry; +typedef struct _zend_string zend_string; +typedef struct _zend_array HashTable; +typedef struct _zval_struct zval; + #define ZEND_INI_MH(name) int name(zend_ini_entry *entry, zend_string *new_value, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage) #define ZEND_INI_DISP(name) ZEND_COLD void name(zend_ini_entry *ini_entry, int type) diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index 6e6ffc7bbb78..5fcfa4121305 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -24,6 +24,7 @@ #include "zend.h" #include "zend_API.h" #include "zend_globals.h" +#include "zend_stream.h" // for ZEND_MMAP_AHEAD #include #include "zend_ini_scanner.h" diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index d05310b737b0..0353a26d781a 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -16,11 +16,12 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_API.h" #include "zend_interfaces.h" +#include "zend_API.h" +#include "zend_arena.h" #include "zend_exceptions.h" #include "zend_interfaces_arginfo.h" +#include "zend_objects.h" // for zend_object_std_init() ZEND_API zend_class_entry *zend_ce_traversable; ZEND_API zend_class_entry *zend_ce_aggregate; diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h index 883e482f510c..e8291213d7fb 100644 --- a/Zend/zend_interfaces.h +++ b/Zend/zend_interfaces.h @@ -19,8 +19,12 @@ #ifndef ZEND_INTERFACES_H #define ZEND_INTERFACES_H -#include "zend.h" -#include "zend_API.h" +#include "zend_iterators.h" // for zend_object_iterator +#include "zend_portability.h" // for BEGIN_EXTERN_C + +typedef struct _zend_class_entry zend_class_entry; +typedef struct _zend_serialize_data zend_serialize_data; +typedef struct _zend_unserialize_data zend_unserialize_data; BEGIN_EXTERN_C() diff --git a/Zend/zend_iterators.c b/Zend/zend_iterators.c index f67033b11161..fd5a0895b2a0 100644 --- a/Zend/zend_iterators.c +++ b/Zend/zend_iterators.c @@ -17,8 +17,10 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_API.h" +#include "zend_iterators.h" +#include "zend_objects.h" +#include "zend_object_handlers.h" +#include "zend_API.h" // for INIT_CLASS_ENTRY static zend_class_entry zend_iterator_class_entry; diff --git a/Zend/zend_iterators.h b/Zend/zend_iterators.h index 5e7451f7eacc..98337961948f 100644 --- a/Zend/zend_iterators.h +++ b/Zend/zend_iterators.h @@ -17,6 +17,11 @@ +----------------------------------------------------------------------+ */ +#ifndef ZEND_ITERATORS_H +#define ZEND_ITERATORS_H + +#include "zend_types.h" // for zval + /* These iterators were designed to operate within the foreach() * structures provided by the engine, but could be extended for use * with other iterative engine opcodes. @@ -89,3 +94,5 @@ ZEND_API void zend_iterator_dtor(zend_object_iterator *iter); ZEND_API void zend_register_iterator_wrapper(void); END_EXTERN_C() + +#endif /* ZEND_ITERATORS_H */ diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h index ca32329a557f..c93b0fea56ed 100644 --- a/Zend/zend_language_scanner.h +++ b/Zend/zend_language_scanner.h @@ -20,6 +20,14 @@ #ifndef ZEND_SCANNER_H #define ZEND_SCANNER_H +#include "zend_globals.h" // for zend_php_scanner_event +#include "zend_multibyte.h" // for zend_encoding_filter +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_ptr_stack.h" +#include "zend_stack.h" + +typedef struct _zend_file_handle zend_file_handle; + typedef struct _zend_lex_state { unsigned int yy_leng; unsigned char *yy_start; diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 7abd91b23a58..02d45520197b 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -27,6 +27,7 @@ # define YYDEBUG(s, c) #endif +#include "zend_language_scanner.h" #include "zend_language_scanner_defs.h" #include @@ -35,9 +36,9 @@ # include #endif #include "zend_alloc.h" +#include "zend_arena.h" #include #include "zend_compile.h" -#include "zend_language_scanner.h" #include "zend_highlight.h" #include "zend_constants.h" #include "zend_variables.h" diff --git a/Zend/zend_list.c b/Zend/zend_list.c index 51ef3e1d92eb..6b2742c6808d 100644 --- a/Zend/zend_list.c +++ b/Zend/zend_list.c @@ -19,10 +19,12 @@ /* resource lists */ -#include "zend.h" #include "zend_list.h" -#include "zend_API.h" -#include "zend_globals.h" +#include "zend_execute.h" // for get_active_class_name() +#include "zend_globals.h" // for struct _zend_executor_globals +#include "zend_globals_macros.h" // for EG() +#include "zend_hash.h" +#include "zend_types.h" // for zval ZEND_API int le_index_ptr; diff --git a/Zend/zend_list.h b/Zend/zend_list.h index 680915121e2a..643abe65023c 100644 --- a/Zend/zend_list.h +++ b/Zend/zend_list.h @@ -20,8 +20,12 @@ #ifndef ZEND_LIST_H #define ZEND_LIST_H -#include "zend_hash.h" -#include "zend_globals.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C + +typedef struct _zend_array HashTable; +typedef struct _zend_resource zend_resource; +typedef struct _zend_string zend_string; +typedef struct _zval_struct zval; BEGIN_EXTERN_C() diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c index 8c42b2494ea0..cdc018ae6278 100644 --- a/Zend/zend_llist.c +++ b/Zend/zend_llist.c @@ -17,8 +17,8 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" #include "zend_llist.h" +#include "zend_alloc.h" //for pemalloc() #include "zend_sort.h" ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor, unsigned char persistent) diff --git a/Zend/zend_llist.h b/Zend/zend_llist.h index cce5ad5ce95a..bf8411fc34d7 100644 --- a/Zend/zend_llist.h +++ b/Zend/zend_llist.h @@ -20,6 +20,10 @@ #ifndef ZEND_LLIST_H #define ZEND_LLIST_H +#include "zend_portability.h" // for BEGIN_EXTERN_C + +#include + typedef struct _zend_llist_element { struct _zend_llist_element *next; struct _zend_llist_element *prev; diff --git a/Zend/zend_long.h b/Zend/zend_long.h index 3796f1c5abab..a85481946c49 100644 --- a/Zend/zend_long.h +++ b/Zend/zend_long.h @@ -19,6 +19,12 @@ #ifndef ZEND_LONG_H #define ZEND_LONG_H +#ifdef PHP_WIN32 +#include "config.w32.h" +#else +#include "zend_config.h" +#endif + #include #include diff --git a/Zend/zend_map_ptr.h b/Zend/zend_map_ptr.h index aa726e0cdd32..0ab1a357eecf 100644 --- a/Zend/zend_map_ptr.h +++ b/Zend/zend_map_ptr.h @@ -19,7 +19,7 @@ #ifndef ZEND_MAP_PTR_H #define ZEND_MAP_PTR_H -#include "zend_portability.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C #define ZEND_MAP_PTR_KIND_PTR 0 #define ZEND_MAP_PTR_KIND_PTR_OR_OFFSET 1 @@ -69,6 +69,8 @@ # error "Unknown ZEND_MAP_PTR_KIND" #endif +typedef struct _zend_string zend_string; + BEGIN_EXTERN_C() ZEND_API void zend_map_ptr_reset(void); diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index e32fab935bfb..07a452265529 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -20,9 +20,8 @@ #ifndef MODULES_H #define MODULES_H -#include "zend.h" -#include "zend_compile.h" -#include "zend_build.h" +#include "zend_build.h" // for ZEND_TOSTR() +#include "zend_portability.h" // for BEGIN_EXTERN_C #include "zend_result.h" #define INIT_FUNC_ARGS int type, int module_number diff --git a/Zend/zend_multibyte.c b/Zend/zend_multibyte.c index f8dab668751a..fc07a2be6af5 100644 --- a/Zend/zend_multibyte.c +++ b/Zend/zend_multibyte.c @@ -17,10 +17,10 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_compile.h" -#include "zend_operators.h" #include "zend_multibyte.h" +#include "zend_alloc.h" +#include "zend_globals.h" // for struct _zend_compiler_globals +#include "zend_globals_macros.h" // for LANG_SCNG() #include "zend_ini.h" static const zend_encoding *dummy_encoding_fetcher(const char *encoding_name) diff --git a/Zend/zend_multibyte.h b/Zend/zend_multibyte.h index 521780129ba1..f91bee905f38 100644 --- a/Zend/zend_multibyte.h +++ b/Zend/zend_multibyte.h @@ -20,8 +20,12 @@ #ifndef ZEND_MULTIBYTE_H #define ZEND_MULTIBYTE_H +#include "zend_portability.h" // for BEGIN_EXTERN_C #include "zend_result.h" +#include +#include // for size_t + typedef struct _zend_encoding zend_encoding; typedef size_t (*zend_encoding_filter)(unsigned char **str, size_t *str_length, const unsigned char *buf, size_t length); diff --git a/Zend/zend_multiply.h b/Zend/zend_multiply.h index a99e858bd779..f09a356d2bcf 100644 --- a/Zend/zend_multiply.h +++ b/Zend/zend_multiply.h @@ -17,11 +17,15 @@ +----------------------------------------------------------------------+ */ -#include "zend_portability.h" - #ifndef ZEND_MULTIPLY_H #define ZEND_MULTIPLY_H +#include "zend_error.h" +#include "zend_long.h" +#include "zend_portability.h" + +#include + #if PHP_HAVE_BUILTIN_SMULL_OVERFLOW && SIZEOF_LONG == SIZEOF_ZEND_LONG #define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \ diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index a0ac789e9540..5d96e1bd0b78 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -18,13 +18,13 @@ +----------------------------------------------------------------------+ */ +#include "zend_object_handlers.h" #include "zend.h" #include "zend_globals.h" #include "zend_variables.h" #include "zend_API.h" #include "zend_objects.h" #include "zend_objects_API.h" -#include "zend_object_handlers.h" #include "zend_interfaces.h" #include "zend_exceptions.h" #include "zend_closures.h" diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index 475ba6263825..9c7d65edcfc4 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -20,6 +20,8 @@ #ifndef ZEND_OBJECT_HANDLERS_H #define ZEND_OBJECT_HANDLERS_H +#include "zend_types.h" + #include struct _zend_property_info; diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index df76fa0bb8dc..f82f577df512 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -18,13 +18,14 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_globals.h" -#include "zend_variables.h" -#include "zend_API.h" -#include "zend_interfaces.h" -#include "zend_exceptions.h" -#include "zend_weakrefs.h" +#include "zend_objects.h" +#include "zend_objects_API.h" +#include "zend_exceptions.h" // for zend_rethrow_exception() +#include "zend_execute.h" // for ZEND_REF_HAS_TYPE_SOURCES +#include "zend_types.h" // for GC_SET_REFCOUNT() +#include "zend_weakrefs.h" // for zend_weakrefs_notify() +#include "zend.h" // for struct _zend_class_entry +#include "zend_API.h" // for zend_call_known_instance_method_with_0_params() static zend_always_inline void _zend_object_std_init(zend_object *object, zend_class_entry *ce) { diff --git a/Zend/zend_objects.h b/Zend/zend_objects.h index 91d388154dd1..c998e9c60a29 100644 --- a/Zend/zend_objects.h +++ b/Zend/zend_objects.h @@ -20,7 +20,10 @@ #ifndef ZEND_OBJECTS_H #define ZEND_OBJECTS_H -#include "zend.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C + +typedef struct _zend_class_entry zend_class_entry; +typedef struct _zend_object zend_object; BEGIN_EXTERN_C() ZEND_API void ZEND_FASTCALL zend_object_std_init(zend_object *object, zend_class_entry *ce); diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c index 80f5b747db71..140219c07779 100644 --- a/Zend/zend_objects_API.c +++ b/Zend/zend_objects_API.c @@ -18,11 +18,12 @@ +----------------------------------------------------------------------+ */ +#include "zend_objects_API.h" +#include "zend_objects.h" // for zend_objects_destroy_object() #include "zend.h" #include "zend_globals.h" #include "zend_variables.h" #include "zend_API.h" -#include "zend_objects_API.h" #include "zend_fibers.h" ZEND_API void ZEND_FASTCALL zend_objects_store_init(zend_objects_store *objects, uint32_t init_size) diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h index 422bf6a53e2f..c17678dc9e56 100644 --- a/Zend/zend_objects_API.h +++ b/Zend/zend_objects_API.h @@ -20,8 +20,16 @@ #ifndef ZEND_OBJECTS_API_H #define ZEND_OBJECTS_API_H -#include "zend.h" -#include "zend_compile.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_gc.h" // for GC_MAY_LEAK +#include "zend_compile.h" // for ZEND_ACC_USE_GUARDS +#include "zend.h" // for _zend_class_entry + +#include +#include +#include // for memset() + +typedef struct _zend_object zend_object; #define OBJ_BUCKET_INVALID (1<<0) diff --git a/Zend/zend_observer.c b/Zend/zend_observer.c index 79929bfdd80e..7ff183f0efac 100644 --- a/Zend/zend_observer.c +++ b/Zend/zend_observer.c @@ -18,10 +18,10 @@ */ #include "zend_observer.h" - -#include "zend_extensions.h" +#include "zend_fibers.h" +#include "zend_extensions.h" // for zend_get_op_array_extension_handles() #include "zend_llist.h" -#include "zend_vm.h" +#include "zend_vm.h" // for ZEND_VM_SET_OPCODE_HANDLER() #define ZEND_OBSERVER_DATA(function) \ ZEND_OP_ARRAY_EXTENSION((&(function)->common), zend_observer_fcall_op_array_extension) diff --git a/Zend/zend_observer.h b/Zend/zend_observer.h index fc4d9a62c890..2a4576234675 100644 --- a/Zend/zend_observer.h +++ b/Zend/zend_observer.h @@ -20,9 +20,18 @@ #ifndef ZEND_OBSERVER_H #define ZEND_OBSERVER_H -#include "zend.h" -#include "zend_compile.h" -#include "zend_fibers.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C + +#include +#include + +typedef struct _zend_class_entry zend_class_entry; +typedef struct _zend_execute_data zend_execute_data; +typedef struct _zend_fiber_context zend_fiber_context; +typedef union _zend_function zend_function; +typedef struct _zend_op_array zend_op_array; +typedef struct _zend_string zend_string; +typedef struct _zval_struct zval; BEGIN_EXTERN_C() diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 5db656b46c26..d6bb44c3154a 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -18,18 +18,13 @@ +----------------------------------------------------------------------+ */ -#include - -#include "zend.h" -#include "zend_alloc.h" #include "zend_compile.h" -#include "zend_extensions.h" #include "zend_API.h" -#include "zend_sort.h" #include "zend_constants.h" +#include "zend_extensions.h" +#include "zend_llist.h" #include "zend_observer.h" - -#include "zend_vm.h" +#include "zend_vm.h" // for ZEND_VM_SET_OPCODE_HANDLER() static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array) { diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 1abed4001272..c0197d1fc5fc 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -18,18 +18,20 @@ +----------------------------------------------------------------------+ */ -#include - -#include "zend.h" #include "zend_operators.h" +#include "zend.h" #include "zend_variables.h" +#include "zend_objects.h" // for zend_objects_new() #include "zend_globals.h" +#include "zend_multiply.h" // for ZEND_SIGNED_MULTIPLY_LONG() #include "zend_list.h" #include "zend_API.h" #include "zend_strtod.h" #include "zend_exceptions.h" #include "zend_closures.h" +#include + #include #ifdef HAVE_LANGINFO_H # include diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index acb7fb0c0a03..7615b9bb5568 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -21,11 +21,13 @@ #ifndef ZEND_OPERATORS_H #define ZEND_OPERATORS_H +#include "zend_hash.h" // for zend_hash_num_elements() +#include "zend_object_handlers.h" // for struct _zend_object_handlers +#include "zend_portability.h" // for BEGIN_EXTERN_ #include "zend_result.h" +#include "zend_string.h" // for zend_string_copy() -#include #include -#include #include #include @@ -33,11 +35,6 @@ #include #endif -#include "zend_portability.h" -#include "zend_strtod.h" -#include "zend_multiply.h" -#include "zend_object_handlers.h" - #define LONG_SIGN_MASK ZEND_LONG_MIN BEGIN_EXTERN_C() diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index 8f9b7fd4a9e3..83b751b7a7ab 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -21,6 +21,12 @@ #ifndef ZEND_PORTABILITY_H #define ZEND_PORTABILITY_H +#ifdef PHP_WIN32 +#include "config.w32.h" +#else +#include "zend_config.h" +#endif + #ifdef __cplusplus #define BEGIN_EXTERN_C() extern "C" { #define END_EXTERN_C() } @@ -44,17 +50,12 @@ # define ZEND_PATHS_SEPARATOR ':' #endif -#include "../TSRM/TSRM.h" - -#include #include -#include #ifdef HAVE_UNIX_H # include #endif -#include #include #ifdef HAVE_DLFCN_H @@ -67,8 +68,6 @@ #include #endif -#include "zend_range_check.h" - /* GCC x.y.z supplies __GNUC__ = x and __GNUC_MINOR__ = y */ #ifdef __GNUC__ # define ZEND_GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) diff --git a/Zend/zend_ptr_stack.c b/Zend/zend_ptr_stack.c index 80c77e11d73e..acecae477e3a 100644 --- a/Zend/zend_ptr_stack.c +++ b/Zend/zend_ptr_stack.c @@ -17,8 +17,8 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" #include "zend_ptr_stack.h" + #include ZEND_API void zend_ptr_stack_init_ex(zend_ptr_stack *stack, bool persistent) diff --git a/Zend/zend_ptr_stack.h b/Zend/zend_ptr_stack.h index 1126da5800d1..b1dc6c29af3a 100644 --- a/Zend/zend_ptr_stack.h +++ b/Zend/zend_ptr_stack.h @@ -20,6 +20,9 @@ #ifndef ZEND_PTR_STACK_H #define ZEND_PTR_STACK_H +#include "zend_alloc.h" // for safe_perealloc() +#include "zend_portability.h" // for BEGIN_EXTERN_C + typedef struct _zend_ptr_stack { int top, max; void **elements; diff --git a/Zend/zend_signal.c b/Zend/zend_signal.c index e68ddcf02914..60794f3bdf1e 100644 --- a/Zend/zend_signal.c +++ b/Zend/zend_signal.c @@ -28,11 +28,14 @@ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif -#include -#include "zend.h" -#include "zend_globals.h" +#include "zend_signal.h" +#include "zend_alloc.h" +#include "zend.h" // for zend_output_debug_string(), zend_error(), ... + +#include #include +#include #ifdef HAVE_UNISTD_H #include diff --git a/Zend/zend_signal.h b/Zend/zend_signal.h index 93edc1f0e021..53ef58fa53f9 100644 --- a/Zend/zend_signal.h +++ b/Zend/zend_signal.h @@ -21,9 +21,18 @@ #ifndef ZEND_SIGNAL_H #define ZEND_SIGNAL_H +#ifdef PHP_WIN32 +#include "config.w32.h" +#else +#include "php_config.h" // for ZEND_SIGNALS +#endif + #ifdef ZEND_SIGNALS +#include "zend_portability.h" // for BEGIN_EXTERN_C + #include +#include #ifndef NSIG #define NSIG 65 diff --git a/Zend/zend_smart_str.c b/Zend/zend_smart_str.c index 5132043c60e2..689989059c2d 100644 --- a/Zend/zend_smart_str.c +++ b/Zend/zend_smart_str.c @@ -14,9 +14,11 @@ +----------------------------------------------------------------------+ */ -#include #include "zend_smart_str.h" #include "zend_smart_string.h" +#include "zend_globals_macros.h" // for EG() +#include "zend_globals.h" // struct _zend_executor_globals +#include "zend_strtod.h" // for zend_gcvt() #define SMART_STR_OVERHEAD (ZEND_MM_OVERHEAD + _ZSTR_HEADER_SIZE + 1) #define SMART_STR_START_SIZE 256 diff --git a/Zend/zend_smart_str.h b/Zend/zend_smart_str.h index e271835e41db..ac5b18db97e2 100644 --- a/Zend/zend_smart_str.h +++ b/Zend/zend_smart_str.h @@ -17,10 +17,15 @@ #ifndef ZEND_SMART_STR_H #define ZEND_SMART_STR_H -#include -#include "zend_globals.h" #include "zend_smart_str_public.h" +#include "zend_operators.h" // for zend_print_long_to_buf() +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_string.h" + +// forward declarations +typedef struct _zval_struct zval; + BEGIN_EXTERN_C() ZEND_API void ZEND_FASTCALL smart_str_erealloc(smart_str *str, size_t len); diff --git a/Zend/zend_smart_str_public.h b/Zend/zend_smart_str_public.h index e81a6839b3bb..84fc3758ae7c 100644 --- a/Zend/zend_smart_str_public.h +++ b/Zend/zend_smart_str_public.h @@ -17,6 +17,11 @@ #ifndef ZEND_SMART_STR_PUBLIC_H #define ZEND_SMART_STR_PUBLIC_H +#include // for size_t + +// forward declarations +typedef struct _zend_string zend_string; + typedef struct { /** See smart_str_extract() */ zend_string *s; diff --git a/Zend/zend_smart_string.h b/Zend/zend_smart_string.h index 8149b29fb333..08eb6a8eced7 100644 --- a/Zend/zend_smart_string.h +++ b/Zend/zend_smart_string.h @@ -20,8 +20,9 @@ #include "zend_smart_string_public.h" -#include -#include +#include "zend_alloc.h" // for pefree() +#include "zend_operators.h" // for zend_print_long_to_buf() +#include "zend_portability.h" // for ZEND_FASTCALL /* wrapper */ diff --git a/Zend/zend_smart_string_public.h b/Zend/zend_smart_string_public.h index 543e1d37a4ef..e61bdd2d36f4 100644 --- a/Zend/zend_smart_string_public.h +++ b/Zend/zend_smart_string_public.h @@ -18,7 +18,7 @@ #ifndef PHP_SMART_STRING_PUBLIC_H #define PHP_SMART_STRING_PUBLIC_H -#include +#include // for size_t typedef struct { char *c; diff --git a/Zend/zend_sort.c b/Zend/zend_sort.c index 355d2d1bad58..f43d5cae63f5 100644 --- a/Zend/zend_sort.c +++ b/Zend/zend_sort.c @@ -17,9 +17,7 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" #include "zend_sort.h" -#include static inline void zend_sort_2(void *a, void *b, compare_func_t cmp, swap_func_t swp) /* {{{ */ { if (cmp(a, b) > 0) { diff --git a/Zend/zend_sort.h b/Zend/zend_sort.h index e606935f7902..320b5e56066a 100644 --- a/Zend/zend_sort.h +++ b/Zend/zend_sort.h @@ -20,6 +20,9 @@ #ifndef ZEND_SORT_H #define ZEND_SORT_H +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_types.h" // for compare_func_t, swap_func_t + BEGIN_EXTERN_C() ZEND_API void zend_sort(void *base, size_t nmemb, size_t siz, compare_func_t cmp, swap_func_t swp); ZEND_API void zend_insert_sort(void *base, size_t nmemb, size_t siz, compare_func_t cmp, swap_func_t swp); diff --git a/Zend/zend_stack.c b/Zend/zend_stack.c index 5d9cc166367e..baaaa5c96232 100644 --- a/Zend/zend_stack.c +++ b/Zend/zend_stack.c @@ -17,8 +17,8 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" #include "zend_stack.h" +#include "zend_alloc.h" #define ZEND_STACK_ELEMENT(stack, n) ((void *)((char *) (stack)->elements + (stack)->size * (n))) diff --git a/Zend/zend_stack.h b/Zend/zend_stack.h index 68c3621533f9..b5a47d45ef38 100644 --- a/Zend/zend_stack.h +++ b/Zend/zend_stack.h @@ -20,6 +20,10 @@ #ifndef ZEND_STACK_H #define ZEND_STACK_H +#include "zend_portability.h" // for BEGIN_EXTERN_C + +#include + typedef struct _zend_stack { int size, top, max; void *elements; diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c index 8e11841ad265..41b89d1d86b5 100644 --- a/Zend/zend_stream.c +++ b/Zend/zend_stream.c @@ -19,9 +19,11 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_compile.h" #include "zend_stream.h" +#include "zend_globals.h" // struct _zend_compiler_globals +#include "zend_globals_macros.h" // for CG() +#include "zend_string.h" +#include "zend.h" // for zend_stream_open_function ZEND_DLIMPORT int isatty(int fd); diff --git a/Zend/zend_stream.h b/Zend/zend_stream.h index 1c6ee0a55626..7928578d2ff2 100644 --- a/Zend/zend_stream.h +++ b/Zend/zend_stream.h @@ -22,11 +22,17 @@ #ifndef ZEND_STREAM_H #define ZEND_STREAM_H +#include "zend_portability.h" // for BEGIN_EXTERN_C #include "zend_result.h" -#include +#include +#include +#include // for FILE +#include // for ssize_t #include +typedef struct _zend_string zend_string; + /* Lightweight stream implementation for the ZE scanners. * These functions are private to the engine. * */ diff --git a/Zend/zend_string.c b/Zend/zend_string.c index a0f379556d05..8665ec5babe9 100644 --- a/Zend/zend_string.c +++ b/Zend/zend_string.c @@ -17,8 +17,8 @@ */ #include "zend_string.h" -#include "zend.h" #include "zend_globals.h" +#include "zend_hash.h" #include "zend_rc_debug.h" #ifdef HAVE_VALGRIND diff --git a/Zend/zend_string.h b/Zend/zend_string.h index cc4f0751bec6..40c555783bf0 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -21,6 +21,7 @@ #include "zend_alloc.h" #include "zend_char.h" +#include "zend_long.h" #include "zend_portability.h" #include "zend_refcounted.h" diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c index 8a5919628508..85e8eb44cb3f 100644 --- a/Zend/zend_strtod.c +++ b/Zend/zend_strtod.c @@ -186,9 +186,10 @@ * used for input more than STRTOD_DIGLIM digits long (default 40). */ -#include -#include +#include "zend_strtod.h" #include "zend_strtod_int.h" +#include "zend_types.h" // for ZEND_TLS +#include "zend_error.h" #ifndef Long #define Long int32_t @@ -203,11 +204,11 @@ static void Bug(const char *message) { } #endif -#include "stdlib.h" -#include "string.h" +#include +#include #ifdef USE_LOCALE -#include "locale.h" +#include #endif #ifdef Honor_FLT_ROUNDS @@ -253,7 +254,9 @@ static double private_mem[PRIVATE_mem], *pmem_next = private_mem; #define NO_STRTOD_BIGCOMP #endif +#ifndef NO_ERRNO #include "errno.h" +#endif #ifdef Bad_float_h diff --git a/Zend/zend_strtod.h b/Zend/zend_strtod.h index b049e56e370c..aa289f9db7df 100644 --- a/Zend/zend_strtod.h +++ b/Zend/zend_strtod.h @@ -20,7 +20,10 @@ * can be found in zend_strtod.c */ #ifndef ZEND_STRTOD_H #define ZEND_STRTOD_H -#include + +#include "zend_portability.h" // for BEGIN_EXTERN_C + +#include BEGIN_EXTERN_C() ZEND_API void zend_freedtoa(char *s); diff --git a/Zend/zend_system_id.c b/Zend/zend_system_id.c index 27adf3fe1a4a..9179732f5297 100644 --- a/Zend/zend_system_id.c +++ b/Zend/zend_system_id.c @@ -15,11 +15,10 @@ +----------------------------------------------------------------------+ */ -#include "php.h" #include "zend_system_id.h" -#include "zend_extensions.h" +#include "zend_extensions.h" // for ZEND_EXTENSION_BUILD_ID #include "ext/standard/md5.h" -#include "ext/hash/php_hash.h" +#include "ext/hash/php_hash.h" // for php_hash_bin2hex() ZEND_API char zend_system_id[32]; diff --git a/Zend/zend_system_id.h b/Zend/zend_system_id.h index 3089d0f6eabe..4e50ffb878f4 100644 --- a/Zend/zend_system_id.h +++ b/Zend/zend_system_id.h @@ -17,8 +17,11 @@ #ifndef ZEND_SYSTEM_ID_H #define ZEND_SYSTEM_ID_H +#include "zend_portability.h" // for BEGIN_EXTERN_C #include "zend_result.h" +#include + BEGIN_EXTERN_C() /* True global; Write-only during MINIT/startup */ extern ZEND_API char zend_system_id[32]; diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 3d900226e54e..cb611b644c6c 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -28,6 +28,7 @@ #include "zend_refcounted.h" #include "zend_result.h" #include "zend_type_code.h" +#include "zend_type_info.h" #include #include diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index 27e09d7db22b..9b93da3873f5 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -18,13 +18,12 @@ +----------------------------------------------------------------------+ */ -#include -#include "zend.h" -#include "zend_API.h" +#include "zend_variables.h" +#include "zend_API.h" // for CHECK_ZVAL_STRING() #include "zend_ast.h" -#include "zend_globals.h" -#include "zend_constants.h" +#include "zend_execute.h" // for ZEND_REF_HAS_TYPE_SOURCES() #include "zend_list.h" +#include "zend_objects_API.h" #if ZEND_DEBUG static void ZEND_FASTCALL zend_string_destroy(zend_string *str); diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h index ea3fd9c5efcb..35bc0c9725f4 100644 --- a/Zend/zend_variables.h +++ b/Zend/zend_variables.h @@ -21,7 +21,8 @@ #ifndef ZEND_VARIABLES_H #define ZEND_VARIABLES_H -#include "zend_types.h" +#include "zend_hash.h" // for zend_array_dup() +#include "zend_portability.h" // for BEGIN_EXTERN_C #include "zend_gc.h" BEGIN_EXTERN_C() diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index 64fc16517405..f527c047996a 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -16,19 +16,16 @@ +----------------------------------------------------------------------+ */ -#include -#include -#include -#include -#include +#include "zend_virtual_cwd.h" +#include "zend_alloc.h" // for emalloc() + +#include // for va_list +#include // for memcpy() #include #include #include #include -#include "zend.h" -#include "zend_virtual_cwd.h" - #ifdef ZEND_WIN32 #include #include "tsrm_win32.h" @@ -75,8 +72,6 @@ #define VIRTUAL_CWD_DEBUG 0 -#include "TSRM.h" - /* Only need mutex for popen() in Windows because it doesn't chdir() on UNIX */ #if defined(ZEND_WIN32) && defined(ZTS) MUTEX_T cwd_mutex; diff --git a/Zend/zend_virtual_cwd.h b/Zend/zend_virtual_cwd.h index 728e3ba69d88..3ebbb30b031b 100644 --- a/Zend/zend_virtual_cwd.h +++ b/Zend/zend_virtual_cwd.h @@ -19,21 +19,27 @@ #ifndef VIRTUAL_CWD_H #define VIRTUAL_CWD_H +#include "zend_long.h" +#include "zend_stream.h" // for zend_stat_t #include "TSRM.h" -#include -#include -#include +#ifdef ZTS +#include "zend.h" // for ZEND_TSRMG_FAST +#endif + +#include // for size_t +#include // for FILE +#include +#include // for mode_t #ifdef HAVE_UTIME_H #include #endif -#include #include #if HAVE_SYS_PARAM_H -# include +# include // for MAXPATHLEN #endif #ifndef MAXPATHLEN @@ -54,19 +60,19 @@ #endif #ifndef ZEND_WIN32 -#include -#else -#include -#endif - -#if defined(__osf__) || defined(_AIX) -#include +# include // for open() +# include // for fopen() +# include // for mkdir() +# include // for access(), getcwd(), ... #endif #ifdef ZEND_WIN32 #include "win32/readdir.h" -#include #include "win32/ioutil.h" + +#include +#include + /* mode_t isn't defined on Windows */ typedef unsigned short mode_t; @@ -86,7 +92,7 @@ typedef unsigned short mode_t; #else #ifdef HAVE_DIRENT_H -#include +#include // for DIR #endif #define DEFAULT_SLASH '/' diff --git a/Zend/zend_weakrefs.c b/Zend/zend_weakrefs.c index db95b13a7254..19cbe6fa37ef 100644 --- a/Zend/zend_weakrefs.c +++ b/Zend/zend_weakrefs.c @@ -14,11 +14,11 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "zend_interfaces.h" -#include "zend_objects_API.h" #include "zend_weakrefs.h" +#include "zend_API.h" // for ZEND_BEGIN_ARG_INFO_EX +#include "zend_objects.h" // for zend_object_std_init() #include "zend_weakrefs_arginfo.h" +#include "zend_interfaces.h" // for zend_create_internal_iterator_zval() typedef struct _zend_weakref { zend_object *referent; diff --git a/Zend/zend_weakrefs.h b/Zend/zend_weakrefs.h index 506e2e9d40c5..6e3f108646c3 100644 --- a/Zend/zend_weakrefs.h +++ b/Zend/zend_weakrefs.h @@ -17,7 +17,8 @@ #ifndef ZEND_WEAKREFS_H #define ZEND_WEAKREFS_H -#include "zend_alloc.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_types.h" // for zval BEGIN_EXTERN_C() diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index e42f30002093..93f39b3338ac 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -19,6 +19,7 @@ #endif #include "php.h" +#include "php_globals.h" #include "php_ini.h" #include "ext/standard/info.h" #include "php_com_dotnet.h" diff --git a/ext/com_dotnet/com_iterator.c b/ext/com_dotnet/com_iterator.c index 0bf4789b0ce4..f1a70043a484 100644 --- a/ext/com_dotnet/com_iterator.c +++ b/ext/com_dotnet/com_iterator.c @@ -24,6 +24,7 @@ #include "php_com_dotnet.h" #include "php_com_dotnet_internal.h" #include "Zend/zend_exceptions.h" +#include "Zend/zend_iterators.h" struct php_com_iterator { zend_object_iterator iter; diff --git a/ext/com_dotnet/com_saproxy.c b/ext/com_dotnet/com_saproxy.c index c99a622070ec..6c9199b59914 100644 --- a/ext/com_dotnet/com_saproxy.c +++ b/ext/com_dotnet/com_saproxy.c @@ -31,6 +31,7 @@ #include "php_com_dotnet.h" #include "php_com_dotnet_internal.h" #include "Zend/zend_exceptions.h" +#include "Zend/zend_iterators.h" typedef struct { zend_object std; diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 859bc8a1a097..e97ed90a8d47 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -21,6 +21,8 @@ #endif #include "php.h" +#include "php_globals.h" // for PG() +#include "php_ini.h" #include "Zend/zend_exceptions.h" #include diff --git a/ext/dl_test/dl_test.c b/ext/dl_test/dl_test.c index 9cfbdf686a3a..aab14021bac7 100644 --- a/ext/dl_test/dl_test.c +++ b/ext/dl_test/dl_test.c @@ -19,6 +19,7 @@ #endif #include "php.h" +#include "php_ini.h" #include "ext/standard/info.h" #include "php_dl_test.h" #include "dl_test_arginfo.h" diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h index fdfdd4e7a31c..ebd364deb43b 100644 --- a/ext/dom/php_dom.h +++ b/ext/dom/php_dom.h @@ -54,6 +54,7 @@ extern zend_module_entry dom_module_entry; #include "xml_common.h" #include "ext/libxml/php_libxml.h" #include "zend_exceptions.h" +#include "zend_iterators.h" // for zend_object_iterator #include "dom_ce.h" /* DOM API_VERSION, please bump it up, if you change anything in the API therefore it's easier for the script-programmers to check, what's working how diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c index e82b81fe3bdb..afea1eb67466 100644 --- a/ext/ffi/ffi.c +++ b/ext/ffi/ffi.c @@ -24,6 +24,7 @@ #include "php_scandir.h" #include "zend_exceptions.h" #include "zend_closures.h" +#include "zend_iterators.h" #include "main/SAPI.h" #include diff --git a/ext/filter/filter.c b/ext/filter/filter.c index e6a6b2dc83e0..d1c38f3d7030 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -22,6 +22,7 @@ #endif #include "php_filter.h" +#include "php_globals.h" // for PG() ZEND_DECLARE_MODULE_GLOBALS(filter) diff --git a/ext/intl/collator/collator_is_numeric.c b/ext/intl/collator/collator_is_numeric.c index cf18c8a67222..8039dc5954a9 100644 --- a/ext/intl/collator/collator_is_numeric.c +++ b/ext/intl/collator/collator_is_numeric.c @@ -14,6 +14,9 @@ */ #include "collator_is_numeric.h" +#include "zend_strtod.h" + +#include /* {{{ Taken from PHP6:zend_u_strtod() */ static double collator_u_strtod(const UChar *nptr, UChar **endptr) /* {{{ */ diff --git a/ext/intl/common/common_enum.h b/ext/intl/common/common_enum.h index ebe5cbfbfa3b..05197cfeb388 100644 --- a/ext/intl/common/common_enum.h +++ b/ext/intl/common/common_enum.h @@ -23,6 +23,7 @@ extern "C" { #include #endif #include +#include "zend_iterators.h" // for zend_object_iterator #include "../intl_error.h" #include "../intl_data.h" #ifdef __cplusplus diff --git a/ext/intl/resourcebundle/resourcebundle_iterator.h b/ext/intl/resourcebundle/resourcebundle_iterator.h index 1ad948723160..c43fd2a2d816 100644 --- a/ext/intl/resourcebundle/resourcebundle_iterator.h +++ b/ext/intl/resourcebundle/resourcebundle_iterator.h @@ -16,6 +16,7 @@ #define RESOURCEBUNDLE_ITERATOR_H #include +#include "zend_iterators.h" // for zend_object_iterator #include "resourcebundle/resourcebundle_class.h" diff --git a/ext/json/json_encoder.c b/ext/json/json_encoder.c index adb53598326b..f5e4174d6024 100644 --- a/ext/json/json_encoder.c +++ b/ext/json/json_encoder.c @@ -20,6 +20,7 @@ #endif #include "php.h" +#include "php_globals.h" // for PG() #include "php_ini.h" #include "ext/standard/info.h" #include "ext/standard/html.h" @@ -28,6 +29,7 @@ #include "php_json_encoder.h" #include #include "zend_enum.h" +#include "zend_strtod.h" // for ZEND_DOUBLE_MAX_LENGTH static const char digits[] = "0123456789abcdef"; diff --git a/ext/json/json_scanner.re b/ext/json/json_scanner.re index 1db43dd081a5..014f29bd5641 100644 --- a/ext/json/json_scanner.re +++ b/ext/json/json_scanner.re @@ -18,6 +18,7 @@ #include "php_json_scanner.h" #include "php_json_scanner_defs.h" #include "php_json_parser.h" +#include "zend_strtod.h" #include "json_parser.tab.h" #define YYCTYPE php_json_ctype diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 634195cb5762..53249efdf7de 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -20,6 +20,7 @@ #endif #include "php.h" +#include "php_globals.h" // for PG() #include "SAPI.h" #include "zend_variables.h" diff --git a/ext/mbstring/libmbfl/filters/mbfilter_base64.c b/ext/mbstring/libmbfl/filters/mbfilter_base64.c index ede3eef18ce7..bc06c6a1abf1 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_base64.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_base64.c @@ -30,6 +30,7 @@ #include "mbfilter.h" #include "mbfilter_base64.h" +#include "zend_multiply.h" // for zend_safe_address_guarded() static size_t mb_base64_to_wchar(unsigned char **in, size_t *in_len, uint32_t *buf, size_t bufsize, unsigned int *state); static void mb_wchar_to_base64(uint32_t *in, size_t len, mb_convert_buf *buf, bool end); diff --git a/ext/mbstring/mbstring.h b/ext/mbstring/mbstring.h index 83952a1d7ed2..32fd7f64a0f8 100644 --- a/ext/mbstring/mbstring.h +++ b/ext/mbstring/mbstring.h @@ -19,6 +19,7 @@ #ifndef _MBSTRING_H #define _MBSTRING_H +#include "php.h" #include "php_version.h" #define PHP_MBSTRING_VERSION PHP_VERSION diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h index 7495cc8bda73..443966f35280 100644 --- a/ext/mysqli/php_mysqli_structs.h +++ b/ext/mysqli/php_mysqli_structs.h @@ -26,6 +26,7 @@ #undef LIST #endif +#include "zend_iterators.h" // for zend_object_iterator_funcs #include "ext/mysqlnd/mysqlnd.h" #include "mysqli_mysqlnd.h" diff --git a/ext/mysqlnd/mysql_float_to_double.h b/ext/mysqlnd/mysql_float_to_double.h index a15458b52de2..b868aa67aa4c 100644 --- a/ext/mysqlnd/mysql_float_to_double.h +++ b/ext/mysqlnd/mysql_float_to_double.h @@ -20,6 +20,7 @@ #include "main/php.h" #include #include "main/snprintf.h" +#include "zend_strtod.h" #define MAX_CHAR_BUF_LEN 255 diff --git a/ext/mysqlnd/mysqlnd_connection.c b/ext/mysqlnd/mysqlnd_connection.c index 05b0dab63b00..5127c712371d 100644 --- a/ext/mysqlnd/mysqlnd_connection.c +++ b/ext/mysqlnd/mysqlnd_connection.c @@ -30,6 +30,8 @@ #include "mysqlnd_ext_plugin.h" #include "zend_smart_str.h" +#include +#include // for strerror() extern MYSQLND_CHARSET *mysqlnd_charsets; diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c index a71b70e055f3..34fb5350076c 100644 --- a/ext/mysqlnd/mysqlnd_loaddata.c +++ b/ext/mysqlnd/mysqlnd_loaddata.c @@ -16,6 +16,7 @@ +----------------------------------------------------------------------+ */ #include "php.h" +#include "php_globals.h" // for PG() #include "mysqlnd.h" #include "mysqlnd_wireprotocol.h" #include "mysqlnd_priv.h" diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index fce042ec5be5..25f178e0b57d 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -23,6 +23,7 @@ #include "mysqlnd_wireprotocol.h" #include "mysqlnd_statistics.h" #include "mysqlnd_debug.h" +#include "zend_strtod.h" #define BAIL_IF_NO_MORE_DATA \ if (UNEXPECTED((size_t)(p - begin) > packet->header.size)) { \ diff --git a/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c index 3520e2ee23bb..623e820bd32c 100644 --- a/ext/mysqlnd/php_mysqlnd.c +++ b/ext/mysqlnd/php_mysqlnd.c @@ -16,6 +16,7 @@ */ #include "php.h" +#include "php_ini.h" #include "mysqlnd.h" #include "mysqlnd_priv.h" #include "mysqlnd_debug.h" diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 98e1821568d7..c536f6213c9a 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -30,6 +30,7 @@ #include "php.h" #include "ext/standard/info.h" +#include "php_globals.h" // for PG() #include "php_ini.h" #include "zend_attributes.h" #include "zend_smart_str.h" diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c index dcad33564751..b3529354b8a7 100644 --- a/ext/oci8/oci8_collection.c +++ b/ext/oci8/oci8_collection.c @@ -35,6 +35,7 @@ #include "php_oci8.h" #include "php_oci8_int.h" +#include "zend_strtod.h" /* {{{ php_oci_collection_create() Create and return connection handle */ diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 2c1d74c2d4b9..bbd536c671fb 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -19,36 +19,28 @@ +----------------------------------------------------------------------+ */ -#include "main/php.h" -#include "main/php_globals.h" -#include "zend.h" -#include "zend_extensions.h" -#include "zend_compile.h" #include "ZendAccelerator.h" #include "zend_persist.h" #include "zend_shared_alloc.h" +#include "zend_accelerator_debug.h" #include "zend_accelerator_module.h" #include "zend_accelerator_blacklist.h" -#include "zend_list.h" -#include "zend_execute.h" -#include "zend_vm.h" +#include "zend_vm.h" // for zend_vm_set_opcode_handler() #include "zend_inheritance.h" #include "zend_exceptions.h" #include "zend_mmap.h" #include "zend_observer.h" -#include "main/php_main.h" +#include "main/php_main.h" // for php_request_shutdown() #include "main/SAPI.h" -#include "main/php_streams.h" -#include "main/php_open_temporary_file.h" -#include "zend_API.h" -#include "zend_ini.h" -#include "zend_virtual_cwd.h" #include "zend_accelerator_util_funcs.h" -#include "zend_accelerator_hash.h" #include "zend_file_cache.h" #include "ext/pcre/php_pcre.h" +#include "ext/standard/basic_functions.h" // for php_call_shutdown_functions() + +#ifdef ZEND_WIN32 #include "ext/standard/md5.h" #include "ext/hash/php_hash.h" +#endif #ifdef HAVE_JIT # include "jit/zend_jit.h" diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 568d8f497241..1a751231f32b 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -50,10 +50,13 @@ #include "zend_extensions.h" #include "zend_compile.h" +#include "zend_modules.h" -#include "Optimizer/zend_optimizer.h" -#include "zend_accelerator_hash.h" -#include "zend_accelerator_debug.h" +#include "Optimizer/zend_optimizer.h" // for zend_script +#include "zend_accelerator_hash.h" // for zend_accel_hash +#include "php.h" // for PHPAPI + +#include #ifndef PHPAPI # ifdef ZEND_WIN32 diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index da88d9afbde8..ba850108b125 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -16,11 +16,20 @@ +----------------------------------------------------------------------+ */ -#include "main/php.h" +#ifdef PHP_WIN32 +#include "config.w32.h" +#else +#include "php_config.h" // for HAVE_JIT +#endif + +#ifdef HAVE_JIT + +#include "jit/zend_jit_internal.h" + #include "main/SAPI.h" #include "php_version.h" -#include #include "zend_shared_alloc.h" +#include "Zend/zend_arena.h" #include "Zend/zend_execute.h" #include "Zend/zend_vm.h" #include "Zend/zend_exceptions.h" @@ -29,9 +38,6 @@ #include "Zend/zend_ini.h" #include "Zend/zend_observer.h" #include "zend_smart_str.h" -#include "jit/zend_jit.h" - -#ifdef HAVE_JIT #include "Optimizer/zend_func_info.h" #include "Optimizer/zend_ssa.h" @@ -39,18 +45,14 @@ #include "Optimizer/zend_call_graph.h" #include "Optimizer/zend_dump.h" -#if ZEND_JIT_TARGET_X86 -# include "jit/zend_jit_x86.h" -#elif ZEND_JIT_TARGET_ARM64 -# include "jit/zend_jit_arm64.h" -#endif - -#include "jit/zend_jit_internal.h" - #ifdef HAVE_PTHREAD_JIT_WRITE_PROTECT_NP #include #endif +#ifdef HAVE_MPROTECT +#include +#endif + #ifdef ZTS int jit_globals_id; #else diff --git a/ext/opcache/jit/zend_jit.h b/ext/opcache/jit/zend_jit.h index d22422181af9..4429b5d3ee12 100644 --- a/ext/opcache/jit/zend_jit.h +++ b/ext/opcache/jit/zend_jit.h @@ -19,15 +19,12 @@ #ifndef HAVE_JIT_H #define HAVE_JIT_H -#if defined(__x86_64__) || defined(i386) || defined(ZEND_WIN32) -# define ZEND_JIT_TARGET_X86 1 -# define ZEND_JIT_TARGET_ARM64 0 -#elif defined (__aarch64__) -# define ZEND_JIT_TARGET_X86 0 -# define ZEND_JIT_TARGET_ARM64 1 -#else -# error "JIT not supported on this platform" -#endif +#include "ZendAccelerator.h" // for ZEND_EXT_API +#include "zend_compile.h" // for zend_op, ... +#include "zend_long.h" + +#include +#include #define ZEND_JIT_LEVEL_NONE 0 /* no JIT */ #define ZEND_JIT_LEVEL_MINIMAL 1 /* minimal JIT (subroutine threading) */ diff --git a/ext/opcache/jit/zend_jit_arm64.h b/ext/opcache/jit/zend_jit_arm64.h index 1924875f1be4..0f0747973a16 100644 --- a/ext/opcache/jit/zend_jit_arm64.h +++ b/ext/opcache/jit/zend_jit_arm64.h @@ -20,6 +20,8 @@ #ifndef HAVE_JIT_ARM64_H #define HAVE_JIT_ARM64_H +#include + typedef enum _zend_reg { ZREG_NONE = -1, diff --git a/ext/opcache/jit/zend_jit_gdb.c b/ext/opcache/jit/zend_jit_gdb.c index 39169108a8f5..4f1b2aeb6f82 100644 --- a/ext/opcache/jit/zend_jit_gdb.c +++ b/ext/opcache/jit/zend_jit_gdb.c @@ -26,6 +26,7 @@ #include "zend_jit_gdb.h" #include "zend_elf.h" #include "zend_gdb.h" +#include "zend_string.h" // for ZSTR_VAL() /* DWARF definitions. */ #define DW_CIE_VERSION 1 diff --git a/ext/opcache/jit/zend_jit_internal.h b/ext/opcache/jit/zend_jit_internal.h index 606efebe0ea9..94a7ed8624e2 100644 --- a/ext/opcache/jit/zend_jit_internal.h +++ b/ext/opcache/jit/zend_jit_internal.h @@ -21,7 +21,25 @@ #ifndef ZEND_JIT_INTERNAL_H #define ZEND_JIT_INTERNAL_H -#include "zend_bitset.h" +#include "zend_jit_target.h" // for ZEND_JIT_TARGET_* + +#if ZEND_JIT_TARGET_X86 +# include "jit/zend_jit_x86.h" +#elif ZEND_JIT_TARGET_ARM64 +# include "jit/zend_jit_arm64.h" +#endif + +#include "zend_jit.h" // for zend_jit_trace_stack_frame + +#include "zend_bitset.h" // for zend_ulong_ntz() +#include "zend_compile.h" // for zend_op, ... +#include "zend_constants.h" +#include "zend_long.h" +#include "zend_portability.h" // for zend_always_inline +#include "zend_types.h" // for zend_uchar + +#include "Optimizer/zend_call_graph.h" // for struct _zend_func_info +#include "Optimizer/zend_func_info.h" // for zend_func_info /* Register Set */ #define ZEND_REGSET_EMPTY 0 diff --git a/ext/opcache/jit/zend_jit_target.h b/ext/opcache/jit/zend_jit_target.h new file mode 100644 index 000000000000..334ce82720e7 --- /dev/null +++ b/ext/opcache/jit/zend_jit_target.h @@ -0,0 +1,32 @@ +/* + +----------------------------------------------------------------------+ + | Zend JIT | + +----------------------------------------------------------------------+ + | Copyright (c) The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | https://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Dmitry Stogov | + +----------------------------------------------------------------------+ +*/ + +#ifndef HAVE_JIT_TARGET_H +#define HAVE_JIT_TARGET_H + +#if defined(__x86_64__) || defined(i386) || defined(ZEND_WIN32) +# define ZEND_JIT_TARGET_X86 1 +# define ZEND_JIT_TARGET_ARM64 0 +#elif defined (__aarch64__) +# define ZEND_JIT_TARGET_X86 0 +# define ZEND_JIT_TARGET_ARM64 1 +#else +# error "JIT not supported on this platform" +#endif + +#endif /* HAVE_JIT_TARGET_H */ diff --git a/ext/opcache/jit/zend_jit_vm_helpers.c b/ext/opcache/jit/zend_jit_vm_helpers.c index 8e02fbbbfeac..3d6325a4c6e9 100644 --- a/ext/opcache/jit/zend_jit_vm_helpers.c +++ b/ext/opcache/jit/zend_jit_vm_helpers.c @@ -17,6 +17,15 @@ +----------------------------------------------------------------------+ */ +#include "zend_jit.h" +#if ZEND_JIT_TARGET_X86 +# include "zend_jit_x86.h" +#elif ZEND_JIT_TARGET_ARM64 +# include "zend_jit_arm64.h" +#endif + +#include "zend_jit_internal.h" + #include "Zend/zend_execute.h" #include "Zend/zend_exceptions.h" #include "Zend/zend_vm.h" @@ -27,14 +36,6 @@ #include #include "Optimizer/zend_func_info.h" #include "Optimizer/zend_call_graph.h" -#include "zend_jit.h" -#if ZEND_JIT_TARGET_X86 -# include "zend_jit_x86.h" -#elif ZEND_JIT_TARGET_ARM64 -# include "zend_jit_arm64.h" -#endif - -#include "zend_jit_internal.h" #ifdef HAVE_GCC_GLOBAL_REGS # pragma GCC diagnostic ignored "-Wvolatile-register-var" diff --git a/ext/opcache/jit/zend_jit_x86.h b/ext/opcache/jit/zend_jit_x86.h index 924db409c328..20a93e230068 100644 --- a/ext/opcache/jit/zend_jit_x86.h +++ b/ext/opcache/jit/zend_jit_x86.h @@ -19,6 +19,8 @@ #ifndef HAVE_JIT_X86_H #define HAVE_JIT_X86_H +#include + typedef enum _zend_reg { ZREG_NONE = -1, diff --git a/ext/opcache/shared_alloc_mmap.c b/ext/opcache/shared_alloc_mmap.c index 1414ef96149d..76190511f25b 100644 --- a/ext/opcache/shared_alloc_mmap.c +++ b/ext/opcache/shared_alloc_mmap.c @@ -23,6 +23,10 @@ #ifdef USE_MMAP +#if defined(__linux__) +# include "ZendAccelerator.h" +#endif + #include #include #include @@ -38,6 +42,10 @@ #include #endif +#if defined(__FreeBSD__) || (defined(HAVE_PROCCTL) && defined(PROC_WXMAP_CTL)) +# include +#endif + #if defined(MAP_ANON) && !defined(MAP_ANONYMOUS) # define MAP_ANONYMOUS MAP_ANON #endif diff --git a/ext/opcache/shared_alloc_win32.c b/ext/opcache/shared_alloc_win32.c index 893fe98ec189..d77e50d03447 100644 --- a/ext/opcache/shared_alloc_win32.c +++ b/ext/opcache/shared_alloc_win32.c @@ -23,6 +23,7 @@ #include "ZendAccelerator.h" #include "zend_shared_alloc.h" #include "zend_accelerator_util_funcs.h" +#include "zend_accelerator_debug.h" #include "zend_execute.h" #include "zend_system_id.h" #include "SAPI.h" diff --git a/ext/opcache/zend_accelerator_blacklist.c b/ext/opcache/zend_accelerator_blacklist.c index 8ddc9298bf4d..de77725f1abe 100644 --- a/ext/opcache/zend_accelerator_blacklist.c +++ b/ext/opcache/zend_accelerator_blacklist.c @@ -19,10 +19,10 @@ +----------------------------------------------------------------------+ */ -#include "main/php.h" -#include "main/fopen_wrappers.h" -#include "ZendAccelerator.h" #include "zend_accelerator_blacklist.h" +#include "zend_accelerator_debug.h" // for zend_accel_error() +#include "main/fopen_wrappers.h" // for expand_filepath() +#include "ZendAccelerator.h" #ifdef ZEND_WIN32 # define REGEX_MODE (REG_EXTENDED|REG_NOSUB|REG_ICASE) diff --git a/ext/opcache/zend_accelerator_blacklist.h b/ext/opcache/zend_accelerator_blacklist.h index 2a7921f63d94..92ca93678691 100644 --- a/ext/opcache/zend_accelerator_blacklist.h +++ b/ext/opcache/zend_accelerator_blacklist.h @@ -22,6 +22,10 @@ #ifndef ZEND_ACCELERATOR_BLACKLIST_H #define ZEND_ACCELERATOR_BLACKLIST_H +#include +#include // for size_t + +typedef struct _zval_struct zval; typedef struct _zend_regexp_list zend_regexp_list; typedef struct _zend_blacklist_entry { diff --git a/ext/opcache/zend_accelerator_debug.c b/ext/opcache/zend_accelerator_debug.c index b2a3105dc627..dcb8fabe9859 100644 --- a/ext/opcache/zend_accelerator_debug.c +++ b/ext/opcache/zend_accelerator_debug.c @@ -19,14 +19,18 @@ +----------------------------------------------------------------------+ */ +#include "zend_accelerator_debug.h" +#include "ZendAccelerator.h" // for ZCG() + #include #include #include #include #ifdef ZEND_WIN32 # include +#else +# include // for getpid() #endif -#include "ZendAccelerator.h" static void zend_accel_error_va_args(int type, const char *format, va_list args) { diff --git a/ext/opcache/zend_accelerator_debug.h b/ext/opcache/zend_accelerator_debug.h index 4a19da57b5e6..8a7d40e1cce0 100644 --- a/ext/opcache/zend_accelerator_debug.h +++ b/ext/opcache/zend_accelerator_debug.h @@ -22,6 +22,8 @@ #ifndef ZEND_ACCELERATOR_DEBUG_H #define ZEND_ACCELERATOR_DEBUG_H +#include "zend_portability.h" // for BEGIN_EXTERN_C + #define ACCEL_LOG_FATAL 0 #define ACCEL_LOG_ERROR 1 #define ACCEL_LOG_WARNING 2 diff --git a/ext/opcache/zend_accelerator_hash.c b/ext/opcache/zend_accelerator_hash.c index 2fd3dfb5ed56..483b7a25f288 100644 --- a/ext/opcache/zend_accelerator_hash.c +++ b/ext/opcache/zend_accelerator_hash.c @@ -19,10 +19,11 @@ +----------------------------------------------------------------------+ */ -#include "ZendAccelerator.h" #include "zend_accelerator_hash.h" -#include "zend_hash.h" +#include "zend_accelerator_debug.h" #include "zend_shared_alloc.h" +#include "ZendAccelerator.h" +#include "Zend/zend_string.h" /* Generated on an Octa-ALPHA 300MHz CPU & 2.5GB RAM monster */ static const uint32_t prime_numbers[] = diff --git a/ext/opcache/zend_accelerator_hash.h b/ext/opcache/zend_accelerator_hash.h index 755d3f13ec51..ac5d979555f9 100644 --- a/ext/opcache/zend_accelerator_hash.h +++ b/ext/opcache/zend_accelerator_hash.h @@ -22,7 +22,13 @@ #ifndef ZEND_ACCELERATOR_HASH_H #define ZEND_ACCELERATOR_HASH_H -#include "zend.h" +#include "zend_long.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C + +#include +#include + +typedef struct _zend_string zend_string; /* zend_accel_hash - is a hash table allocated in shared memory and diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index f78e06514263..0cde83727bb3 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -19,25 +19,24 @@ +----------------------------------------------------------------------+ */ -#include - -#include "php.h" -#include "ZendAccelerator.h" -#include "zend_API.h" +#include "php.h" // for PHPAPI +#include "zend_accelerator_module.h" +#include "zend_accelerator_debug.h" // for zend_accel_error() #include "zend_shared_alloc.h" #include "zend_accelerator_blacklist.h" +#include "ZendAccelerator.h" // for ZCG() #include "php_ini.h" -#include "SAPI.h" -#include "zend_virtual_cwd.h" -#include "ext/standard/info.h" -#include "ext/standard/php_filestat.h" -#include "ext/date/php_date.h" -#include "opcache_arginfo.h" +#include "SAPI.h" // for SG() +#include "ext/standard/info.h" // for php_info_print_*() +#include "ext/date/php_date.h" // for php_format_date() +#include "opcache_arginfo.h" // for ext_functions #if HAVE_JIT #include "jit/zend_jit.h" #endif +#include + #define STRING_NOT_NULL(s) (NULL == (s)?"":s) #define MIN_ACCEL_FILES 200 #define MAX_ACCEL_FILES 1000000 diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index b99a50b21282..8537ff80ec2a 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -19,12 +19,9 @@ +----------------------------------------------------------------------+ */ -#include "zend_API.h" -#include "zend_constants.h" -#include "zend_inheritance.h" #include "zend_accelerator_util_funcs.h" -#include "zend_persist.h" -#include "zend_shared_alloc.h" +#include "ZendAccelerator.h" +#include "zend_inheritance.h" // for zend_try_early_bind() #include "zend_observer.h" #ifdef __SSE2__ diff --git a/ext/opcache/zend_accelerator_util_funcs.h b/ext/opcache/zend_accelerator_util_funcs.h index 53cc1de9effa..373965f4bb75 100644 --- a/ext/opcache/zend_accelerator_util_funcs.h +++ b/ext/opcache/zend_accelerator_util_funcs.h @@ -22,8 +22,14 @@ #ifndef ZEND_ACCELERATOR_UTIL_FUNCS_H #define ZEND_ACCELERATOR_UTIL_FUNCS_H -#include "zend.h" -#include "ZendAccelerator.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C + +#include + +typedef struct _zend_op_array zend_op_array; +typedef struct _zend_persistent_script zend_persistent_script; +typedef struct _zend_script zend_script; +typedef struct _zend_array HashTable; BEGIN_EXTERN_C() diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index e1307c8ead04..b781c64ba314 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -34,6 +34,7 @@ #include "zend_file_cache.h" #include "zend_shared_alloc.h" #include "zend_accelerator_util_funcs.h" +#include "zend_accelerator_debug.h" #include "zend_accelerator_hash.h" #if HAVE_JIT @@ -42,6 +43,7 @@ #include #include +#include #include #if HAVE_UNISTD_H diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index 9698d584e80d..0428ba69136e 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -19,20 +19,18 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "ZendAccelerator.h" #include "zend_persist.h" -#include "zend_extensions.h" #include "zend_shared_alloc.h" -#include "zend_vm.h" -#include "zend_constants.h" -#include "zend_operators.h" -#include "zend_interfaces.h" +#include "ZendAccelerator.h" #include "zend_attributes.h" +#include "zend_hash.h" // for HT_*() +#include "zend_interfaces.h" // for zend_ce_aggregate +#include "zend_types.h" // for zval +#include "zend_vm.h" // for zend_vm_set_opcode_handler_ex() #ifdef HAVE_JIT -# include "Optimizer/zend_func_info.h" -# include "jit/zend_jit.h" +# include "Optimizer/zend_func_info.h" // for ZEND_SET_FUNC_INFO() +# include "jit/zend_jit.h" // for JIT_G() #endif #define zend_set_str_gc_flags(str) do { \ diff --git a/ext/opcache/zend_persist.h b/ext/opcache/zend_persist.h index 930430c9589b..809ea5020e7c 100644 --- a/ext/opcache/zend_persist.h +++ b/ext/opcache/zend_persist.h @@ -22,6 +22,14 @@ #ifndef ZEND_PERSIST_H #define ZEND_PERSIST_H +#include "zend_portability.h" // for BEGIN_EXTERN_C + +#include + +typedef struct _zend_class_entry zend_class_entry; +typedef struct _zend_error_info zend_error_info; +typedef struct _zend_persistent_script zend_persistent_script; + BEGIN_EXTERN_C() uint32_t zend_accel_script_persist_calc(zend_persistent_script *script, int for_shm); diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index 4e3af0d68c65..4d7bdce4b08e 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -19,13 +19,13 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" -#include "ZendAccelerator.h" #include "zend_persist.h" -#include "zend_extensions.h" #include "zend_shared_alloc.h" -#include "zend_operators.h" +#include "ZendAccelerator.h" #include "zend_attributes.h" +#include "zend_hash.h" // for HT_*() +#include "zend_iterators.h" // for zend_class_iterator_funcs, zend_class_arrayaccess_funcs +#include "zend_types.h" // for zval #define ADD_DUP_SIZE(m,s) ZCG(current_persistent_script)->size += zend_shared_memdup_size((void*)m, s) #define ADD_SIZE(m) ZCG(current_persistent_script)->size += ZEND_ALIGNED_SIZE(m) diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c index 6fbf8ea20ae1..faedf10fc851 100644 --- a/ext/opcache/zend_shared_alloc.c +++ b/ext/opcache/zend_shared_alloc.c @@ -26,9 +26,15 @@ # include #endif -#include -#include "ZendAccelerator.h" #include "zend_shared_alloc.h" +#include "zend_accelerator_debug.h" // for zend_accel_error() +#include "ZendAccelerator.h" // for ZCG() + +#ifndef ZEND_WIN32 +# include "ZendAccelerator.h" // for MAXPATHLEN +#endif + +#include #ifdef HAVE_UNISTD_H # include #endif diff --git a/ext/opcache/zend_shared_alloc.h b/ext/opcache/zend_shared_alloc.h index ac7ec3e33f34..22357aa60d95 100644 --- a/ext/opcache/zend_shared_alloc.h +++ b/ext/opcache/zend_shared_alloc.h @@ -22,8 +22,12 @@ #ifndef ZEND_SHARED_ALLOC_H #define ZEND_SHARED_ALLOC_H -#include "zend.h" -#include "ZendAccelerator.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_long.h" + +#include +#include +#include // for size_t #if defined(__APPLE__) && defined(__MACH__) /* darwin */ # ifdef HAVE_SHM_MMAP_POSIX diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index c1c7ec7b704d..03d7d8283f2d 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -36,6 +36,8 @@ #include #include +#include + #ifdef PHP_WIN32 #include "win32/winutil.h" #include "win32/time.h" diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index db5c3d915805..a15bfae06494 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -20,6 +20,7 @@ #include "php_pcre.h" #include "ext/standard/info.h" #include "ext/standard/basic_functions.h" +#include "zend_multiply.h" // for zend_safe_address_guarded() #include "zend_smart_str.h" #include "SAPI.h" diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index ec4d5ec65866..cdd9b6ddae32 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -34,6 +34,8 @@ #include "zend_exceptions.h" #include "pgsql_driver_arginfo.h" +#include + static bool pgsql_handle_in_transaction(pdo_dbh_t *dbh); static char * _pdo_pgsql_trim_message(const char *message, int persistent) diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index de5170a35a96..29dd5f1a1e1d 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -19,6 +19,7 @@ #endif #include "php.h" +#include "php_globals.h" // for PG() #include "php_ini.h" #include "ext/standard/info.h" #include "pdo/php_pdo.h" diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 5157c0e6162a..f29c41c4f1ed 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -39,6 +39,7 @@ #include "php_pgsql.h" #include "php_globals.h" #include "zend_exceptions.h" +#include "zend_strtod.h" #ifdef HAVE_PGSQL diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index ba47cd88439c..41b97a43c0a8 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -21,6 +21,8 @@ #include "func_interceptors.h" #include "phar_object_arginfo.h" +#include + static zend_class_entry *phar_ce_archive; static zend_class_entry *phar_ce_data; static zend_class_entry *phar_ce_PharException; diff --git a/ext/random/gammasection.c b/ext/random/gammasection.c index aa4531fba22f..b8d32c3c2fe9 100644 --- a/ext/random/gammasection.c +++ b/ext/random/gammasection.c @@ -24,6 +24,8 @@ #include "php_random.h" #include +#include // for DBL_MAX + /* This file implements the γ-section algorithm as published in: * * Drawing Random Floating-Point Numbers from an Interval. Frédéric diff --git a/ext/random/random.c b/ext/random/random.c index d67b82c0713a..cedffec3699c 100644 --- a/ext/random/random.c +++ b/ext/random/random.c @@ -41,6 +41,7 @@ # include #else # include +# include #endif #if HAVE_SYS_PARAM_H diff --git a/ext/random/randomizer.c b/ext/random/randomizer.c index 6248d97f5b1d..1ce05f6c15f7 100644 --- a/ext/random/randomizer.c +++ b/ext/random/randomizer.c @@ -27,6 +27,8 @@ #include "Zend/zend_enum.h" #include "Zend/zend_exceptions.h" +#include // for DBL_MANT_DIG + static inline void randomizer_common_init(php_random_randomizer *randomizer, zend_object *engine_object) { if (engine_object->ce->type == ZEND_INTERNAL_CLASS) { /* Internal classes always php_random_engine struct */ diff --git a/ext/session/session.c b/ext/session/session.c index 5c80cf3079ea..e09d3e2707fa 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -20,6 +20,7 @@ #endif #include "php.h" +#include "php_globals.h" // for PG() #ifdef PHP_WIN32 # include "win32/winutil.h" diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c index be4f57ad2716..dfb301788dd0 100644 --- a/ext/shmop/shmop.c +++ b/ext/shmop/shmop.c @@ -33,11 +33,13 @@ #include "tsrm_win32.h" #endif - #ifdef HAVE_SHMOP #include "ext/standard/info.h" +#include +#include // for strerror() + /* {{{ shmop_module_entry */ zend_module_entry shmop_module_entry = { STANDARD_MODULE_HEADER, diff --git a/ext/simplexml/php_simplexml_exports.h b/ext/simplexml/php_simplexml_exports.h index 4ae02674d6da..959455956989 100644 --- a/ext/simplexml/php_simplexml_exports.h +++ b/ext/simplexml/php_simplexml_exports.h @@ -20,6 +20,7 @@ #define PHP_SIMPLEXML_EXPORTS_H #include "php_simplexml.h" +#include "zend_iterators.h" // for zend_object_iterator_funcs #define SKIP_TEXT(__p) \ if ((__p)->type == XML_TEXT_NODE) { \ diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 3b7d6c3885dc..6fc81d30686f 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -25,6 +25,8 @@ #include "zend_strtod.h" #include "zend_interfaces.h" +#include + /* zval type decode */ static zval *to_zval_double(zval* ret, encodeTypePtr type, xmlNodePtr data); static zval *to_zval_long(zval* ret, encodeTypePtr type, xmlNodePtr data); diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c index ae90cbe59d2a..bb314b4bb4dc 100644 --- a/ext/sockets/conversions.c +++ b/ext/sockets/conversions.c @@ -24,6 +24,7 @@ # include #endif +#include #include #include #include diff --git a/ext/sockets/multicast.c b/ext/sockets/multicast.c index 82672e68f2ba..641368bcef49 100644 --- a/ext/sockets/multicast.c +++ b/ext/sockets/multicast.c @@ -39,6 +39,7 @@ #include "sockaddr_conv.h" #include "main/php_network.h" +#include enum source_op { JOIN_SOURCE, diff --git a/ext/sockets/sendrecvmsg.c b/ext/sockets/sendrecvmsg.c index 5623b556aa00..eac78bda4137 100644 --- a/ext/sockets/sendrecvmsg.c +++ b/ext/sockets/sendrecvmsg.c @@ -28,6 +28,8 @@ #include #endif +#include + #define MAX_USER_BUFF_SIZE ((size_t)(100*1024*1024)) #define DEFAULT_BUFF_SIZE 8192 #define MAX_ARRAY_KEY_SIZE 128 diff --git a/ext/sockets/sockaddr_conv.c b/ext/sockets/sockaddr_conv.c index e4a7347cafab..86aea815cfd2 100644 --- a/ext/sockets/sockaddr_conv.c +++ b/ext/sockets/sockaddr_conv.c @@ -5,6 +5,7 @@ #ifdef PHP_WIN32 #include "windows_common.h" #else +#include #include #include #endif diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 8fa3627582c5..b0a00d8ad823 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -36,6 +36,9 @@ #include "spl_directory_arginfo.h" #include "spl_exceptions.h" +#include +#include // for strerror() + #define SPL_HAS_FLAG(flags, test_flag) ((flags & test_flag) ? 1 : 0) /* declare the class handlers */ diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 2b8cbe33dd94..ac616be3b5c6 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -19,6 +19,7 @@ #endif #include "php.h" +#include "php_globals.h" // for PG() #include "php_ini.h" #include "ext/standard/info.h" #include "php_sqlite3.h" diff --git a/ext/standard/array.c b/ext/standard/array.c index 88d2335c0afb..dc7a4c4338c0 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -40,6 +40,7 @@ #include "zend_smart_str.h" #include "zend_bitset.h" #include "zend_exceptions.h" +#include "zend_strtod.h" #include "ext/spl/spl_array.h" #include "ext/random/php_random.h" diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index f65a71a7266d..4e10cac38c71 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -117,6 +117,10 @@ PHPAPI php_basic_globals basic_globals; #include "streamsfuncs.h" #include "basic_functions_arginfo.h" +#if defined(HAVE_NANOSLEEP) || !defined(PHP_WIN32) +#include +#endif + typedef struct _user_tick_function_entry { zend_fcall_info fci; zend_fcall_info_cache fci_cache; diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index 9700eef5cbf5..0f9e0656f88c 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -16,6 +16,7 @@ #include "php.h" #include "php_browscap.h" +#include "php_globals.h" // for PG() #include "php_ini.h" #include "php_string.h" #include "ext/pcre/php_pcre.h" diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 863ce00588a7..d754b6a6cc73 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -20,6 +20,7 @@ #include "fopen_wrappers.h" #include "file.h" #include "php_dir.h" +#include "php_globals.h" // for PG() #include "php_string.h" #include "php_scandir.h" #include "basic_functions.h" diff --git a/ext/standard/dns.c b/ext/standard/dns.c index d229b998a4b6..a5a5d86483e0 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -57,6 +57,9 @@ extern void __res_ndestroy(res_state statp); #endif #endif +#include +#include // for strerror() + #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 255 #endif diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 1b1b0ab9e9ce..108c7d282f88 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -46,6 +46,10 @@ #include #endif +#ifdef HAVE_NICE +#include +#endif + #include #ifdef PHP_WIN32 diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index b988422df21c..a98d410a228f 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -19,6 +19,7 @@ #include "ext/standard/head.h" #include "php_string.h" #include "zend_execute.h" +#include "zend_strtod.h" // for zend_gcvt() #include #include diff --git a/ext/standard/ftok.c b/ext/standard/ftok.c index 1a046b3de697..d00dd6d75e5b 100644 --- a/ext/standard/ftok.c +++ b/ext/standard/ftok.c @@ -27,6 +27,10 @@ #endif #ifdef HAVE_FTOK + +#include +#include // for strerror() + /* {{{ Convert a pathname and a project identifier to a System V IPC key */ PHP_FUNCTION(ftok) { diff --git a/ext/standard/hrtime.c b/ext/standard/hrtime.c index 7dca135c920a..5fe4f950f31e 100644 --- a/ext/standard/hrtime.c +++ b/ext/standard/hrtime.c @@ -17,6 +17,7 @@ #include "php.h" #include "hrtime.h" +#include "zend_strtod.h" /* {{{ */ /* This file reuses code parts from the cross-platform timer library diff --git a/ext/standard/html.c b/ext/standard/html.c index e6c779892552..c984a9f1ab82 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -35,6 +35,7 @@ */ #include "php.h" +#include "php_globals.h" // for PG() #ifdef PHP_WIN32 #include "config.w32.h" #else diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 9b3b3ed75f3c..8c8fe7d2e848 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -19,6 +19,7 @@ #include #include #include "php.h" +#include "php_globals.h" // for PG() #include "ext/standard/info.h" #include "ext/standard/php_string.h" #include "ext/standard/basic_functions.h" @@ -44,6 +45,8 @@ #ifdef PHP_WIN32 # include "win32/sendmail.h" +#else +# include #endif #define SKIP_LONG_HEADER_SEP(str, pos) \ diff --git a/ext/standard/math.c b/ext/standard/math.c index ad2823ea49bf..5b2d74a2de9e 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -23,6 +23,7 @@ #include "zend_exceptions.h" #include "zend_portability.h" #include "zend_bitset.h" +#include "zend_strtod.h" #include #include diff --git a/ext/standard/md5.c b/ext/standard/md5.c index 899ff6aaeecb..b7cff21d0241 100644 --- a/ext/standard/md5.c +++ b/ext/standard/md5.c @@ -16,7 +16,6 @@ +----------------------------------------------------------------------+ */ -#include "php.h" #include "md5.h" PHPAPI void make_digest(char *md5str, const unsigned char *digest) /* {{{ */ diff --git a/ext/standard/md5.h b/ext/standard/md5.h index 0003a934be62..5814142f1968 100644 --- a/ext/standard/md5.h +++ b/ext/standard/md5.h @@ -18,6 +18,10 @@ #ifndef MD5_H #define MD5_H +#include "php.h" // for PHPAPI + +#include + PHPAPI void make_digest(char *md5str, const unsigned char *digest); PHPAPI void make_digest_ex(char *md5str, const unsigned char *digest, int len); diff --git a/ext/standard/net.c b/ext/standard/net.c index b22f304c8eb3..83d3e2170420 100644 --- a/ext/standard/net.c +++ b/ext/standard/net.c @@ -47,6 +47,9 @@ # include #endif +#include +#include // for strerror() + PHPAPI zend_string* php_inet_ntop(const struct sockaddr *addr) { socklen_t addrlen = sizeof(struct sockaddr_in); diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index 8926485025a3..8f70ba2094cc 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -29,6 +29,9 @@ #include "php_fopen_wrappers.h" #include "SAPI.h" +#include +#include // for strerror() + static ssize_t php_stream_output_write(php_stream *stream, const char *buf, size_t count) /* {{{ */ { PHPWRITE(buf, count); diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 03fd0716bacf..c789714cb6c8 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -36,6 +36,9 @@ #include #endif +#include +#include // for strerror() + /* This symbol is defined in ext/standard/config.m4. * Essentially, it is set if you HAVE_FORK || PHP_WIN32 * Other platforms may modify that configure check and add suitable #ifdefs diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index ac2c777eea52..5af3ec3d638d 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -40,6 +40,9 @@ typedef unsigned long long php_timeout_ull; typedef unsigned __int64 php_timeout_ull; #endif +#include +#include // for strerror() + #define GET_CTX_OPT(stream, wrapper, name, val) (PHP_STREAM_CONTEXT(stream) && NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), wrapper, name))) static php_stream_context *decode_context_param(zval *contextresource); diff --git a/ext/standard/var.c b/ext/standard/var.c index e8145ab22714..f6ceb9a57914 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -21,6 +21,8 @@ #include #include #include "php.h" +#include "php_globals.h" // for PG() +#include "php_ini.h" #include "php_string.h" #include "php_var.h" #include "zend_smart_str.h" @@ -28,6 +30,7 @@ #include "php_incomplete_class.h" #include "zend_enum.h" #include "zend_exceptions.h" +#include "zend_strtod.h" // for zend_gcvt() /* }}} */ struct php_serialize_data { diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index a050fb5f74a7..091c0559d0a3 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -15,10 +15,12 @@ */ #include "php.h" +#include "php_globals.h" // for PG() #include "ext/standard/php_var.h" #include "php_incomplete_class.h" #include "zend_portability.h" #include "zend_exceptions.h" +#include "zend_strtod.h" /* {{{ reference-handling for unserializer: var_* */ #define VAR_ENTRIES_MAX 1018 /* 1024 - offsetof(php_unserialize_data, entries) / sizeof(void*) */ diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c index 20bdecedb50c..258f23c6ff96 100644 --- a/ext/sysvmsg/sysvmsg.c +++ b/ext/sysvmsg/sysvmsg.c @@ -22,10 +22,13 @@ #include "php_globals.h" #include "ext/standard/info.h" #include "php_sysvmsg.h" -#include "sysvmsg_arginfo.h" #include "ext/standard/php_var.h" #include "zend_smart_str.h" +#include +#include "sysvmsg_arginfo.h" + +#include // for strerror() #include #include #include diff --git a/ext/zend_test/fiber.c b/ext/zend_test/fiber.c index 428ecc0682da..3db7e5eceb2f 100644 --- a/ext/zend_test/fiber.c +++ b/ext/zend_test/fiber.c @@ -19,6 +19,7 @@ #include "fiber_arginfo.h" #include "zend_fibers.h" #include "zend_exceptions.h" +#include "zend_objects.h" static zend_class_entry *zend_test_fiber_class; static zend_object_handlers zend_test_fiber_handlers; diff --git a/ext/zend_test/observer.c b/ext/zend_test/observer.c index 5568755fe87f..8da51c4729ef 100644 --- a/ext/zend_test/observer.c +++ b/ext/zend_test/observer.c @@ -16,6 +16,7 @@ #include "php.h" #include "php_test.h" +#include "php_ini.h" #include "observer.h" #include "zend_observer.h" #include "zend_smart_str.h" diff --git a/ext/zend_test/php_test.h b/ext/zend_test/php_test.h index 87412ba34d3e..3ba80ee0bd6c 100644 --- a/ext/zend_test/php_test.h +++ b/ext/zend_test/php_test.h @@ -28,6 +28,9 @@ extern zend_module_entry zend_test_module_entry; #include "TSRM.h" #endif +#include // for off_t +#include // for size_t + #if defined(ZTS) && defined(COMPILE_DL_ZEND_TEST) ZEND_TSRMLS_CACHE_EXTERN() #endif diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 8b593f1f451b..d98618171485 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -23,6 +23,7 @@ #endif #include "php.h" +#include "php_globals.h" // for PG() #include "SAPI.h" #include "php_ini.h" #include "ext/standard/info.h" diff --git a/main/SAPI.c b/main/SAPI.c index e71cba0fb1db..9e5d35e56fde 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -16,28 +16,27 @@ +----------------------------------------------------------------------+ */ -#include -#include - -#include "php.h" #include "SAPI.h" -#include "php_variables.h" +#include "php_content_types.h" +#include "php_globals.h" // for PG() #include "php_ini.h" -#include "ext/standard/php_string.h" -#include "ext/standard/pageinfo.h" -#include "ext/pcre/php_pcre.h" +#include "php_variables.h" // for PARSE_STRING +#include "rfc1867.h" // for destroy_uploaded_files_hash() + #ifdef ZTS -#include "TSRM.h" +# include "TSRM.h" #endif + #ifdef HAVE_SYS_TIME_H -#include +# include #elif defined(PHP_WIN32) -#include "win32/time.h" +# include "win32/time.h" +# include // for _ENABLE_PER_THREAD_LOCALE #endif -#include "rfc1867.h" +#include +#include -#include "php_content_types.h" #ifdef ZTS SAPI_API int sapi_globals_id; diff --git a/main/SAPI.h b/main/SAPI.h index 33c0e280d739..da185b1a5f72 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -17,12 +17,15 @@ #ifndef SAPI_H #define SAPI_H -#include "php.h" -#include "zend.h" -#include "zend_API.h" +#include "zend_API.h" // for zend_fcall_info_cache #include "zend_llist.h" -#include "zend_operators.h" -#include +#include "zend_stream.h" // for zend_stat_t + +#ifdef PHP_WIN32 +#include "php.h" // for uid_t, gid_t (PHP's fallback definition) +#else +#include // for uid_t, gid_t +#endif #define SAPI_OPTION_NO_CHDIR 1 #define SAPI_POST_BLOCK_SIZE 0x4000 diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index efb110171b14..5200014d1161 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -16,9 +16,10 @@ */ /* {{{ includes */ -#include "php.h" -#include "php_globals.h" -#include "SAPI.h" +#include "fopen_wrappers.h" +#include "php_ini.h" // for PHP_INI_STAGE_* +#include "php_globals.h" // for PG() +#include "SAPI.h" // for SG() #include #include @@ -34,11 +35,6 @@ #include #endif -#include "ext/standard/head.h" -#include "ext/standard/php_standard.h" -#include "zend_compile.h" -#include "php_network.h" - #if HAVE_PWD_H #include #endif diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h index f4070b11c3de..85eb4e3ecd1e 100644 --- a/main/fopen_wrappers.h +++ b/main/fopen_wrappers.h @@ -17,9 +17,11 @@ #ifndef FOPEN_WRAPPERS_H #define FOPEN_WRAPPERS_H +#include "php.h" // for PHPAPI +#include "zend_ini.h" // for ZEND_INI_MH() +#include "zend_portability.h" // for BEGIN_EXTERN_C + BEGIN_EXTERN_C() -#include "php_globals.h" -#include "php_ini.h" PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle); PHPAPI char *expand_filepath(const char *filepath, char *real_path); diff --git a/main/main.c b/main/main.c index 8e09f4cd4c0b..bb319310880f 100644 --- a/main/main.c +++ b/main/main.c @@ -83,6 +83,8 @@ #include "rfc1867.h" #include "ext/standard/html_tables.h" + +#include #include "main_arginfo.h" /* }}} */ diff --git a/main/php.h b/main/php.h index c3d139059c48..ec563cc18c15 100644 --- a/main/php.h +++ b/main/php.h @@ -32,6 +32,7 @@ #include "zend_rc_debug.h" #include "zend_sort.h" #include "php_compat.h" +#include "zend_range_check.h" #include "zend_API.h" @@ -441,4 +442,25 @@ typedef bool zend_bool; typedef intptr_t zend_intptr_t; typedef uintptr_t zend_uintptr_t; +/* the following headers used to be included indirectly, and we have + * them here only for backwards compatibility with thirdparty + * extensions */ +#include "php_globals.h" +#include "php_ini.h" +#include "zend_alloc.h" +#include "zend_arena.h" +#include "zend_iterators.h" +#include "zend_multiply.h" +#include "zend_objects.h" +#include "zend_strtod.h" +#include +#include +#include + +/* the following typedefs are deprecated; use the standard C99 types + * instead */ +typedef bool zend_bool; +typedef intptr_t zend_intptr_t; +typedef uintptr_t zend_uintptr_t; + #endif diff --git a/main/php_globals.h b/main/php_globals.h index d5e372cf2b40..44749ee565cc 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -17,6 +17,7 @@ #ifndef PHP_GLOBALS_H #define PHP_GLOBALS_H +#include "php.h" #include "zend_globals.h" #include diff --git a/main/php_ini.c b/main/php_ini.c index 68304f42c5da..bc50e9d883b6 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -14,15 +14,11 @@ +----------------------------------------------------------------------+ */ -#include "php.h" -#include "ext/standard/info.h" -#include "zend_ini.h" -#include "zend_ini_scanner.h" #include "php_ini.h" +#include "ext/standard/info.h" // for php_info_print_*() #include "ext/standard/dl.h" -#include "zend_extensions.h" -#include "zend_highlight.h" -#include "zend_rc_debug.h" +#include "zend_ini_scanner.h" +#include "zend_extensions.h" // for zend_load_extension() #include "SAPI.h" #include "php_main.h" #include "php_scandir.h" diff --git a/main/php_ini.h b/main/php_ini.h index a5538efd7076..4dd9d574fce2 100644 --- a/main/php_ini.h +++ b/main/php_ini.h @@ -18,6 +18,8 @@ #define PHP_INI_H #include "zend_ini.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "php.h" // for PHPAPI BEGIN_EXTERN_C() PHPAPI void config_zval_dtor(zval *zvalue); diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c index dcea78358486..038aa3e72eb9 100644 --- a/main/php_open_temporary_file.c +++ b/main/php_open_temporary_file.c @@ -14,8 +14,8 @@ +----------------------------------------------------------------------+ */ -#include "php.h" #include "php_open_temporary_file.h" +#include "php_globals.h" // for PG() #include #include diff --git a/main/php_open_temporary_file.h b/main/php_open_temporary_file.h index 1d8764a7487e..32672b196207 100644 --- a/main/php_open_temporary_file.h +++ b/main/php_open_temporary_file.h @@ -17,6 +17,9 @@ #ifndef PHP_OPEN_TEMPORARY_FILE_H #define PHP_OPEN_TEMPORARY_FILE_H +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "php.h" // for PHPAPI + #define PHP_TMP_FILE_DEFAULT 0 #define PHP_TMP_FILE_OPEN_BASEDIR_CHECK_ON_FALLBACK (1<<0) #define PHP_TMP_FILE_SILENT (1<<1) diff --git a/main/php_syslog.c b/main/php_syslog.c index 975a0423df17..e43b05bdcbe8 100644 --- a/main/php_syslog.c +++ b/main/php_syslog.c @@ -14,15 +14,12 @@ +----------------------------------------------------------------------+ */ -#include -#include -#include -#include "php.h" #include "php_syslog.h" - -#include "zend.h" +#include "php_globals.h" // for PG() #include "zend_smart_string.h" +#include + /* * The SCO OpenServer 5 Development System (not the UDK) * defines syslog to std_syslog. diff --git a/main/php_syslog.h b/main/php_syslog.h index f2682d74f238..dca7fe0c4fd3 100644 --- a/main/php_syslog.h +++ b/main/php_syslog.h @@ -17,15 +17,16 @@ #ifndef PHP_SYSLOG_H #define PHP_SYSLOG_H -#include "php.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "php.h" // for PHPAPI #ifdef PHP_WIN32 -#include "win32/syslog.h" +# include "win32/syslog.h" #else -#include -#ifdef HAVE_SYSLOG_H -#include -#endif +# include +# ifdef HAVE_SYSLOG_H +# include +# endif #endif /* Syslog filters */ diff --git a/main/php_ticks.c b/main/php_ticks.c index 004314583bdb..d5848f72dc79 100644 --- a/main/php_ticks.c +++ b/main/php_ticks.c @@ -14,8 +14,8 @@ +----------------------------------------------------------------------+ */ -#include "php.h" #include "php_ticks.h" +#include "php_globals.h" // for PG() struct st_tick_function { diff --git a/main/php_ticks.h b/main/php_ticks.h index 5edf7a483bba..c72f41c3255a 100644 --- a/main/php_ticks.h +++ b/main/php_ticks.h @@ -17,6 +17,9 @@ #ifndef PHP_TICKS_H #define PHP_TICKS_H +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "php.h" // for PHPAPI + int php_startup_ticks(void); void php_deactivate_ticks(void); void php_shutdown_ticks(void); diff --git a/main/rfc1867.c b/main/rfc1867.c index 4b1dcff3e23a..90089966dc4c 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -21,15 +21,14 @@ * */ -#include -#include "php.h" -#include "php_open_temporary_file.h" -#include "zend_globals.h" -#include "php_globals.h" -#include "php_variables.h" #include "rfc1867.h" +#include "php_open_temporary_file.h" // for php_open_temporary_fd_ex() +#include "php_globals.h" // for PG() +#include "php_variables.h" // for php_register_variable_ex() #include "zend_smart_string.h" +#include // for snprintf() + #ifndef DEBUG_FILE_UPLOAD # define DEBUG_FILE_UPLOAD 0 #endif diff --git a/main/rfc1867.h b/main/rfc1867.h index e1ec2af87c42..668407206bcb 100644 --- a/main/rfc1867.h +++ b/main/rfc1867.h @@ -17,7 +17,8 @@ #ifndef RFC1867_H #define RFC1867_H -#include "SAPI.h" +#include "php.h" // for PHPAPI +#include "SAPI.h" // for SAPI_API #define MULTIPART_CONTENT_TYPE "multipart/form-data" #define MULTIPART_EVENT_START 0 diff --git a/main/snprintf.c b/main/snprintf.c index 9acd4efe6d77..ae13432dc95f 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -17,7 +17,7 @@ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif -#include "php.h" +#include "snprintf.h" #include diff --git a/main/snprintf.h b/main/snprintf.h index 2ff7116c3fbb..99c746d994ac 100644 --- a/main/snprintf.h +++ b/main/snprintf.h @@ -66,6 +66,9 @@ spprintf is the dynamical version of snprintf. It allocates the buffer in size #ifndef SNPRINTF_H #define SNPRINTF_H +#include "php.h" // for PHPAPI +#include "zend_portability.h" // for BEGIN_EXTERN_C + #include BEGIN_EXTERN_C() diff --git a/main/spprintf.c b/main/spprintf.c index 37b81dc6d530..f4faf0d894c5 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -75,7 +75,8 @@ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif -#include "php.h" +#include "spprintf.h" +#include "zend_strtod.h" #include #include diff --git a/main/spprintf.h b/main/spprintf.h index 4da224845b3b..73d9286d4743 100644 --- a/main/spprintf.h +++ b/main/spprintf.h @@ -18,6 +18,8 @@ #define SPPRINTF_H #include "snprintf.h" +#include "php.h" // for PHPAPI +#include "zend_portability.h" // for BEGIN_EXTERN_C #include "zend_smart_str_public.h" #include "zend_smart_string_public.h" diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 3a6b2ccf28dc..f8984148ce8b 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -42,6 +42,9 @@ # include "win32/readdir.h" #endif +#include +#include + #define php_stream_fopen_from_fd_int(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_CC) #define php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_REL_CC) #define php_stream_fopen_from_file_int(file, mode) _php_stream_fopen_from_file_int((file), (mode) STREAMS_CC) diff --git a/main/streams/streams.c b/main/streams/streams.c index 9663f792bc39..3bbdf5487956 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -32,6 +32,9 @@ #include #include "php_streams_int.h" +#include +#include + /* {{{ resource and registration code */ /* Global wrapper hash, copied to FG(stream_wrappers) on registration of volatile wrapper */ static HashTable url_stream_wrappers_hash; diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index 3a4beca9f077..5ea41a420a8b 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -25,8 +25,11 @@ #ifdef AF_UNIX #include +#include #endif +#include + #ifndef MSG_DONTWAIT # define MSG_DONTWAIT 0 #endif diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index b45468031fcd..f4f37537e722 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -95,6 +95,8 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS; # include "valgrind/callgrind.h" #endif +#include + #ifndef PHP_WIN32 /* XXX this will need to change later when threaded fastcgi is implemented. shane */ struct sigaction act, old_term, old_quit, old_int; diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index cc9a26c41389..c2c91574d578 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -92,6 +92,8 @@ # include "openssl/applink.c" #endif +#include + PHPAPI extern char *php_ini_opened_path; PHPAPI extern char *php_ini_scanned_path; PHPAPI extern char *php_ini_scanned_files; diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index e59037ac2e8d..946ad1de1c23 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -106,6 +106,9 @@ #include "php_cli_process_title.h" #include "php_cli_process_title_arginfo.h" +#include +#include + #define OUTPUT_NOT_CHECKED -1 #define OUTPUT_IS_TTY 1 #define OUTPUT_NOT_TTY 0 diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 5f47dd8efcc2..87c7dc3ec045 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -94,6 +94,9 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS; #include "fpm_log.h" #include "zlog.h" +#include +#include + /* XXX this will need to change later when threaded fastcgi is implemented. shane */ struct sigaction act, old_term, old_quit, old_int; diff --git a/sapi/phpdbg/phpdbg_io.c b/sapi/phpdbg/phpdbg_io.c index 14ae71a0ebd1..6cf827c1be01 100644 --- a/sapi/phpdbg/phpdbg_io.c +++ b/sapi/phpdbg/phpdbg_io.c @@ -20,6 +20,8 @@ #include "phpdbg_io.h" +#include + ZEND_EXTERN_MODULE_GLOBALS(phpdbg) /* is easy to generalize ... but not needed for now */ diff --git a/sapi/phpdbg/phpdbg_sigsafe.h b/sapi/phpdbg/phpdbg_sigsafe.h index 7b7599e07ea0..3f09b0035ddf 100644 --- a/sapi/phpdbg/phpdbg_sigsafe.h +++ b/sapi/phpdbg/phpdbg_sigsafe.h @@ -1,9 +1,11 @@ #ifndef PHPDBG_SIGSAFE_H #define PHPDBG_SIGSAFE_H -#define PHPDBG_SIGSAFE_MEM_SIZE (ZEND_MM_CHUNK_SIZE * 2) +#include "zend_alloc.h" + +#include -#include "zend.h" +#define PHPDBG_SIGSAFE_MEM_SIZE (ZEND_MM_CHUNK_SIZE * 2) typedef struct { char *mem;