Skip to content

Commit

Permalink
Fixed MSVC compiler warning
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Dec 16, 2024
1 parent 7ec84e7 commit 1560ed3
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,11 @@ VkPhysicalDevice VulkanInstance::SelectPhysicalDevice(uint32_t AdapterId) const
return SelectedPhysicalDevice;
}

#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable : 4702) // unreachable code
#endif

VkPhysicalDevice VulkanInstance::SelectPhysicalDeviceForOpenXR(const CreateInfo::OpenXRInfo& XRInfo) const noexcept(false)
{
#if DILIGENT_USE_OPENXR
Expand Down Expand Up @@ -708,8 +713,12 @@ VkPhysicalDevice VulkanInstance::SelectPhysicalDeviceForOpenXR(const CreateInfo:
return vkDevice;
#else
LOG_ERROR_AND_THROW("OpenXR is not supported. Use DILIGENT_USE_OPENXR CMake option to enable it.");
return VK_NULL_HANDLE;
return VK_NULL_HANDLE; // Triggers unreachable code warning on MSVC
#endif
}

#ifdef _MSC_VER
# pragma warning(pop)
#endif

} // namespace VulkanUtilities

0 comments on commit 1560ed3

Please sign in to comment.