]> granicus.if.org Git - php/commitdiff
Fixed compilation warnings
authorDmitry Stogov <dmitry@zend.com>
Thu, 27 Nov 2014 09:52:31 +0000 (12:52 +0300)
committerDmitry Stogov <dmitry@zend.com>
Thu, 27 Nov 2014 09:52:31 +0000 (12:52 +0300)
Zend/zend_alloc.c
Zend/zend_compile.c
Zend/zend_execute.c
Zend/zend_gc.c
Zend/zend_indent.c

index 9d5e079dfa73a41f0b005e2f1659eeecf0769f5f..1e031f48f54f9ec33958666f21184d09d6a7245f 100644 (file)
@@ -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)
 
index ea4b355b92abe18029eb09e7ae5a47ef4b9910e5..4f373e6e73e214496f24dc5b21391b41fd6dcdff 100644 (file)
@@ -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;
index 94197857f455e153366c3520f8f7ffbc2907007a..2fbd1d50116dcd52e5573475ab68e48975093d2e 100644 (file)
@@ -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)
index e47b5350d44c2849cc7d484aca135aa9412d9209..f6aad866a7a0af744cae5698201a88b9da263b36 100644 (file)
@@ -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;
 
index 93c10108f8c0d7e02c140e75f05abede08a7c380..b5884c72c0b06280c3a724038cbb2cc080cc231f 100644 (file)
@@ -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;