From bce577c415984e76f001bffe6da6221c5eeb8bb6 Mon Sep 17 00:00:00 2001 From: danmosemsft Date: Mon, 23 Jan 2017 10:10:54 -0800 Subject: [PATCH] Remove disabled FEATURE_UNSAFE_CONTRACTS Commit migrated from https://github.com/dotnet/coreclr/commit/7d379bccf7967275ff6d96d0cca8c0641857bdfd --- .../src/System/Diagnostics/Contracts/Contracts.cs | 101 --------------------- 1 file changed, 101 deletions(-) diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs index 27f4f4c..e44f936 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs @@ -756,107 +756,6 @@ namespace System.Diagnostics.Contracts { #endregion Quantifiers #region Pointers -#if FEATURE_UNSAFE_CONTRACTS - /// - /// Runtime checking for pointer bounds is not currently feasible. Thus, at runtime, we just return - /// a very long extent for each pointer that is writable. As long as assertions are of the form - /// WritableBytes(ptr) >= ..., the runtime assertions will not fail. - /// The runtime value is 2^64 - 1 or 2^32 - 1. - /// - [SuppressMessage("Microsoft.Performance", "CA1802", Justification = "FxCop is confused")] - static readonly ulong MaxWritableExtent = (UIntPtr.Size == 4) ? UInt32.MaxValue : UInt64.MaxValue; - - /// - /// Allows specifying a writable extent for a UIntPtr, similar to SAL's writable extent. - /// NOTE: this is for static checking only. No useful runtime code can be generated for this - /// at the moment. - /// - /// Start of memory region - /// The result is the number of bytes writable starting at - [CLSCompliant(false)] - [Pure] - [ContractRuntimeIgnored] -#if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#endif - public static ulong WritableBytes(UIntPtr startAddress) { return MaxWritableExtent - startAddress.ToUInt64(); } - - /// - /// Allows specifying a writable extent for a UIntPtr, similar to SAL's writable extent. - /// NOTE: this is for static checking only. No useful runtime code can be generated for this - /// at the moment. - /// - /// Start of memory region - /// The result is the number of bytes writable starting at - [CLSCompliant(false)] - [Pure] - [ContractRuntimeIgnored] -#if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#endif - public static ulong WritableBytes(IntPtr startAddress) { return MaxWritableExtent - (ulong)startAddress; } - - /// - /// Allows specifying a writable extent for a UIntPtr, similar to SAL's writable extent. - /// NOTE: this is for static checking only. No useful runtime code can be generated for this - /// at the moment. - /// - /// Start of memory region - /// The result is the number of bytes writable starting at - [CLSCompliant(false)] - [Pure] - [ContractRuntimeIgnored] -#if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#endif - - unsafe public static ulong WritableBytes(void* startAddress) { return MaxWritableExtent - (ulong)startAddress; } - - /// - /// Allows specifying a readable extent for a UIntPtr, similar to SAL's readable extent. - /// NOTE: this is for static checking only. No useful runtime code can be generated for this - /// at the moment. - /// - /// Start of memory region - /// The result is the number of bytes readable starting at - [CLSCompliant(false)] - [Pure] - [ContractRuntimeIgnored] -#if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#endif - public static ulong ReadableBytes(UIntPtr startAddress) { return MaxWritableExtent - startAddress.ToUInt64(); } - - /// - /// Allows specifying a readable extent for a UIntPtr, similar to SAL's readable extent. - /// NOTE: this is for static checking only. No useful runtime code can be generated for this - /// at the moment. - /// - /// Start of memory region - /// The result is the number of bytes readable starting at - [CLSCompliant(false)] - [Pure] - [ContractRuntimeIgnored] -#if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#endif - public static ulong ReadableBytes(IntPtr startAddress) { return MaxWritableExtent - (ulong)startAddress; } - - /// - /// Allows specifying a readable extent for a UIntPtr, similar to SAL's readable extent. - /// NOTE: this is for static checking only. No useful runtime code can be generated for this - /// at the moment. - /// - /// Start of memory region - /// The result is the number of bytes readable starting at - [CLSCompliant(false)] - [Pure] - [ContractRuntimeIgnored] -#if FEATURE_RELIABILITY_CONTRACTS - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#endif - unsafe public static ulong ReadableBytes(void* startAddress) { return MaxWritableExtent - (ulong)startAddress; } -#endif // FEATURE_UNSAFE_CONTRACTS #endregion #region Misc. -- 2.7.4