Fixed compilation warnings

This commit is contained in:
Dmitry Stogov 2016-04-29 14:44:56 +03:00
parent 3e9419dd28
commit 2578d08033
7 changed files with 28 additions and 24 deletions

View File

@ -526,13 +526,13 @@ ZEND_FUNCTION(func_get_arg)
arg_count = ZEND_CALL_NUM_ARGS(ex);
if (requested_offset >= arg_count) {
if ((zend_ulong)requested_offset >= arg_count) {
zend_error(E_WARNING, "func_get_arg(): Argument " ZEND_LONG_FMT " not passed to function", requested_offset);
RETURN_FALSE;
}
first_extra_arg = ex->func->op_array.num_args;
if (requested_offset >= first_extra_arg && (ZEND_CALL_NUM_ARGS(ex) > first_extra_arg)) {
if ((zend_ulong)requested_offset >= first_extra_arg && (ZEND_CALL_NUM_ARGS(ex) > first_extra_arg)) {
arg = ZEND_CALL_VAR_NUM(ex, ex->func->op_array.last_var + ex->func->op_array.T) + (requested_offset - first_extra_arg);
} else {
arg = ZEND_CALL_ARG(ex, requested_offset + 1);
@ -755,7 +755,7 @@ ZEND_FUNCTION(each)
Return the current error_reporting level, and if an argument was passed - change to the new level */
ZEND_FUNCTION(error_reporting)
{
zval *err;
zval *err = NULL;
int old_error_reporting;
#ifndef FAST_ZPP

View File

@ -7024,7 +7024,7 @@ void zend_compile_array(znode *result, zend_ast *ast) /* {{{ */
/* Add a flag to INIT_ARRAY if we know this array cannot be packed */
if (!packed) {
ZEND_ASSERT(opnum_init != -1);
ZEND_ASSERT(opnum_init != (uint32_t)-1);
opline = &CG(active_op_array)->opcodes[opnum_init];
opline->extended_value |= ZEND_ARRAY_NOT_PACKED;
}
@ -7288,11 +7288,11 @@ static void zend_compile_encaps_list(znode *result, zend_ast *ast) /* {{{ */
while (opline != init_opline) {
opline--;
if (opline->opcode == ZEND_ROPE_ADD &&
opline->result.var == -1) {
opline->result.var == (uint32_t)-1) {
opline->op1.var = var;
opline->result.var = var;
} else if (opline->opcode == ZEND_ROPE_INIT &&
opline->result.var == -1) {
opline->result.var == (uint32_t)-1) {
opline->result.var = var;
}
}

View File

@ -662,14 +662,15 @@ ZEND_METHOD(exception, __toString)
zend_class_entry *base_ce;
zend_string *str;
zend_fcall_info fci;
zval fname, rv;
zval rv;
zend_string *fname;
DEFAULT_0_PARAMS;
str = ZSTR_EMPTY_ALLOC();
exception = getThis();
ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1);
fname = zend_string_init("gettraceasstring", sizeof("gettraceasstring")-1, 0);
while (exception && Z_TYPE_P(exception) == IS_OBJECT && instanceof_function(Z_OBJCE_P(exception), zend_ce_throwable)) {
zend_string *prev_str = str;
@ -678,7 +679,7 @@ ZEND_METHOD(exception, __toString)
zend_long line = zval_get_long(GET_PROPERTY(exception, "line"));
fci.size = sizeof(fci);
ZVAL_COPY_VALUE(&fci.function_name, &fname);
ZVAL_STR(&fci.function_name, fname);
fci.object = Z_OBJ_P(exception);
fci.retval = &trace;
fci.param_count = 0;
@ -719,7 +720,7 @@ ZEND_METHOD(exception, __toString)
exception = GET_PROPERTY(exception, "previous");
}
zval_dtor(&fname);
zend_string_release(fname);
exception = getThis();
base_ce = i_get_exception_base(exception);

View File

@ -827,7 +827,7 @@ try_again:
}
/* }}} */
static void inline zend_generator_ensure_initialized(zend_generator *generator) /* {{{ */
static inline void zend_generator_ensure_initialized(zend_generator *generator) /* {{{ */
{
if (UNEXPECTED(Z_TYPE(generator->value) == IS_UNDEF) && EXPECTED(generator->execute_data) && EXPECTED(generator->node.parent == NULL)) {
generator->flags |= ZEND_GENERATOR_DO_INIT;
@ -838,7 +838,7 @@ static void inline zend_generator_ensure_initialized(zend_generator *generator)
}
/* }}} */
static void inline zend_generator_rewind(zend_generator *generator) /* {{{ */
static inline void zend_generator_rewind(zend_generator *generator) /* {{{ */
{
zend_generator_ensure_initialized(generator);
@ -1161,7 +1161,8 @@ static zend_object_iterator_funcs zend_generator_iterator_functions = {
zend_generator_iterator_get_data,
zend_generator_iterator_get_key,
zend_generator_iterator_move_forward,
zend_generator_iterator_rewind
zend_generator_iterator_rewind,
NULL
};
zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *object, int by_ref) /* {{{ */

View File

@ -92,7 +92,7 @@ static void _zend_is_inconsistent(const HashTable *ht, const char *file, int lin
static void ZEND_FASTCALL zend_hash_do_resize(HashTable *ht);
static uint32_t zend_always_inline zend_hash_check_size(uint32_t nSize)
static zend_always_inline uint32_t zend_hash_check_size(uint32_t nSize)
{
#if defined(ZEND_WIN32)
unsigned long index;
@ -127,7 +127,7 @@ static uint32_t zend_always_inline zend_hash_check_size(uint32_t nSize)
#endif
}
static void zend_always_inline zend_hash_real_init_ex(HashTable *ht, int packed)
static zend_always_inline void zend_hash_real_init_ex(HashTable *ht, int packed)
{
HT_ASSERT(GC_REFCOUNT(ht) == 1);
ZEND_ASSERT(!((ht)->u.flags & HASH_FLAG_INITIALIZED));
@ -139,7 +139,7 @@ static void zend_always_inline zend_hash_real_init_ex(HashTable *ht, int packed)
(ht)->nTableMask = -(ht)->nTableSize;
HT_SET_DATA_ADDR(ht, pemalloc(HT_SIZE(ht), (ht)->u.flags & HASH_FLAG_PERSISTENT));
(ht)->u.flags |= HASH_FLAG_INITIALIZED;
if (EXPECTED(ht->nTableMask == -8)) {
if (EXPECTED(ht->nTableMask == (uint32_t)-8)) {
Bucket *arData = ht->arData;
HT_HASH_EX(arData, -8) = -1;
@ -156,7 +156,7 @@ static void zend_always_inline zend_hash_real_init_ex(HashTable *ht, int packed)
}
}
static void zend_always_inline zend_hash_check_init(HashTable *ht, int packed)
static zend_always_inline void zend_hash_check_init(HashTable *ht, int packed)
{
HT_ASSERT(GC_REFCOUNT(ht) == 1);
if (UNEXPECTED(!((ht)->u.flags & HASH_FLAG_INITIALIZED))) {

View File

@ -736,7 +736,7 @@ ZEND_API int pass_two(zend_op_array *op_array)
}
if (op_array->live_range) {
uint32_t i;
int i;
for (i = 0; i < op_array->last_live_range; i++) {
op_array->live_range[i].var =

View File

@ -599,26 +599,26 @@ try_again:
if (Z_OBJ_HT_P(op)->get_properties) {
HashTable *obj_ht = Z_OBJ_HT_P(op)->get_properties(op);
if (obj_ht) {
zval arr;
zend_array *arr;
if (!Z_OBJCE_P(op)->default_properties_count &&
obj_ht == Z_OBJ_P(op)->properties &&
!ZEND_HASH_GET_APPLY_COUNT(Z_OBJ_P(op)->properties)) {
/* fast copy */
if (EXPECTED(Z_OBJ_P(op)->handlers == &std_object_handlers)) {
ZVAL_ARR(&arr, obj_ht);
arr = obj_ht;
if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(op)->properties) & IS_ARRAY_IMMUTABLE))) {
GC_REFCOUNT(Z_OBJ_P(op)->properties)++;
}
} else {
ZVAL_ARR(&arr, zend_array_dup(obj_ht));
arr = zend_array_dup(obj_ht);
}
zval_dtor(op);
ZVAL_COPY_VALUE(op, &arr);
ZVAL_ARR(op, arr);
} else {
ZVAL_ARR(&arr, zend_array_dup(obj_ht));
arr = zend_array_dup(obj_ht);
zval_dtor(op);
ZVAL_COPY_VALUE(op, &arr);
ZVAL_ARR(op, arr);
}
return;
}
@ -2932,6 +2932,8 @@ static zend_always_inline void zend_memnstr_ex_pre(unsigned int td[], const char
td[(unsigned char)needle[i]] = i + 1;
}
} else {
size_t i;
for (i = 0; i < needle_len; i++) {
td[(unsigned char)needle[i]] = (int)needle_len - i;
}