From 43617f14485b79609079c55c872ac088e231db3c Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 5 Feb 2015 23:42:30 +0200 Subject: Move OpenCLError::strerror() from sc to opencl, and rename to errorString() There is nothing Calc-specific in this function, and surely it will be good to output OpenCL errors symbolically also in the opencl module. Change-Id: Ibe7d0d036f24dd87e06b8290224e1033dda0f3d1 --- sc/source/core/opencl/opbase.cxx | 62 ++-------------------------------------- sc/source/core/opencl/opbase.hxx | 3 -- 2 files changed, 3 insertions(+), 62 deletions(-) (limited to 'sc') diff --git a/sc/source/core/opencl/opbase.cxx b/sc/source/core/opencl/opbase.cxx index bf3f8d8db487..1c24c12691f7 100644 --- a/sc/source/core/opencl/opbase.cxx +++ b/sc/source/core/opencl/opbase.cxx @@ -7,6 +7,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include + #include "opbase.hxx" using namespace formula; @@ -20,65 +22,7 @@ UnhandledToken::UnhandledToken( OpenCLError::OpenCLError( cl_int err, const std::string& fn, int ln ) : mError(err), mFile(fn), mLineNumber(ln) { - SAL_INFO("sc.opencl", "OpenCLError:" << mError << ": " << strerror(mError)); -} - -const char* OpenCLError::strerror( cl_int i ) const -{ -#define CASE(val) case val: return #val - switch (i) - { - CASE(CL_SUCCESS); - CASE(CL_DEVICE_NOT_FOUND); - CASE(CL_DEVICE_NOT_AVAILABLE); - CASE(CL_COMPILER_NOT_AVAILABLE); - CASE(CL_MEM_OBJECT_ALLOCATION_FAILURE); - CASE(CL_OUT_OF_RESOURCES); - CASE(CL_OUT_OF_HOST_MEMORY); - CASE(CL_PROFILING_INFO_NOT_AVAILABLE); - CASE(CL_MEM_COPY_OVERLAP); - CASE(CL_IMAGE_FORMAT_MISMATCH); - CASE(CL_IMAGE_FORMAT_NOT_SUPPORTED); - CASE(CL_BUILD_PROGRAM_FAILURE); - CASE(CL_MAP_FAILURE); - CASE(CL_INVALID_VALUE); - CASE(CL_INVALID_DEVICE_TYPE); - CASE(CL_INVALID_PLATFORM); - CASE(CL_INVALID_DEVICE); - CASE(CL_INVALID_CONTEXT); - CASE(CL_INVALID_QUEUE_PROPERTIES); - CASE(CL_INVALID_COMMAND_QUEUE); - CASE(CL_INVALID_HOST_PTR); - CASE(CL_INVALID_MEM_OBJECT); - CASE(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR); - CASE(CL_INVALID_IMAGE_SIZE); - CASE(CL_INVALID_SAMPLER); - CASE(CL_INVALID_BINARY); - CASE(CL_INVALID_BUILD_OPTIONS); - CASE(CL_INVALID_PROGRAM); - CASE(CL_INVALID_PROGRAM_EXECUTABLE); - CASE(CL_INVALID_KERNEL_NAME); - CASE(CL_INVALID_KERNEL_DEFINITION); - CASE(CL_INVALID_KERNEL); - CASE(CL_INVALID_ARG_INDEX); - CASE(CL_INVALID_ARG_VALUE); - CASE(CL_INVALID_ARG_SIZE); - CASE(CL_INVALID_KERNEL_ARGS); - CASE(CL_INVALID_WORK_DIMENSION); - CASE(CL_INVALID_WORK_GROUP_SIZE); - CASE(CL_INVALID_WORK_ITEM_SIZE); - CASE(CL_INVALID_GLOBAL_OFFSET); - CASE(CL_INVALID_EVENT_WAIT_LIST); - CASE(CL_INVALID_EVENT); - CASE(CL_INVALID_OPERATION); - CASE(CL_INVALID_GL_OBJECT); - CASE(CL_INVALID_BUFFER_SIZE); - CASE(CL_INVALID_MIP_LEVEL); - CASE(CL_INVALID_GLOBAL_WORK_SIZE); - default: - return "Unknown OpenCL error code"; - } -#undef CASE + SAL_INFO("sc.opencl", "OpenCL error: " << ::opencl::errorString(mError)); } Unhandled::Unhandled( const std::string& fn, int ln ) : diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx index 866d7dda142b..b4c4493869fb 100644 --- a/sc/source/core/opencl/opbase.hxx +++ b/sc/source/core/opencl/opbase.hxx @@ -41,9 +41,6 @@ public: /// Failed in marshaling class OpenCLError { -private: - const char* strerror( cl_int i ) const; - public: OpenCLError( cl_int err, const std::string& fn, int ln ); -- cgit