Skip to content

Commit

Permalink
add noexcept to InitApi() and GetApi()
Browse files Browse the repository at this point in the history
  • Loading branch information
diablodale committed Feb 10, 2023
1 parent 9bd022b commit 124c865
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/onnxruntime/core/session/onnxruntime_cxx_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct Global {
template <typename T>
#ifdef ORT_API_MANUAL_INIT
const OrtApi* Global<T>::api_{};
inline void InitApi() { Global<void>::api_ = OrtGetApiBase()->GetApi(ORT_API_VERSION); }
inline void InitApi() noexcept { Global<void>::api_ = OrtGetApiBase()->GetApi(ORT_API_VERSION); }

// Used by custom operator libraries that are not linked to onnxruntime. Sets the global API object, which is
// required by C++ APIs.
Expand All @@ -103,7 +103,7 @@ inline void InitApi() { Global<void>::api_ = OrtGetApiBase()->GetApi(ORT_API_VER
// // ...
// }
//
inline void InitApi(const OrtApi* api) { Global<void>::api_ = api; }
inline void InitApi(const OrtApi* api) noexcept { Global<void>::api_ = api; }
#else
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(push)
Expand All @@ -118,7 +118,7 @@ const OrtApi* Global<T>::api_ = OrtGetApiBase()->GetApi(ORT_API_VERSION);
#endif

/// This returns a reference to the OrtApi interface in use
inline const OrtApi& GetApi() { return *Global<void>::api_; }
inline const OrtApi& GetApi() noexcept { return *Global<void>::api_; }

/// <summary>
/// This is a C++ wrapper for OrtApi::GetAvailableProviders() and
Expand Down Expand Up @@ -580,7 +580,7 @@ struct SessionOptionsImpl : ConstSessionOptionsImpl<T> {
///< Wraps OrtApi::SessionOptionsAppendExecutionProvider_CANN
SessionOptionsImpl& AppendExecutionProvider_CANN(const OrtCANNProviderOptions& provider_options);
///< Wraps OrtApi::SessionOptionsAppendExecutionProvider_Dnnl
SessionOptionsImpl& AppendExecutionProvider_Dnnl(const OrtDnnlProviderOptions& provider_options);
SessionOptionsImpl& AppendExecutionProvider_Dnnl(const OrtDnnlProviderOptions& provider_options);
/// Wraps OrtApi::SessionOptionsAppendExecutionProvider. Currently supports SNPE and XNNPACK.
SessionOptionsImpl& AppendExecutionProvider(const std::string& provider_name,
const std::unordered_map<std::string, std::string>& provider_options = {});
Expand Down

0 comments on commit 124c865

Please sign in to comment.