Skip to content

Update microsoft_gsl dependency to pick up GSL_SUPPRESS fix (C4875 deprecation in VC++ 18.6.0) #28500

@rvandermeulen

Description

@rvandermeulen

Describe the issue

cmake/deps.txt pins microsoft_gsl to v4.0.0, whose GSL_SUPPRESS macro expands to a [[gsl::suppress(<identifier>)]] attribute with a non-string-literal argument. Visual C++ 18.6.0 deprecates that form and emits warning C4875:

include/onnxruntime/core/common/logging/capture.h(80): warning C4875: a non-string literal argument to [[gsl::suppress]] is deprecated and will be removed in a future release.

The warning fires on every translation unit that transitively includes core/common/logging/capture.h or core/common/narrow.h, which is essentially every file in the build. When MSVC follows through and removes the form, this will break the build outright.

Upstream microsoft/GSL has already fixed this

microsoft/GSL@543d0dd ("export proper syntax for GSL_SUPPRESS for new VS", PR #1213) updates the macro to stringify its argument via #x for clang and newer MSVC:

#define GSL_SUPPRESS(x) [[gsl::suppress(#x)]]

That fix is available in GSL v4.1.0 (October 2024) and later. The current latest is v4.2.1 (December 2025).

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions