diff --git a/Src/ILGPU/Backends/PTX/PTXBackend.cs b/Src/ILGPU/Backends/PTX/PTXBackend.cs
index b9b640462..186521b80 100644
--- a/Src/ILGPU/Backends/PTX/PTXBackend.cs
+++ b/Src/ILGPU/Backends/PTX/PTXBackend.cs
@@ -1,6 +1,6 @@
// ---------------------------------------------------------------------------------------
// ILGPU
-// Copyright (c) 2018-2023 ILGPU Project
+// Copyright (c) 2018-2024 ILGPU Project
// www.ilgpu.net
//
// File: PTXBackend.cs
@@ -305,11 +305,6 @@ protected override CompiledKernel CreateKernel(
ptxAssembly);
}
- [SuppressMessage(
- "Globalization",
- "CA1307:Specify StringComparison",
- Justification = "string.Replace(string, string, StringComparison) not " +
- "available in net471")]
private unsafe void GenerateLibDeviceCode(
in BackendContext backendContext,
StringBuilder builder)
@@ -390,9 +385,12 @@ private unsafe void GenerateLibDeviceCode(
{
var compiledString =
compiledPTX.AsNotNull()
- .Replace(".version", "//.version")
- .Replace(".target", "//.target")
- .Replace(".address_size", "//.address_size");
+ .Replace(".version", "//.version", StringComparison.Ordinal)
+ .Replace(".target", "//.target", StringComparison.Ordinal)
+ .Replace(
+ ".address_size",
+ "//.address_size",
+ StringComparison.Ordinal);
builder.Append(compiledString);
}
}
diff --git a/Src/ILGPU/Backends/PTX/PTXCodeGenerator.Values.cs b/Src/ILGPU/Backends/PTX/PTXCodeGenerator.Values.cs
index 3b65524c0..b7e121cf3 100644
--- a/Src/ILGPU/Backends/PTX/PTXCodeGenerator.Values.cs
+++ b/Src/ILGPU/Backends/PTX/PTXCodeGenerator.Values.cs
@@ -1,6 +1,6 @@
// ---------------------------------------------------------------------------------------
// ILGPU
-// Copyright (c) 2018-2023 ILGPU Project
+// Copyright (c) 2018-2024 ILGPU Project
// www.ilgpu.net
//
// File: PTXCodeGenerator.Values.cs
@@ -1240,11 +1240,6 @@ public void GenerateCode(WriteToOutput writeToOutput) =>
writeToOutput.Assert(false);
///
- [SuppressMessage(
- "Globalization",
- "CA1307:Specify StringComparison",
- Justification = "string.Replace(string, string, StringComparison) not " +
- "available in net471")]
public void GenerateCode(LanguageEmitValue emit)
{
// Ignore non-PTX instructions.
diff --git a/Src/ILGPU/Frontend/DebugInformation/LocalVariable.cs b/Src/ILGPU/Frontend/DebugInformation/LocalVariable.cs
index e711cf390..1ee216530 100644
--- a/Src/ILGPU/Frontend/DebugInformation/LocalVariable.cs
+++ b/Src/ILGPU/Frontend/DebugInformation/LocalVariable.cs
@@ -1,6 +1,6 @@
// ---------------------------------------------------------------------------------------
// ILGPU
-// Copyright (c) 2018-2023 ILGPU Project
+// Copyright (c) 2018-2024 ILGPU Project
// www.ilgpu.net
//
// File: LocalVariable.cs
@@ -80,12 +80,8 @@ public override bool Equals(object? obj) =>
/// Returns the hash code of this index.
///
/// The hash code of this index.
- [SuppressMessage(
- "Globalization",
- "CA1307:Specify StringComparison",
- Justification = "string.GetHashCode(StringComparison) not " +
- "available in net471")]
- public override int GetHashCode() => Index.GetHashCode() ^ Name.GetHashCode();
+ public override int GetHashCode() =>
+ Index.GetHashCode() ^ Name.GetHashCode(StringComparison.Ordinal);
///
/// Returns the string representation of this local variable.
diff --git a/Src/ILGPU/IR/MethodHandle.cs b/Src/ILGPU/IR/MethodHandle.cs
index 6e41e515f..e8450ddba 100644
--- a/Src/ILGPU/IR/MethodHandle.cs
+++ b/Src/ILGPU/IR/MethodHandle.cs
@@ -1,6 +1,6 @@
// ---------------------------------------------------------------------------------------
// ILGPU
-// Copyright (c) 2018-2023 ILGPU Project
+// Copyright (c) 2018-2024 ILGPU Project
// www.ilgpu.net
//
// File: MethodHandle.cs
@@ -129,13 +129,8 @@ public override bool Equals(object? obj) =>
/// Returns the hash code of this handle.
///
/// The hash code of this handle.
- [SuppressMessage(
- "Globalization",
- "CA1307:Specify StringComparison",
- Justification = "string.GetHashCode(StringComparison) not " +
- "available in net471")]
public override int GetHashCode() =>
- Id.GetHashCode() ^ Name?.GetHashCode() ?? 0;
+ Id.GetHashCode() ^ Name?.GetHashCode(StringComparison.Ordinal) ?? 0;
///
/// Returns the string representation of this handle.
diff --git a/Src/ILGPU/IR/Values/IOValues.cs b/Src/ILGPU/IR/Values/IOValues.cs
index 2a98bd7d0..2be6dd007 100644
--- a/Src/ILGPU/IR/Values/IOValues.cs
+++ b/Src/ILGPU/IR/Values/IOValues.cs
@@ -1,6 +1,6 @@
// ---------------------------------------------------------------------------------------
// ILGPU
-// Copyright (c) 2020-2023 ILGPU Project
+// Copyright (c) 2020-2024 ILGPU Project
// www.ilgpu.net
//
// File: IOValues.cs
@@ -21,8 +21,6 @@
ILGPU.Util.FormatString.FormatExpression>;
using ValueList = ILGPU.Util.InlineList;
-#pragma warning disable CA1307 // Specify StringComparison for clarity
-
namespace ILGPU.IR.Values
{
///
@@ -300,7 +298,8 @@ public string ToPrintFExpression()
result.Append(
expression.String.AsNotNull().Replace(
"%",
- PrintFPercentFormat));
+ PrintFPercentFormat,
+ StringComparison.Ordinal));
}
}
return result.ToString();
@@ -311,11 +310,11 @@ public string ToPrintFExpression()
///
public string ToEscapedPrintFExpression() =>
ToPrintFExpression()
- .Replace("\t", @"\t")
- .Replace("\r", @"\r")
- .Replace("\n", @"\n")
- .Replace("\"", "\\\"")
- .Replace("\\", @"\\");
+ .Replace("\t", @"\t", StringComparison.Ordinal)
+ .Replace("\r", @"\r", StringComparison.Ordinal)
+ .Replace("\n", @"\n", StringComparison.Ordinal)
+ .Replace("\"", "\\\"", StringComparison.Ordinal)
+ .Replace("\\", @"\\", StringComparison.Ordinal);
#endregion
@@ -329,11 +328,10 @@ public string ToEscapedPrintFExpression() =>
protected override string ToArgString() =>
ToPrintFExpression().Replace(
Environment.NewLine,
- string.Empty) +
+ string.Empty,
+ StringComparison.Ordinal) +
" " + base.ToArgString();
#endregion
}
}
-
-#pragma warning restore CA1307 // Specify StringComparison for clarity
diff --git a/Src/ILGPU/IR/Values/LanguageValues.cs b/Src/ILGPU/IR/Values/LanguageValues.cs
index 04e23e0fa..1b489c5a8 100644
--- a/Src/ILGPU/IR/Values/LanguageValues.cs
+++ b/Src/ILGPU/IR/Values/LanguageValues.cs
@@ -1,6 +1,6 @@
// ---------------------------------------------------------------------------------------
// ILGPU
-// Copyright (c) 2021-2022 ILGPU Project
+// Copyright (c) 2021-2024 ILGPU Project
// www.ilgpu.net
//
// File: LanguageValues.cs
@@ -176,15 +176,11 @@ protected internal override Value Rebuild(
protected override string ToPrefixString() => "emit";
///
- [SuppressMessage(
- "Globalization",
- "CA1307:Specify StringComparison",
- Justification = "string.Replace(string, string, StringComparison) not " +
- "available in net471")]
protected override string ToArgString() =>
ToStringExpression().Replace(
Environment.NewLine,
- string.Empty) +
+ string.Empty,
+ StringComparison.Ordinal) +
" " + base.ToArgString();
///
diff --git a/Src/ILGPU/Runtime/OpenCL/CLDevice.cs b/Src/ILGPU/Runtime/OpenCL/CLDevice.cs
index 29a4ccb58..c25037c76 100644
--- a/Src/ILGPU/Runtime/OpenCL/CLDevice.cs
+++ b/Src/ILGPU/Runtime/OpenCL/CLDevice.cs
@@ -1,6 +1,6 @@
// ---------------------------------------------------------------------------------------
// ILGPU
-// Copyright (c) 2021-2023 ILGPU Project
+// Copyright (c) 2021-2024 ILGPU Project
// www.ilgpu.net
//
// File: CLDevice.cs
@@ -318,11 +318,6 @@ private void InitGridInfo()
///
/// Init vendor-specific features.
///
- [SuppressMessage(
- "Globalization",
- "CA1307:Specify StringComparison",
- Justification = "string.GetHashCode(StringComparison) not " +
- "available in net471")]
[MemberNotNull(nameof(VendorName))]
private void InitVendorAndWarpSizeInfo()
{
@@ -360,9 +355,11 @@ private void InitVendorAndWarpSizeInfo()
}
else
{
- Vendor = VendorName.Contains(CLDeviceVendor.Intel.ToString()) ?
- CLDeviceVendor.Intel :
- CLDeviceVendor.Other;
+ Vendor = VendorName.Contains(
+ CLDeviceVendor.Intel.ToString(),
+ StringComparison.Ordinal)
+ ? CLDeviceVendor.Intel
+ : CLDeviceVendor.Other;
// Warp size cannot be resolve at this point
WarpSize = 0;