From: Dmitry Stogov Date: Mon, 18 Jul 2005 06:34:42 +0000 (+0000) Subject: Removed some compilation warnings. X-Git-Tag: RELEASE_0_9~95 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d7baf87c61a4e023960ab436ec7eac93345ce5e1;p=php Removed some compilation warnings. --- diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index f5e2e00d9b..d4fb7b1a3f 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -406,7 +406,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNU case ZEND_ASSIGN_DIM: { zval **object_ptr = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W); - if (OP1_TYPE != IS_CV && free_op1.var == NULL) { + if (OP1_TYPE != IS_CV && !OP1_FREE) { (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } @@ -1993,7 +1993,7 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) if (OP1_TYPE == IS_VAR && !(*retval_ptr_ptr)->is_ref) { if (EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr || (opline->extended_value == ZEND_RETURNS_FUNCTION && !EX_T(opline->op1.u.var).var.fcall_returned_reference)) { - if (OP1_TYPE == IS_VAR && free_op1.var == NULL) { + if (OP1_TYPE == IS_VAR && !OP1_FREE) { PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } zend_error(E_NOTICE, "Only variable references should be returned by reference"); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 99c344f3c1..ee89863694 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1584,7 +1584,7 @@ static int ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_op *opline = EX(opline); zval *retval_ptr; zval **retval_ptr_ptr; - zend_free_op free_op1; + if (EG(active_op_array)->return_reference == ZEND_RETURN_REF) { @@ -1603,7 +1603,7 @@ static int ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (IS_CONST == IS_VAR && !(*retval_ptr_ptr)->is_ref) { if (EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr || (opline->extended_value == ZEND_RETURNS_FUNCTION && !EX_T(opline->op1.u.var).var.fcall_returned_reference)) { - if (IS_CONST == IS_VAR && free_op1.var == NULL) { + if (IS_CONST == IS_VAR && !0) { PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -4012,7 +4012,7 @@ static int ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (IS_TMP_VAR == IS_VAR && !(*retval_ptr_ptr)->is_ref) { if (EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr || (opline->extended_value == ZEND_RETURNS_FUNCTION && !EX_T(opline->op1.u.var).var.fcall_returned_reference)) { - if (IS_TMP_VAR == IS_VAR && free_op1.var == NULL) { + if (IS_TMP_VAR == IS_VAR && !1) { PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -6942,7 +6942,7 @@ static int ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (IS_VAR == IS_VAR && !(*retval_ptr_ptr)->is_ref) { if (EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr || (opline->extended_value == ZEND_RETURNS_FUNCTION && !EX_T(opline->op1.u.var).var.fcall_returned_reference)) { - if (IS_VAR == IS_VAR && free_op1.var == NULL) { + if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) { PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -8155,7 +8155,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_CONST(int (*binary_op)(zval *re case ZEND_ASSIGN_DIM: { zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (IS_VAR != IS_CV && free_op1.var == NULL) { + if (IS_VAR != IS_CV && !(free_op1.var != NULL)) { (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } @@ -9570,7 +9570,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_op)(zval *resu case ZEND_ASSIGN_DIM: { zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (IS_VAR != IS_CV && free_op1.var == NULL) { + if (IS_VAR != IS_CV && !(free_op1.var != NULL)) { (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } @@ -10989,7 +10989,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_op)(zval *resu case ZEND_ASSIGN_DIM: { zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (IS_VAR != IS_CV && free_op1.var == NULL) { + if (IS_VAR != IS_CV && !(free_op1.var != NULL)) { (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } @@ -12212,7 +12212,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_UNUSED(int (*binary_op)(zval *r case ZEND_ASSIGN_DIM: { zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (IS_VAR != IS_CV && free_op1.var == NULL) { + if (IS_VAR != IS_CV && !(free_op1.var != NULL)) { (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } @@ -12825,7 +12825,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_op)(zval *resul case ZEND_ASSIGN_DIM: { zval **object_ptr = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (IS_VAR != IS_CV && free_op1.var == NULL) { + if (IS_VAR != IS_CV && !(free_op1.var != NULL)) { (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } @@ -14103,7 +14103,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int (*binary_op)(z static int zend_binary_assign_op_helper_SPEC_UNUSED_CONST(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1, free_op_data2, free_op_data1; + zend_free_op free_op_data2, free_op_data1; zval **var_ptr; zval *value; zend_bool increment_opline = 0; @@ -14115,7 +14115,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_CONST(int (*binary_op)(zval case ZEND_ASSIGN_DIM: { zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - if (IS_UNUSED != IS_CV && free_op1.var == NULL) { + if (IS_UNUSED != IS_CV && !0) { (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } @@ -15181,7 +15181,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zva static int zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1, free_op2, free_op_data2, free_op_data1; + zend_free_op free_op2, free_op_data2, free_op_data1; zval **var_ptr; zval *value; zend_bool increment_opline = 0; @@ -15193,7 +15193,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*binary_op)(zval *r case ZEND_ASSIGN_DIM: { zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - if (IS_UNUSED != IS_CV && free_op1.var == NULL) { + if (IS_UNUSED != IS_CV && !0) { (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } @@ -16221,7 +16221,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*binary_op)(zva static int zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1, free_op2, free_op_data2, free_op_data1; + zend_free_op free_op2, free_op_data2, free_op_data1; zval **var_ptr; zval *value; zend_bool increment_opline = 0; @@ -16233,7 +16233,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*binary_op)(zval *r case ZEND_ASSIGN_DIM: { zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - if (IS_UNUSED != IS_CV && free_op1.var == NULL) { + if (IS_UNUSED != IS_CV && !0) { (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } @@ -17261,7 +17261,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)( static int zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1, free_op_data2, free_op_data1; + zend_free_op free_op_data2, free_op_data1; zval **var_ptr; zval *value; zend_bool increment_opline = 0; @@ -17273,7 +17273,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(zval case ZEND_ASSIGN_DIM: { zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - if (IS_UNUSED != IS_CV && free_op1.var == NULL) { + if (IS_UNUSED != IS_CV && !0) { (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } @@ -17627,7 +17627,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval static int zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1, free_op_data2, free_op_data1; + zend_free_op free_op_data2, free_op_data1; zval **var_ptr; zval *value; zend_bool increment_opline = 0; @@ -17639,7 +17639,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binary_op)(zval *re case ZEND_ASSIGN_DIM: { zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C); - if (IS_UNUSED != IS_CV && free_op1.var == NULL) { + if (IS_UNUSED != IS_CV && !0) { (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } @@ -18970,7 +18970,7 @@ static int ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_op *opline = EX(opline); zval *retval_ptr; zval **retval_ptr_ptr; - zend_free_op free_op1; + if (EG(active_op_array)->return_reference == ZEND_RETURN_REF) { @@ -18989,7 +18989,7 @@ static int ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (IS_CV == IS_VAR && !(*retval_ptr_ptr)->is_ref) { if (EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr || (opline->extended_value == ZEND_RETURNS_FUNCTION && !EX_T(opline->op1.u.var).var.fcall_returned_reference)) { - if (IS_CV == IS_VAR && free_op1.var == NULL) { + if (IS_CV == IS_VAR && !0) { PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ } zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -20037,7 +20037,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*binary_op)(zval static int zend_binary_assign_op_helper_SPEC_CV_CONST(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1, free_op_data2, free_op_data1; + zend_free_op free_op_data2, free_op_data1; zval **var_ptr; zval *value; zend_bool increment_opline = 0; @@ -20049,7 +20049,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_CONST(int (*binary_op)(zval *res case ZEND_ASSIGN_DIM: { zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - if (IS_CV != IS_CV && free_op1.var == NULL) { + if (IS_CV != IS_CV && !0) { (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } @@ -21444,7 +21444,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*binary_op)(zval *r static int zend_binary_assign_op_helper_SPEC_CV_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1, free_op2, free_op_data2, free_op_data1; + zend_free_op free_op2, free_op_data2, free_op_data1; zval **var_ptr; zval *value; zend_bool increment_opline = 0; @@ -21456,7 +21456,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_TMP(int (*binary_op)(zval *resul case ZEND_ASSIGN_DIM: { zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - if (IS_CV != IS_CV && free_op1.var == NULL) { + if (IS_CV != IS_CV && !0) { (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } @@ -22855,7 +22855,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*binary_op)(zval *r static int zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1, free_op2, free_op_data2, free_op_data1; + zend_free_op free_op2, free_op_data2, free_op_data1; zval **var_ptr; zval *value; zend_bool increment_opline = 0; @@ -22867,7 +22867,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_op)(zval *resul case ZEND_ASSIGN_DIM: { zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - if (IS_CV != IS_CV && free_op1.var == NULL) { + if (IS_CV != IS_CV && !0) { (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } @@ -24069,7 +24069,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval static int zend_binary_assign_op_helper_SPEC_CV_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1, free_op_data2, free_op_data1; + zend_free_op free_op_data2, free_op_data1; zval **var_ptr; zval *value; zend_bool increment_opline = 0; @@ -24081,7 +24081,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_UNUSED(int (*binary_op)(zval *re case ZEND_ASSIGN_DIM: { zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - if (IS_CV != IS_CV && free_op1.var == NULL) { + if (IS_CV != IS_CV && !0) { (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } @@ -24681,7 +24681,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binary_op)(zval *re static int zend_binary_assign_op_helper_SPEC_CV_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zend_free_op free_op1, free_op_data2, free_op_data1; + zend_free_op free_op_data2, free_op_data1; zval **var_ptr; zval *value; zend_bool increment_opline = 0; @@ -24693,7 +24693,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_CV(int (*binary_op)(zval *result case ZEND_ASSIGN_DIM: { zval **object_ptr = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_W TSRMLS_CC); - if (IS_CV != IS_CV && free_op1.var == NULL) { + if (IS_CV != IS_CV && !0) { (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index 94e2a65e64..235735d983 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -80,6 +80,24 @@ $op2_type = array( "CV" => "IS_CV", ); +$op1_free = array( + "ANY" => "(free_op1.var != NULL)", + "TMP" => "1", + "VAR" => "(free_op1.var != NULL)", + "CONST" => "0", + "UNUSED" => "0", + "CV" => "0", +); + +$op2_free = array( + "ANY" => "(free_op2.var != NULL)", + "TMP" => "1", + "VAR" => "(free_op2.var != NULL)", + "CONST" => "0", + "UNUSED" => "0", + "CV" => "0", +); + $op1_get_zval_ptr = array( "ANY" => "get_zval_ptr(&opline->op1, EX(Ts), &free_op1, \\1)", "TMP" => "_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)", @@ -272,7 +290,7 @@ function gen_code($f, $spec, $kind, $code, $op1, $op2) { $op1_get_zval_ptr_ptr, $op2_get_zval_ptr_ptr, $op1_get_obj_zval_ptr, $op2_get_obj_zval_ptr, $op1_get_obj_zval_ptr_ptr, $op2_get_obj_zval_ptr_ptr, - $op1_is_tmp_free, $op2_is_tmp_free, + $op1_is_tmp_free, $op2_is_tmp_free, $op1_free, $op2_free, $op1_free_op, $op2_free_op, $op1_free_op_if_var, $op2_free_op_if_var, $op1_free_op_var_ptr, $op2_free_op_var_ptr, $prefix; @@ -281,6 +299,8 @@ function gen_code($f, $spec, $kind, $code, $op1, $op2) { array( "/OP1_TYPE/", "/OP2_TYPE/", + "/OP1_FREE/", + "/OP2_FREE/", "/GET_OP1_ZVAL_PTR\(([^)]*)\)/", "/GET_OP2_ZVAL_PTR\(([^)]*)\)/", "/GET_OP1_ZVAL_PTR_PTR\(([^)]*)\)/", @@ -305,6 +325,8 @@ function gen_code($f, $spec, $kind, $code, $op1, $op2) { array( $op1_type[$op1], $op2_type[$op2], + $op1_free[$op1], + $op2_free[$op2], $op1_get_zval_ptr[$op1], $op2_get_zval_ptr[$op2], $op1_get_zval_ptr_ptr[$op1],