Skip to content

Commit 1717ac0

Browse files
Update CRT build to .NET 8.0 (#5814)
1 parent eb024e0 commit 1717ac0

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

stl/inc/yvals.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,10 @@ class _CRTIMP2_PURE_IMPORT _EmptyLockit { // empty lock class used for bin compa
440440
#endif // ^^^ !defined(_M_CEE_PURE) ^^^
441441
#endif // !defined(_PREPARE_CONSTRAINED_REGIONS)
442442

443+
// Note: PrepareConstrainedRegions is not supported in .NET versions 6.0 and later. /clr:pure is
444+
// also not supported in /clr:netcore mode (which targets .NET 8.0 and later), so
445+
// _PREPARE_CONSTRAINED_REGIONS == 0 in that case.
446+
443447
#if _PREPARE_CONSTRAINED_REGIONS
444448
#define _BEGIN_LOCK(_Kind) \
445449
{ \

stl/src/xmtx.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,20 @@
1010
#include <Windows.h>
1111

1212
#ifdef _M_CEE
13+
#if _PREPARE_CONSTRAINED_REGIONS
14+
#define _CRT_SUPPRESS_C4950
15+
#define _CRT_RESTORE_C4950
16+
#else // ^^^ _PREPARE_CONSTRAINED_REGIONS / !_PREPARE_CONSTRAINED_REGIONS vvv
17+
// Constrained regions are obsolete in .NET 6 and above.
18+
#define _CRT_SUPPRESS_C4950 __pragma(warning(push)) _pragma(warning(disable : 4950))
19+
#define _CRT_RESTORE_C4950 __pragma(warning(pop))
20+
#endif // ^^^ !_PREPARE_CONSTRAINED_REGIONS ^^^
1321
#define _RELIABILITY_CONTRACT \
22+
_CRT_SUPPRESS_C4950 \
1423
[System::Runtime::ConstrainedExecution::ReliabilityContract( \
1524
System::Runtime::ConstrainedExecution::Consistency::WillNotCorruptState, \
16-
System::Runtime::ConstrainedExecution::Cer::Success)]
25+
System::Runtime::ConstrainedExecution::Cer::Success)] /**/ \
26+
_CRT_RESTORE_C4950
1727
#else // ^^^ defined(_M_CEE) / !defined(_M_CEE) vvv
1828
#define _RELIABILITY_CONTRACT
1929
#endif // ^^^ !defined(_M_CEE) ^^^

0 commit comments

Comments
 (0)