@@ -39,32 +39,31 @@ class CheckHelper {
39
39
std::ostringstream stream_;
40
40
};
41
41
42
- #define FFI_CHECK (expr ) \
43
- static_assert (!std::is_same_v<decltype (expr), cudaError_t>, \
44
- "Use FFI_CUDA_CHECK for CUDA error codes, not FFI_CHECK."); \
45
- if (!(expr)) \
42
+ #define FFI_CHECK (expr ) \
43
+ static_assert (!std::is_same_v<decltype (expr), cudaError_t>, \
44
+ "Use FFI_CUDA_CHECK for CUDA error codes, not FFI_CHECK."); \
45
+ if (!(expr)) \
46
46
return CheckHelper(#expr)
47
47
48
- #define FFI_CUDA_CHECK (expr ) \
49
- static_assert (std::is_same_v<decltype (expr), cudaError_t>, \
50
- "Expect cudaError_t for FFI_CUDA_CHECK."); \
51
- if (cudaError_t _cuda_check = (expr); _cuda_check != cudaSuccess) \
52
- return CheckHelper(std::string(#expr)) \
53
- << " CUDA Error: " << cudaGetErrorString(_cuda_check)
48
+ #define FFI_CUDA_CHECK (expr ) \
49
+ static_assert (std::is_same_v<decltype (expr), cudaError_t>, \
50
+ "Expect cudaError_t for FFI_CUDA_CHECK."); \
51
+ if (cudaError_t _cuda_check = (expr); _cuda_check != cudaSuccess) \
52
+ return CheckHelper(std::string(#expr)) << " CUDA Error: " << cudaGetErrorString(_cuda_check)
54
53
55
- #define FFI_CHECK_OPTIONAL (dest, expr ) \
56
- if (auto _opt = (expr); _opt.has_value()) \
57
- dest = _opt.value(); \
58
- else \
54
+ #define FFI_CHECK_OPTIONAL (dest, expr ) \
55
+ if (auto _opt = (expr); _opt.has_value()) \
56
+ dest = _opt.value(); \
57
+ else \
59
58
return CheckHelper(std::string(#expr))
60
59
61
- #define FFI_RET_CHECK (expr ) \
62
- if (auto _error = (expr); !_error.success()) \
60
+ #define FFI_RET_CHECK (expr ) \
61
+ if (auto _error = (expr); !_error.success()) \
63
62
return _error
64
63
65
- #define FFI_CHECK_ALLOC (dest, expr ) \
66
- void * dest = nullptr ; \
67
- if (auto _opt = (expr); _opt.has_value()) \
68
- dest = _opt.value(); \
69
- else \
64
+ #define FFI_CHECK_ALLOC (dest, expr ) \
65
+ void * dest = nullptr ; \
66
+ if (auto _opt = (expr); _opt.has_value()) \
67
+ dest = _opt.value(); \
68
+ else \
70
69
return CheckHelper(std::string(#expr))
0 commit comments