From 6415972f51765f3b3eff05b4c8ff6c886d6703cd Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 2 Aug 2022 20:34:07 +0200 Subject: [PATCH] Minor fixes to polyfills --- .../MemberNotNullAttribute.cs | 5 ++- .../CompilerServices/IsExternalInit.cs | 5 ++- .../UnmanagedCallersOnlyAttribute.cs | 9 ++++-- .../Runtime/Versioning/OSPlatformAttribute.cs | 5 ++- .../Versioning/SupportedOSVersionAttribute.cs | 32 +++++++++++-------- 5 files changed, 36 insertions(+), 20 deletions(-) diff --git a/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/MemberNotNullAttribute.cs b/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/MemberNotNullAttribute.cs index 5659d922..7c3bade3 100644 --- a/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/MemberNotNullAttribute.cs +++ b/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/MemberNotNullAttribute.cs @@ -1,4 +1,7 @@ -namespace System.Diagnostics.CodeAnalysis; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Diagnostics.CodeAnalysis; /// /// Specifies that the method or property will ensure that the listed field and property members have not-null values. diff --git a/src/ComputeSharp.NetStandard/System/Runtime/CompilerServices/IsExternalInit.cs b/src/ComputeSharp.NetStandard/System/Runtime/CompilerServices/IsExternalInit.cs index a914bf06..775f605a 100644 --- a/src/ComputeSharp.NetStandard/System/Runtime/CompilerServices/IsExternalInit.cs +++ b/src/ComputeSharp.NetStandard/System/Runtime/CompilerServices/IsExternalInit.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.ComponentModel; namespace System.Runtime.CompilerServices; diff --git a/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/UnmanagedCallersOnlyAttribute.cs b/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/UnmanagedCallersOnlyAttribute.cs index c9cbc8f0..b35b322b 100644 --- a/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/UnmanagedCallersOnlyAttribute.cs +++ b/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/UnmanagedCallersOnlyAttribute.cs @@ -1,6 +1,9 @@ -using System; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. -namespace ComputeSharp.NetStandard.System.Runtime.InteropServices; +using System; + +namespace ComputeSharp.NetStandard.System.Runtime.InteropServices; // This cannot be in System.Runtime.InteropServices, or Roslyn will recognize it /// /// Any method marked with can be directly called from native code. @@ -9,6 +12,6 @@ namespace ComputeSharp.NetStandard.System.Runtime.InteropServices; /// This polyfill is deliberately in the wrong namespace to avoid the C# compiler failing to build below .NET 5. /// [AttributeUsage(AttributeTargets.Method, Inherited = false)] -public sealed class UnmanagedCallersOnlyAttribute : Attribute +internal sealed class UnmanagedCallersOnlyAttribute : Attribute { } \ No newline at end of file diff --git a/src/ComputeSharp.NetStandard/System/Runtime/Versioning/OSPlatformAttribute.cs b/src/ComputeSharp.NetStandard/System/Runtime/Versioning/OSPlatformAttribute.cs index 2cf0bc16..ad3bf2ff 100644 --- a/src/ComputeSharp.NetStandard/System/Runtime/Versioning/OSPlatformAttribute.cs +++ b/src/ComputeSharp.NetStandard/System/Runtime/Versioning/OSPlatformAttribute.cs @@ -1,4 +1,7 @@ -namespace System.Runtime.Versioning; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Runtime.Versioning; /// /// Base type for all platform-specific API attributes. diff --git a/src/ComputeSharp.NetStandard/System/Runtime/Versioning/SupportedOSVersionAttribute.cs b/src/ComputeSharp.NetStandard/System/Runtime/Versioning/SupportedOSVersionAttribute.cs index 9e829f55..3cc8bf1d 100644 --- a/src/ComputeSharp.NetStandard/System/Runtime/Versioning/SupportedOSVersionAttribute.cs +++ b/src/ComputeSharp.NetStandard/System/Runtime/Versioning/SupportedOSVersionAttribute.cs @@ -1,4 +1,7 @@ -namespace System.Runtime.Versioning; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Runtime.Versioning; /// /// Records the operating system (and minimum version) that supports an API. Multiple @@ -9,19 +12,20 @@ /// or use guards to prevent calls to APIs on unsupported operating systems. /// A given platform should only be specified once. /// -[AttributeUsage(AttributeTargets.Assembly | - AttributeTargets.Class | - AttributeTargets.Constructor | - AttributeTargets.Enum | - AttributeTargets.Event | - AttributeTargets.Field | - AttributeTargets.Interface | - AttributeTargets.Method | - AttributeTargets.Module | - AttributeTargets.Property | - AttributeTargets.Struct, - AllowMultiple = true, - Inherited = false)] +[AttributeUsage( + AttributeTargets.Assembly | + AttributeTargets.Class | + AttributeTargets.Constructor | + AttributeTargets.Enum | + AttributeTargets.Event | + AttributeTargets.Field | + AttributeTargets.Interface | + AttributeTargets.Method | + AttributeTargets.Module | + AttributeTargets.Property | + AttributeTargets.Struct, + AllowMultiple = true, + Inherited = false)] internal sealed class SupportedOSPlatformAttribute : OSPlatformAttribute { public SupportedOSPlatformAttribute(string platformName)