From dee7b08d1f34d6cc3158cb9d5a58e49ae92faf13 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Fri, 19 Jan 2024 06:38:48 -0800 Subject: [PATCH] [NFC] Drop code related to `error_category_for` That API was removed from the SYCL 2020 specification in KhronosGroup/SYCL-Docs#431 --- util/sycl_exceptions.h | 65 ------------------------------------------ 1 file changed, 65 deletions(-) diff --git a/util/sycl_exceptions.h b/util/sycl_exceptions.h index 0877b4b98..19d7b9c5a 100644 --- a/util/sycl_exceptions.h +++ b/util/sycl_exceptions.h @@ -29,8 +29,6 @@ #define SYCL_CTS_SUPPORT_HAS_EXCEPTION_CODE 1 #define SYCL_CTS_SUPPORT_HAS_EXCEPTION_CATEGORY 0 -#define SYCL_CTS_SUPPORT_HAS_ERRC_FOR 0 -#define SYCL_CTS_SUPPORT_HAS_ERROR_CATEGORY_FOR 0 #define SYCL_CTS_SUPPORT_HAS_MAKE_ERROR_CODE 0 #elif SYCL_CTS_COMPILING_WITH_DPCPP @@ -38,16 +36,12 @@ #define SYCL_CTS_SUPPORT_HAS_EXCEPTION_CODE 1 #define SYCL_CTS_SUPPORT_HAS_EXCEPTION_CATEGORY 1 -#define SYCL_CTS_SUPPORT_HAS_ERRC_FOR 1 -#define SYCL_CTS_SUPPORT_HAS_ERROR_CATEGORY_FOR 0 #define SYCL_CTS_SUPPORT_HAS_MAKE_ERROR_CODE 0 #else #define SYCL_CTS_SUPPORT_HAS_EXCEPTION_CODE 1 #define SYCL_CTS_SUPPORT_HAS_EXCEPTION_CATEGORY 1 -#define SYCL_CTS_SUPPORT_HAS_ERRC_FOR 1 -#define SYCL_CTS_SUPPORT_HAS_ERROR_CATEGORY_FOR 1 #define SYCL_CTS_SUPPORT_HAS_MAKE_ERROR_CODE 1 #endif @@ -131,49 +125,6 @@ struct matcher_equals_exception }; #endif // SYCL_CTS_SUPPORT_HAS_ERRC_ENUM -/** - * Matcher for backend-specific category and error codes - */ -template -class matcher_equals_exception_for - : public Catch::Matchers::MatcherGenericBase { - public: - matcher_equals_exception_for(const CodeT& code_value) - : m_code_value(code_value) {} - - bool match(const sycl::exception& other) const { - -#if (SYCL_CTS_SUPPORT_HAS_EXCEPTION_CODE == 0) || \ - (SYCL_CTS_SUPPORT_HAS_EXCEPTION_CATEGORY == 0) || \ - (SYCL_CTS_SUPPORT_HAS_ERROR_CATEGORY_FOR == 0) - // There should be no compilation failures, but every CHECK_THROWS_MATCHES - // should fail with this matcher - return false; -#else - // Error code is validated by value, with no semantic match - const auto& expected_category = sycl::error_category_for(); - return (other.category() == expected_category) && - (other.code().value() == m_code_value); -#endif - } - - std::string describe() const override { - std::ostringstream result; - result << "has code value " << to_integral(m_code_value); - -#if (SYCL_CTS_SUPPORT_HAS_ERROR_CATEGORY_FOR == 0) - result << " for backend-specific category (not supported)"; -#else - const auto& expected_category = sycl::error_category_for(); - result << " for backend-specific category '" << expected_category().name(); - result << "'"; -#endif - return result.str(); - } - - private: - const CodeT& m_code_value; -}; } // namespace detail /** @@ -202,22 +153,6 @@ inline auto equals_exception(const sycl::errc& code) { } #endif // SYCL_CTS_SUPPORT_HAS_ERRC_ENUM == 1 -/** - * Provides matcher for backend-specific category and error codes - * - * Usage example: - * CHECK_THROWS_MATCHES(action(), sycl::exception, - * equals_exception_for(CL_INVALID_PROGRAM)); - */ -template -inline auto equals_exception_for(const CodeT& code) { -#if SYCL_CTS_SUPPORT_HAS_ERRC_FOR == 1 - static_assert(std::is_same_v> || - std::is_same_v); -#endif - return detail::matcher_equals_exception_for(code); -} - } // namespace sycl_cts::util /**