diff --git a/include/onnxruntime/core/common/common.h b/include/onnxruntime/core/common/common.h index d411ed2451..7eed4737cd 100644 --- a/include/onnxruntime/core/common/common.h +++ b/include/onnxruntime/core/common/common.h @@ -92,11 +92,10 @@ void LogRuntimeError(uint32_t session_id, const common::Status& status, const ch #endif // Capture where a message is coming from. Use __FUNCTION__ rather than the much longer __PRETTY_FUNCTION__ -#define ORT_WHERE \ - ::onnxruntime::CodeLocation(__FILE__, __LINE__, __FUNCTION__) +#define ORT_WHERE ::onnxruntime::CodeLocation(__FILE__, __LINE__, static_cast(__FUNCTION__)) #define ORT_WHERE_WITH_STACK \ - ::onnxruntime::CodeLocation(__FILE__, __LINE__, __PRETTY_FUNCTION__, ::onnxruntime::GetStackTrace()) + ::onnxruntime::CodeLocation(__FILE__, __LINE__, static_cast(__PRETTY_FUNCTION__), ::onnxruntime::GetStackTrace()) #ifdef ORT_NO_EXCEPTIONS @@ -223,25 +222,25 @@ void LogRuntimeError(uint32_t session_id, const common::Status& status, const ch ORT_DISALLOW_COPY_AND_ASSIGNMENT(TypeName); \ ORT_DISALLOW_MOVE(TypeName) -#define ORT_RETURN_IF_ERROR_SESSIONID(expr, session_id) \ - do { \ - auto _status = (expr); \ - if ((!_status.IsOK())) { \ - ::onnxruntime::LogRuntimeError(session_id, _status, __FILE__, __FUNCTION__, __LINE__); \ - return _status; \ - } \ +#define ORT_RETURN_IF_ERROR_SESSIONID(expr, session_id) \ + do { \ + auto _status = (expr); \ + if ((!_status.IsOK())) { \ + ::onnxruntime::LogRuntimeError(session_id, _status, __FILE__, static_cast(__FUNCTION__), __LINE__); \ + return _status; \ + } \ } while (0) #define ORT_RETURN_IF_ERROR_SESSIONID_(expr) ORT_RETURN_IF_ERROR_SESSIONID(expr, session_id_) #define ORT_RETURN_IF_ERROR(expr) ORT_RETURN_IF_ERROR_SESSIONID(expr, 0) -#define ORT_THROW_IF_ERROR(expr) \ - do { \ - auto _status = (expr); \ - if ((!_status.IsOK())) { \ - ::onnxruntime::LogRuntimeError(0, _status, __FILE__, __FUNCTION__, __LINE__); \ - ORT_THROW(_status); \ - } \ +#define ORT_THROW_IF_ERROR(expr) \ + do { \ + auto _status = (expr); \ + if ((!_status.IsOK())) { \ + ::onnxruntime::LogRuntimeError(0, _status, __FILE__, static_cast(__FUNCTION__), __LINE__); \ + ORT_THROW(_status); \ + } \ } while (0) // use this macro when cannot early return