Skip to content

Commit

Permalink
remove gsl to make status.h independent from gsl (#17402)
Browse files Browse the repository at this point in the history
### Description
<!-- Describe your changes. -->
Make status.h independent from gsl.


### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
In the coming new feature external EP API (see the prototype
#16718), we need to expose
stream in the public header, however, stream is dependent on status.h
which is dependent on gsl. We are seeking a way to decouple stream from
gsl.

From Changming's comment offline, prefast is disabled so all
GSL_SUPPRESS are not taking any effect now. He will handle the warnings
when enable prefast in the future
  • Loading branch information
jslhcl authored Sep 14, 2023
1 parent 03b56f7 commit 32f5658
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 3 deletions.
3 changes: 0 additions & 3 deletions include/onnxruntime/core/common/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ limitations under the License.
#ifdef _WIN32
#include <winerror.h>
#endif
#include "core/common/gsl.h"
namespace onnxruntime {
namespace common {

Expand Down Expand Up @@ -121,10 +120,8 @@ class [[nodiscard]] Status {

Status(StatusCategory category, int code);

GSL_SUPPRESS(r.11)
Status(const Status& other)
: state_((other.state_ == nullptr) ? nullptr : new State(*other.state_)) {}
GSL_SUPPRESS(r.11)
Status& operator=(const Status& other) {
if (state_ != other.state_) {
if (other.state_ == nullptr) {
Expand Down
1 change: 1 addition & 0 deletions onnxruntime/core/framework/tuning_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once

#include <array>
#include <unordered_map>

#include "core/common/common.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "core/providers/dml/DmlExecutionProvider/inc/MLOperatorAuthor.h"
#include "MLOperatorAuthorPrivate.h"
#include "core/common/gsl.h"

#ifdef ORT_NO_EXCEPTIONS
#define ML_CHECK_BOOL(x) ORT_THROW_HR_IF(E_INVALIDARG, !(x))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "core/common/inlined_containers.h"
#include "core/graph/basic_types.h"
#include "core/providers/nnapi/nnapi_builtin/nnapi_lib/NeuralNetworksTypes.h"
#include "core/common/gsl.h"

// This is the minimal Android API Level required by ORT NNAPI EP to run
// ORT running on any host system with Android API level less than this will fall back to CPU EP
Expand Down
1 change: 1 addition & 0 deletions winml/lib/Api.Ort/OnnxruntimeEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "iengine.h"
#include "UniqueOrtPtr.h"
#include "core/common/gsl.h"

#include <memory>
#include <mutex>
Expand Down

0 comments on commit 32f5658

Please sign in to comment.