diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-11-27 12:52:31 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-11-27 12:52:31 +0300 |
commit | 109baa0394434e820f6b5abb07bfd6841ebd39c9 (patch) | |
tree | 821711092e5faa1e960b0e88f917120ef4721b72 | |
parent | 216ef321730f40e87397f38138504a91e09ae287 (diff) | |
download | php-git-109baa0394434e820f6b5abb07bfd6841ebd39c9.tar.gz |
Fixed compilation warnings
-rw-r--r-- | Zend/zend_alloc.c | 13 | ||||
-rw-r--r-- | Zend/zend_compile.c | 15 | ||||
-rw-r--r-- | Zend/zend_execute.c | 24 | ||||
-rw-r--r-- | Zend/zend_gc.c | 2 | ||||
-rw-r--r-- | Zend/zend_indent.c | 2 |
5 files changed, 37 insertions, 19 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 9d5e079dfa..1e031f48f5 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -2130,6 +2130,7 @@ ZEND_API void* ZEND_FASTCALL _emalloc_huge(size_t size) return zend_mm_alloc_huge(AG(mm_heap), size); } +#if ZEND_DEBUG # define _ZEND_BIN_FREE(_num, _size, _elements, _pages, x, y) \ ZEND_API void ZEND_FASTCALL _efree_ ## _size(void *ptr) { \ TSRMLS_FETCH(); \ @@ -2144,6 +2145,18 @@ ZEND_API void* ZEND_FASTCALL _emalloc_huge(size_t size) zend_mm_free_small(AG(mm_heap), ptr, _num); \ } \ } +#else +# define _ZEND_BIN_FREE(_num, _size, _elements, _pages, x, y) \ + ZEND_API void ZEND_FASTCALL _efree_ ## _size(void *ptr) { \ + TSRMLS_FETCH(); \ + ZEND_MM_CUSTOM_DEALLOCATOR(ptr); \ + { \ + zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE); \ + ZEND_MM_CHECK(chunk->heap == AG(mm_heap), "zend_mm_heap corrupted"); \ + zend_mm_free_small(AG(mm_heap), ptr, _num); \ + } \ + } +#endif ZEND_MM_BINS_INFO(_ZEND_BIN_FREE, x, y) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index ea4b355b92..4f373e6e73 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1811,7 +1811,7 @@ static inline uint32_t zend_delayed_compile_begin(TSRMLS_D) /* {{{ */ static zend_op *zend_delayed_compile_end(uint32_t offset TSRMLS_DC) /* {{{ */ { - zend_op *opline, *oplines = zend_stack_base(&CG(delayed_oplines_stack)); + zend_op *opline = NULL, *oplines = zend_stack_base(&CG(delayed_oplines_stack)); uint32_t i, count = zend_stack_count(&CG(delayed_oplines_stack)); ZEND_ASSERT(count > offset); @@ -3434,7 +3434,7 @@ void zend_compile_if(zend_ast *ast TSRMLS_DC) /* {{{ */ { zend_ast_list *list = zend_ast_get_list(ast); uint32_t i; - uint32_t *jmp_opnums; + uint32_t *jmp_opnums = NULL; if (list->children > 1) { jmp_opnums = safe_emalloc(sizeof(uint32_t), list->children - 1, 0); @@ -5807,14 +5807,14 @@ void zend_compile_encaps_list(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */ void zend_compile_magic_const(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */ { - zend_class_entry *ce = CG(active_class_entry); - if (zend_try_ct_eval_magic_const(&result->u.constant, ast TSRMLS_CC)) { result->op_type = IS_CONST; return; } - ZEND_ASSERT(ast->attr == T_CLASS_C && ce && ZEND_CE_IS_TRAIT(ce)); + ZEND_ASSERT(ast->attr == T_CLASS_C && + CG(active_class_entry) && + ZEND_CE_IS_TRAIT(CG(active_class_entry))); { zend_ast *const_ast = zend_ast_create(ZEND_AST_CONST, @@ -5945,10 +5945,11 @@ void zend_compile_const_expr_resolve_class_name(zend_ast **ast_ptr TSRMLS_DC) /* void zend_compile_const_expr_magic_const(zend_ast **ast_ptr TSRMLS_DC) /* {{{ */ { zend_ast *ast = *ast_ptr; - zend_class_entry *ce = CG(active_class_entry); /* Other cases already resolved by constant folding */ - ZEND_ASSERT(ast->attr == T_CLASS_C && ce && ZEND_CE_IS_TRAIT(ce)); + ZEND_ASSERT(ast->attr == T_CLASS_C && + CG(active_class_entry) && + ZEND_CE_IS_TRAIT(CG(active_class_entry))); { zval const_zv; diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 94197857f4..2fbd1d5011 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -558,20 +558,24 @@ ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, uin fclass = ""; } - if (arg && zf->common.type == ZEND_USER_FUNCTION) { - ZVAL_COPY_VALUE(&old_arg, arg); - ZVAL_UNDEF(arg); - } + if (zf->common.type == ZEND_USER_FUNCTION) { + if (arg) { + ZVAL_COPY_VALUE(&old_arg, arg); + ZVAL_UNDEF(arg); + } - if (zf->common.type == ZEND_USER_FUNCTION && ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) { - zend_error(error_type, "Argument %d passed to %s%s%s() must %s%s, %s%s given, called in %s on line %d and defined", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind, ptr->func->op_array.filename->val, ptr->opline->lineno); + if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) { + zend_error(error_type, "Argument %d passed to %s%s%s() must %s%s, %s%s given, called in %s on line %d and defined", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind, ptr->func->op_array.filename->val, ptr->opline->lineno); + } else { + zend_error(error_type, "Argument %d passed to %s%s%s() must %s%s, %s%s given", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind); + } + + if (arg) { + ZVAL_COPY_VALUE(arg, &old_arg); + } } else { zend_error(error_type, "Argument %d passed to %s%s%s() must %s%s, %s%s given", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind); } - - if (arg && zf->common.type == ZEND_USER_FUNCTION) { - ZVAL_COPY_VALUE(arg, &old_arg); - } } static int is_null_constant(zval *default_value TSRMLS_DC) diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c index e47b5350d4..f6aad866a7 100644 --- a/Zend/zend_gc.c +++ b/Zend/zend_gc.c @@ -641,7 +641,7 @@ static int gc_collect_roots(TSRMLS_D) static void gc_remove_nested_data_from_buffer(zend_refcounted *ref TSRMLS_DC) { - HashTable *ht; + HashTable *ht = NULL; uint idx; Bucket *p; diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c index 93c10108f8..b5884c72c0 100644 --- a/Zend/zend_indent.c +++ b/Zend/zend_indent.c @@ -31,7 +31,7 @@ #define zendleng LANG_SCNG(yy_leng) -static void handle_whitespace(int *emit_whitespace) +static void handle_whitespace(unsigned int *emit_whitespace) { unsigned char c; int i; |