diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-28 20:47:50 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-28 20:47:50 +0200 |
commit | e5857bd6c79e9201d8f49ac335b2da9142afc39c (patch) | |
tree | b8ed4d5aa4c18f7351b374b2b10c593f68348be1 | |
parent | 0dd308cedd7a8ddd20e93dabe32aef4a9340d5d5 (diff) | |
parent | 85fe6ecc32ace7fcf119d9b492e37cd627ae7e4d (diff) |
Merge pull request #66548 from akien-mga/msvc-warnings-c4701-c4703
Fix MSVC warnings C4701 and C4703: Potentially uninitialized variable used
-rw-r--r-- | core/templates/paged_array.h | 2 | ||||
-rw-r--r-- | drivers/vulkan/rendering_device_vulkan.cpp | 4 | ||||
-rw-r--r-- | drivers/vulkan/vulkan_context.cpp | 8 | ||||
-rw-r--r-- | platform/uwp/export/app_packager.cpp | 2 | ||||
-rw-r--r-- | servers/physics_2d/godot_space_2d.cpp | 5 | ||||
-rw-r--r-- | servers/physics_3d/godot_space_3d.cpp | 5 | ||||
-rw-r--r-- | servers/rendering/shader_language.cpp | 4 | ||||
-rw-r--r-- | servers/rendering/shader_language.h | 2 |
8 files changed, 17 insertions, 15 deletions
diff --git a/core/templates/paged_array.h b/core/templates/paged_array.h index f1ede556e6..2992dd463e 100644 --- a/core/templates/paged_array.h +++ b/core/templates/paged_array.h @@ -268,7 +268,7 @@ public: uint32_t remainder = count & page_size_mask; T *remainder_page = nullptr; - uint32_t remainder_page_id; + uint32_t remainder_page_id = 0; if (remainder > 0) { uint32_t last_page = _get_pages_in_use() - 1; diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index 53e9146f85..bfe34399ec 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -4828,7 +4828,7 @@ Vector<uint8_t> RenderingDeviceVulkan::shader_compile_binary_from_spirv(const Ve for (uint32_t j = 0; j < binding_count; j++) { const SpvReflectDescriptorBinding &binding = *bindings[j]; - RenderingDeviceVulkanShaderBinaryDataBinding info; + RenderingDeviceVulkanShaderBinaryDataBinding info{}; bool need_array_dimensions = false; bool need_block_size = false; @@ -4979,7 +4979,7 @@ Vector<uint8_t> RenderingDeviceVulkan::shader_compile_binary_from_spirv(const Ve for (uint32_t j = 0; j < sc_count; j++) { int32_t existing = -1; - RenderingDeviceVulkanShaderBinarySpecializationConstant sconst; + RenderingDeviceVulkanShaderBinarySpecializationConstant sconst{}; SpvReflectSpecializationConstant *spc = spec_constants[j]; sconst.constant_id = spc->constant_id; diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp index 99ef57abae..98adc0f16e 100644 --- a/drivers/vulkan/vulkan_context.cpp +++ b/drivers/vulkan/vulkan_context.cpp @@ -608,10 +608,10 @@ Error VulkanContext::_check_capabilities() { device_properties_func = (PFN_vkGetPhysicalDeviceProperties2)vkGetInstanceProcAddr(inst, "vkGetPhysicalDeviceProperties2KHR"); } if (device_properties_func != nullptr) { - VkPhysicalDeviceFragmentShadingRatePropertiesKHR vrsProperties; - VkPhysicalDeviceMultiviewProperties multiviewProperties; - VkPhysicalDeviceSubgroupProperties subgroupProperties; - VkPhysicalDeviceProperties2 physicalDeviceProperties; + VkPhysicalDeviceFragmentShadingRatePropertiesKHR vrsProperties{}; + VkPhysicalDeviceMultiviewProperties multiviewProperties{}; + VkPhysicalDeviceSubgroupProperties subgroupProperties{}; + VkPhysicalDeviceProperties2 physicalDeviceProperties{}; void *nextptr = nullptr; subgroupProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES; diff --git a/platform/uwp/export/app_packager.cpp b/platform/uwp/export/app_packager.cpp index 87224d38b8..6f8966b9ff 100644 --- a/platform/uwp/export/app_packager.cpp +++ b/platform/uwp/export/app_packager.cpp @@ -301,7 +301,7 @@ Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t Vector<uint8_t> file_buffer; // Data for compression - z_stream strm; + z_stream strm{}; Vector<uint8_t> strm_in; strm_in.resize(BLOCK_SIZE); Vector<uint8_t> strm_out; diff --git a/servers/physics_2d/godot_space_2d.cpp b/servers/physics_2d/godot_space_2d.cpp index bd4bdf04b0..a82d7dbbc4 100644 --- a/servers/physics_2d/godot_space_2d.cpp +++ b/servers/physics_2d/godot_space_2d.cpp @@ -129,8 +129,8 @@ bool GodotPhysicsDirectSpaceState2D::intersect_ray(const RayParameters &p_parame bool collided = false; Vector2 res_point, res_normal; - int res_shape; - const GodotCollisionObject2D *res_obj; + int res_shape = -1; + const GodotCollisionObject2D *res_obj = nullptr; real_t min_d = 1e10; for (int i = 0; i < amount; i++) { @@ -190,6 +190,7 @@ bool GodotPhysicsDirectSpaceState2D::intersect_ray(const RayParameters &p_parame if (!collided) { return false; } + ERR_FAIL_NULL_V(res_obj, false); // Shouldn't happen but silences warning. r_result.collider_id = res_obj->get_instance_id(); if (r_result.collider_id.is_valid()) { diff --git a/servers/physics_3d/godot_space_3d.cpp b/servers/physics_3d/godot_space_3d.cpp index 76d59202c9..c23485279d 100644 --- a/servers/physics_3d/godot_space_3d.cpp +++ b/servers/physics_3d/godot_space_3d.cpp @@ -120,8 +120,8 @@ bool GodotPhysicsDirectSpaceState3D::intersect_ray(const RayParameters &p_parame bool collided = false; Vector3 res_point, res_normal; - int res_shape; - const GodotCollisionObject3D *res_obj; + int res_shape = -1; + const GodotCollisionObject3D *res_obj = nullptr; real_t min_d = 1e10; for (int i = 0; i < amount; i++) { @@ -185,6 +185,7 @@ bool GodotPhysicsDirectSpaceState3D::intersect_ray(const RayParameters &p_parame if (!collided) { return false; } + ERR_FAIL_NULL_V(res_obj, false); // Shouldn't happen but silences warning. r_result.collider_id = res_obj->get_instance_id(); if (r_result.collider_id.is_valid()) { diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index fd9ee6f0c2..a92292209f 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -5342,8 +5342,8 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons last_type = IDENTIFIER_MAX; _set_tkpos(pos); - DataType data_type; - IdentifierType ident_type; + DataType data_type = TYPE_MAX; + IdentifierType ident_type = IDENTIFIER_MAX; int array_size = 0; StringName struct_name; bool is_local = false; diff --git a/servers/rendering/shader_language.h b/servers/rendering/shader_language.h index e9f8c3b289..1e302f5805 100644 --- a/servers/rendering/shader_language.h +++ b/servers/rendering/shader_language.h @@ -483,7 +483,7 @@ public: int array_size = 0; union Value { - bool boolean; + bool boolean = false; float real; int32_t sint; uint32_t uint; |