From 6c9b1a5db2c8406fd7b0a8e4a7525e498b4ffb13 Mon Sep 17 00:00:00 2001 From: George Marques Date: Sat, 6 Oct 2018 09:41:31 -0300 Subject: [PATCH] Fix compiler warnings in GDScript module --- modules/gdscript/gdscript_function.cpp | 29 +++++++++++++++++--------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index ca81d6d9262..f09ff224e89 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -419,8 +419,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a profile.call_count++; profile.frame_call_count++; } -#endif bool exit_ok = false; +#endif #ifdef DEBUG_ENABLED OPCODE_WHILE(ip < _code_size) { @@ -679,8 +679,10 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a GET_VARIANT_PTR(src, 2); bool valid; +#ifndef DEBUG_ENABLED + ClassDB::set_property(p_instance->owner, *index, *src, &valid); +#else bool ok = ClassDB::set_property(p_instance->owner, *index, *src, &valid); -#ifdef DEBUG_ENABLED if (!ok) { err_text = "Internal error setting property: " + String(*index); OPCODE_BREAK; @@ -700,9 +702,11 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a GD_ERR_BREAK(indexname < 0 || indexname >= _global_names_count); const StringName *index = &_global_names_ptr[indexname]; GET_VARIANT_PTR(dst, 2); - bool ok = ClassDB::get_property(p_instance->owner, *index, *dst); -#ifdef DEBUG_ENABLED +#ifndef DEBUG_ENABLED + ClassDB::get_property(p_instance->owner, *index, *dst); +#else + bool ok = ClassDB::get_property(p_instance->owner, *index, *dst); if (!ok) { err_text = "Internal error getting property: " + String(*index); OPCODE_BREAK; @@ -749,13 +753,13 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a OPCODE(OPCODE_ASSIGN_TYPED_BUILTIN) { CHECK_SPACE(4); - Variant::Type var_type = (Variant::Type)_code_ptr[ip + 1]; GET_VARIANT_PTR(dst, 2); GET_VARIANT_PTR(src, 3); +#ifdef DEBUG_ENABLED + Variant::Type var_type = (Variant::Type)_code_ptr[ip + 1]; GD_ERR_BREAK(var_type < 0 || var_type >= Variant::VARIANT_MAX); -#ifdef DEBUG_ENABLED if (src->get_type() != var_type) { if (Variant::can_convert_strict(src->get_type(), var_type)) { Variant::CallError ce; @@ -779,11 +783,11 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a OPCODE(OPCODE_ASSIGN_TYPED_NATIVE) { CHECK_SPACE(4); - GET_VARIANT_PTR(type, 1); GET_VARIANT_PTR(dst, 2); GET_VARIANT_PTR(src, 3); #ifdef DEBUG_ENABLED + GET_VARIANT_PTR(type, 1); GDScriptNativeClass *nc = Object::cast_to(type->operator Object *()); GD_ERR_BREAK(!nc); if (src->get_type() != Variant::OBJECT && src->get_type() != Variant::NIL) { @@ -808,11 +812,11 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a OPCODE(OPCODE_ASSIGN_TYPED_SCRIPT) { CHECK_SPACE(4); - GET_VARIANT_PTR(type, 1); GET_VARIANT_PTR(dst, 2); GET_VARIANT_PTR(src, 3); #ifdef DEBUG_ENABLED + GET_VARIANT_PTR(type, 1); Script *base_type = Object::cast_to