Skip to content

Commit

Permalink
test_vulkan: don't throw from destructors (#1947)
Browse files Browse the repository at this point in the history
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 <sven.vanhaastregt@arm.com>
  • Loading branch information
svenvh committed Apr 16, 2024
1 parent 43237f7 commit 7dc9593
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -1052,4 +1052,4 @@ VulkanImageTiling vkClExternalMemoryHandleTilingAssumption(
}

return mode;
}
}

0 comments on commit 7dc9593

Please sign in to comment.