mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-06 00:03:22 +00:00
Move #ifndef ORT_CXX_API_THROW to the no exceptions case. (#10937)
This is related to https://github.com/microsoft/onnxruntime/issues/10564 which introduced a fix in the wrong case where exceptions are enabled.
This commit is contained in:
parent
a6ea278502
commit
1cc2cfb7b8
1 changed files with 4 additions and 4 deletions
|
|
@ -48,6 +48,9 @@ struct Exception : std::exception {
|
|||
};
|
||||
|
||||
#ifdef ORT_NO_EXCEPTIONS
|
||||
// The #ifndef is for the very special case where the user of this library wants to define their own way of handling errors.
|
||||
// NOTE: This header expects control flow to not continue after calling ORT_CXX_API_THROW
|
||||
#ifndef ORT_CXX_API_THROW
|
||||
#define ORT_CXX_API_THROW(string, code) \
|
||||
do { \
|
||||
std::cerr << Ort::Exception(string, code) \
|
||||
|
|
@ -55,14 +58,11 @@ struct Exception : std::exception {
|
|||
<< std::endl; \
|
||||
abort(); \
|
||||
} while (false)
|
||||
#endif
|
||||
#else
|
||||
// The #ifndef is for the very special case where the user of this library wants to define their own way of handling errors.
|
||||
// NOTE: This header expects control flow to not continue after calling ORT_CXX_API_THROW
|
||||
#ifndef ORT_CXX_API_THROW
|
||||
#define ORT_CXX_API_THROW(string, code) \
|
||||
throw Ort::Exception(string, code)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// This is used internally by the C++ API. This class holds the global variable that points to the OrtApi, it's in a template so that we can define a global variable in a header and make
|
||||
// it transparent to the users of the API.
|
||||
|
|
|
|||
Loading…
Reference in a new issue