remove gsl to make status.h independent from gsl (#17402)

### 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
https://github.com/microsoft/onnxruntime/pull/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
This commit is contained in:
cao lei 2023-09-13 21:47:43 -07:00 committed by GitHub
parent 03b56f7a73
commit 32f5658abb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 3 deletions

View file

@ -19,7 +19,6 @@ limitations under the License.
#ifdef _WIN32
#include <winerror.h>
#endif
#include "core/common/gsl.h"
namespace onnxruntime {
namespace common {
@ -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) {

View file

@ -3,6 +3,7 @@
#pragma once
#include <array>
#include <unordered_map>
#include "core/common/common.h"

View file

@ -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))

View file

@ -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

View file

@ -3,6 +3,7 @@
#include "iengine.h"
#include "UniqueOrtPtr.h"
#include "core/common/gsl.h"
#include <memory>
#include <mutex>