diff --git a/include/onnxruntime/core/framework/tensor_shape.h b/include/onnxruntime/core/framework/tensor_shape.h index 365cbe26c5..92ef4de0d5 100644 --- a/include/onnxruntime/core/framework/tensor_shape.h +++ b/include/onnxruntime/core/framework/tensor_shape.h @@ -26,8 +26,8 @@ class TensorShape { TensorShape(const TensorShape& other) : TensorShape(other.GetDims()) {} TensorShape& operator=(const TensorShape& other); - TensorShape(TensorShape&& other) { operator=(std::move(other)); } - TensorShape& operator=(TensorShape&& other); + TensorShape(TensorShape&& other) noexcept { operator=(std::move(other)); } + TensorShape& operator=(TensorShape&& other) noexcept; TensorShape(gsl::span dims); TensorShape(const std::vector& dims) : TensorShape(gsl::make_span(dims)) {} diff --git a/onnxruntime/core/framework/execution_providers.h b/onnxruntime/core/framework/execution_providers.h index 0fc59f9ab6..7ef12137b7 100644 --- a/onnxruntime/core/framework/execution_providers.h +++ b/onnxruntime/core/framework/execution_providers.h @@ -39,7 +39,7 @@ class ExecutionProviders { exec_provider_options_[provider_id] = p_exec_provider->GetProviderOptions(); exec_provider_ids_.push_back(provider_id); - exec_providers_.push_back(std::move(p_exec_provider)); + exec_providers_.push_back(p_exec_provider); return Status::OK(); } diff --git a/onnxruntime/core/framework/tensor_shape.cc b/onnxruntime/core/framework/tensor_shape.cc index 5ff2175da2..152ca6e1e1 100644 --- a/onnxruntime/core/framework/tensor_shape.cc +++ b/onnxruntime/core/framework/tensor_shape.cc @@ -23,7 +23,7 @@ TensorShape& TensorShape::operator=(const TensorShape& other) { return *this; } -TensorShape& TensorShape::operator=(TensorShape&& other) { +TensorShape& TensorShape::operator=(TensorShape&& other) noexcept { if (&other==this) return *this; diff --git a/onnxruntime/core/providers/common.h b/onnxruntime/core/providers/common.h index 39321f563a..0b9179c0b4 100644 --- a/onnxruntime/core/providers/common.h +++ b/onnxruntime/core/providers/common.h @@ -122,7 +122,7 @@ inline int64_t ComputeOutputShape(const int64_t in_dim, const int64_t stride, const int64_t kernel, const int64_t dilation, const int64_t pad_head, const int64_t pad_tail) { const int64_t dkernel = dilation * (kernel - 1) + 1; - return static_cast(static_cast(in_dim + pad_head + pad_tail - dkernel) / stride + 1); + return static_cast(static_cast(in_dim + pad_head + pad_tail - dkernel) / stride + 1); } inline Status ComputePadAndOutputShape(const int64_t in_dim, diff --git a/onnxruntime/core/providers/cpu/math/einsum_utils/einsum_compute_preprocessor.h b/onnxruntime/core/providers/cpu/math/einsum_utils/einsum_compute_preprocessor.h index 955ff4a920..1ab64b3e8d 100644 --- a/onnxruntime/core/providers/cpu/math/einsum_utils/einsum_compute_preprocessor.h +++ b/onnxruntime/core/providers/cpu/math/einsum_utils/einsum_compute_preprocessor.h @@ -30,11 +30,11 @@ constexpr size_t num_of_letters = 52; */ inline int64_t LetterToIndex(char ch) { if (ch >= 'a' && ch <= 'z') { - return static_cast(ch - 'a'); + return static_cast(ch) - 'a'; } if (ch >= 'A' && ch <= 'Z') { - return 26 + static_cast(ch - 'A'); + return 26 + static_cast(ch) - 'A'; } // invalid character - return error value diff --git a/onnxruntime/core/providers/shared_library/provider_bridge_provider.cc b/onnxruntime/core/providers/shared_library/provider_bridge_provider.cc index e3dbfd1cc2..7752d657f4 100644 --- a/onnxruntime/core/providers/shared_library/provider_bridge_provider.cc +++ b/onnxruntime/core/providers/shared_library/provider_bridge_provider.cc @@ -222,7 +222,7 @@ TensorShape& TensorShape::operator=(const TensorShape& other) { return *this; } -TensorShape& TensorShape::operator=(TensorShape&& other) { +TensorShape& TensorShape::operator=(TensorShape&& other) noexcept { g_host->TensorShape__operator_move_assign(this, std::move(other)); return *this; } diff --git a/onnxruntime/core/providers/shared_library/provider_interfaces.h b/onnxruntime/core/providers/shared_library/provider_interfaces.h index 4f6bcf232a..9735f83408 100644 --- a/onnxruntime/core/providers/shared_library/provider_interfaces.h +++ b/onnxruntime/core/providers/shared_library/provider_interfaces.h @@ -221,7 +221,7 @@ struct ProviderHost { // TensorShape virtual void TensorShape__operator_assign(TensorShape* p, const TensorShape& other) = 0; - virtual void TensorShape__operator_move_assign(TensorShape* p, TensorShape&& other) = 0; + virtual void TensorShape__operator_move_assign(TensorShape* p, TensorShape&& other) noexcept = 0; virtual void TensorShape__Allocate(TensorShape* p, size_t size) = 0; virtual int64_t TensorShape__SizeHelper(const TensorShape* p, size_t start, size_t end) = 0; virtual std::string TensorShape__ToString(const TensorShape* p) = 0; diff --git a/onnxruntime/core/session/inference_session.cc b/onnxruntime/core/session/inference_session.cc index 124a2b57aa..99d99ae0e4 100644 --- a/onnxruntime/core/session/inference_session.cc +++ b/onnxruntime/core/session/inference_session.cc @@ -526,7 +526,7 @@ common::Status InferenceSession::RegisterExecutionProvider(const std::shared_ptr p_exec_provider->SetLogger(session_logger_); session_profiler_.AddEpProfilers(p_exec_provider->GetProfiler()); - return execution_providers_.Add(provider_type, std::move(p_exec_provider)); + return execution_providers_.Add(provider_type, p_exec_provider); } // Custom Op support diff --git a/onnxruntime/core/session/provider_bridge_ort.cc b/onnxruntime/core/session/provider_bridge_ort.cc index 36525126df..d5435bdf44 100644 --- a/onnxruntime/core/session/provider_bridge_ort.cc +++ b/onnxruntime/core/session/provider_bridge_ort.cc @@ -282,7 +282,7 @@ struct ProviderHostImpl : ProviderHost { // TensorShape (direct) void TensorShape__operator_assign(TensorShape* p, const TensorShape& other) override { p->TensorShape::operator=(other); } - void TensorShape__operator_move_assign(TensorShape* p, TensorShape&& other) override { p->TensorShape::operator=(std::move(other)); } + void TensorShape__operator_move_assign(TensorShape* p, TensorShape&& other) noexcept override { p->TensorShape::operator=(std::move(other)); } void TensorShape__Allocate(TensorShape* p, size_t size) override { p->TensorShape::Allocate(size); } int64_t TensorShape__SizeHelper(const TensorShape* p, size_t start, size_t end) override { return p->TensorShape::SizeHelper(start, end); } std::string TensorShape__ToString(const TensorShape* p) override { return p->TensorShape::ToString(); }