From 7dc9593d8828157dbce35c83e75bd8999d12dfea Mon Sep 17 00:00:00 2001 From: Sven van Haastregt Date: Tue, 16 Apr 2024 19:11:08 +0200 Subject: [PATCH] test_vulkan: don't throw from destructors (#1947) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only report an error (and include the error code), but don't throw an exception as that would call `terminate`. Failure to release resources is not fatal in other parts of the CTS. This fixes `-Wterminate` warnings: warning: ‘throw’ will always call ‘terminate’ [-Wterminate] note: in C++11 destructors default to ‘noexcept’ Signed-off-by: Sven van Haastregt --- .../common/vulkan_wrapper/opencl_vulkan_wrapper.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test_conformance/common/vulkan_wrapper/opencl_vulkan_wrapper.cpp b/test_conformance/common/vulkan_wrapper/opencl_vulkan_wrapper.cpp index c137580227..f295387a1f 100644 --- a/test_conformance/common/vulkan_wrapper/opencl_vulkan_wrapper.cpp +++ b/test_conformance/common/vulkan_wrapper/opencl_vulkan_wrapper.cpp @@ -853,7 +853,7 @@ clExternalImportableSemaphore::~clExternalImportableSemaphore() cl_int err = clReleaseSemaphoreKHRptr(m_externalSemaphore); if (err != CL_SUCCESS) { - throw std::runtime_error("clReleaseSemaphoreKHR failed!"); + log_error("clReleaseSemaphoreKHR failed with %d\n", err); } } @@ -935,7 +935,7 @@ clExternalExportableSemaphore::~clExternalExportableSemaphore() cl_int err = clReleaseSemaphoreKHRptr(m_externalSemaphore); if (err != CL_SUCCESS) { - throw std::runtime_error("clReleaseSemaphoreKHR failed!"); + log_error("clReleaseSemaphoreKHR failed with %d\n", err); } } @@ -1052,4 +1052,4 @@ VulkanImageTiling vkClExternalMemoryHandleTilingAssumption( } return mode; -} \ No newline at end of file +}