Skip to content

Fixed MSVC compiler warning #641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading