This is used to either wrap an OpenCL function call, or to explicitly check a variable for an OpenCL error condition. If an error occurs, we throw. Note: std::runtime_error does not take unicode strings as input, so only strings supported
| 244 | // Note: std::runtime_error does not take unicode strings as input, so |
| 245 | // only strings supported |
| 246 | inline cl_int |
| 247 | OpenCL_V_Throw( cl_int res, const std::string& msg, size_t lineno ) |
| 248 | { |
| 249 | switch( res ) |
| 250 | { |
| 251 | case CL_SUCCESS: /**< No error */ |
| 252 | break; |
| 253 | default: |
| 254 | { |
| 255 | std::stringstream tmp; |
| 256 | |
| 257 | tmp << "OPENCL_V_THROWERROR< "; |
| 258 | tmp << prettyPrintClStatus(res) ; |
| 259 | tmp << " > ("; |
| 260 | tmp << lineno; |
| 261 | tmp << "): "; |
| 262 | tmp << msg; |
| 263 | std::string errorm(tmp.str()); |
| 264 | std::cout << errorm<< std::endl; |
| 265 | throw std::runtime_error( errorm ); |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | return res; |
| 270 | } |
| 271 | |
| 272 | #define OPENCL_V_THROW(_status,_message) OpenCL_V_Throw(_status, _message, \ |
| 273 | __LINE__) |
nothing calls this directly
no test coverage detected