diff --git a/eng/testing/tests.singlefile.targets b/eng/testing/tests.singlefile.targets
index 86a8b98d545f8..d307e837e6235 100644
--- a/eng/testing/tests.singlefile.targets
+++ b/eng/testing/tests.singlefile.targets
@@ -26,48 +26,13 @@
$(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll
$(CoreCLRAotSdkDir)
$(NetCoreAppCurrentTestHostSharedFrameworkPath)
- $(NoWarn);IL3050;IL3051;IL3052;IL3054;IL3055;IL1005;IL3002
+ $(NoWarn);IL1005;IL3002
partial
- false
true
+ true
true
-
-
-
- $(NoWarn);IL2026;IL2116
-
- $(NoWarn);IL2041;IL2042;IL2043;IL2056
-
- $(NoWarn);IL2045
-
- $(NoWarn);IL2046
-
- $(NoWarn);IL2050
-
- $(NoWarn);IL2032;IL2055;IL2057;IL2058;IL2059;IL2060;IL2061;IL2096
-
- $(NoWarn);IL2062;IL2063;IL2064;IL2065;IL2066
-
- $(NoWarn);IL2067;IL2068;IL2069;IL2070;IL2071;IL2072;IL2073;IL2074;IL2075;IL2076;IL2077;IL2078;IL2079;IL2080;IL2081;IL2082;IL2083;IL2084;IL2085;IL2086;IL2087;IL2088;IL2089;IL2090;IL2091
-
- $(NoWarn);IL2092;IL2093;IL2094;IL2095
-
- $(NoWarn);IL2097;IL2098;IL2099;IL2106
-
- $(NoWarn);IL2103
-
- $(NoWarn);IL2107;IL2117
-
- $(NoWarn);IL2109
-
- $(NoWarn);IL2110;IL2111;IL2114;IL2115
-
- $(NoWarn);IL2112;IL2113
-
- $(NoWarn);IL2118;IL2119;IL2120
-
diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
index 690ef724af07e..417d4567a9518 100644
--- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
+++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
@@ -49,6 +49,10 @@ The .NET Foundation licenses this file to you under the MIT license.
false
+
+ false
+
+
.obj
.o
@@ -241,6 +245,8 @@ The .NET Foundation licenses this file to you under the MIT license.
+
+
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logger.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logger.cs
index 0482731b0432b..fac33d4b58cbc 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logger.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logger.cs
@@ -26,6 +26,7 @@ public class Logger
private readonly CompilerGeneratedState _compilerGeneratedState;
private readonly HashSet _suppressedWarnings;
+ private readonly HashSet _suppressedCategories;
private readonly bool _isSingleWarn;
private readonly HashSet _singleWarnEnabledAssemblies;
@@ -44,7 +45,8 @@ public Logger(
IEnumerable suppressedWarnings,
bool singleWarn,
IEnumerable singleWarnEnabledModules,
- IEnumerable singleWarnDisabledModules)
+ IEnumerable singleWarnDisabledModules,
+ IEnumerable suppressedCategories)
{
_logWriter = writer;
_compilerGeneratedState = ilProvider == null ? null : new CompilerGeneratedState(ilProvider, this);
@@ -53,15 +55,16 @@ public Logger(
_isSingleWarn = singleWarn;
_singleWarnEnabledAssemblies = new HashSet(singleWarnEnabledModules, StringComparer.OrdinalIgnoreCase);
_singleWarnDisabledAssemblies = new HashSet(singleWarnDisabledModules, StringComparer.OrdinalIgnoreCase);
+ _suppressedCategories = new HashSet(suppressedCategories, StringComparer.Ordinal);
}
- public Logger(TextWriter writer, ILProvider ilProvider, bool isVerbose, IEnumerable suppressedWarnings, bool singleWarn, IEnumerable singleWarnEnabledModules, IEnumerable singleWarnDisabledModules)
- : this(new TextLogWriter(writer), ilProvider, isVerbose, suppressedWarnings, singleWarn, singleWarnEnabledModules, singleWarnDisabledModules)
+ public Logger(TextWriter writer, ILProvider ilProvider, bool isVerbose, IEnumerable suppressedWarnings, bool singleWarn, IEnumerable singleWarnEnabledModules, IEnumerable singleWarnDisabledModules, IEnumerable suppressedCategories)
+ : this(new TextLogWriter(writer), ilProvider, isVerbose, suppressedWarnings, singleWarn, singleWarnEnabledModules, singleWarnDisabledModules, suppressedCategories)
{
}
public Logger(ILogWriter writer, ILProvider ilProvider, bool isVerbose)
- : this(writer, ilProvider, isVerbose, Array.Empty(), singleWarn: false, Array.Empty(), Array.Empty())
+ : this(writer, ilProvider, isVerbose, Array.Empty(), singleWarn: false, Array.Empty(), Array.Empty(), Array.Empty())
{
}
@@ -141,6 +144,8 @@ public void LogError(string text, int code, TypeSystemEntity origin, string subc
public void LogError(TypeSystemEntity origin, DiagnosticId id, params string[] args) =>
LogError(new MessageOrigin(origin), id, args);
+ internal bool IsWarningSubcategorySuppressed(string category) => _suppressedCategories.Contains(category);
+
internal bool IsWarningSuppressed(int code, MessageOrigin origin)
{
// This is causing too much noise
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logging/MessageContainer.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logging/MessageContainer.cs
index 25d849a46dee0..8f6e4f33efd2f 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logging/MessageContainer.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logging/MessageContainer.cs
@@ -125,6 +125,9 @@ internal static MessageContainer CreateErrorMessage(MessageOrigin? origin, Diagn
if (context.IsWarningSuppressed(code, origin))
return null;
+ if (context.IsWarningSubcategorySuppressed(subcategory))
+ return null;
+
if (TryLogSingleWarning(context, code, origin, subcategory))
return null;
@@ -139,6 +142,9 @@ internal static MessageContainer CreateErrorMessage(MessageOrigin? origin, Diagn
if (context.IsWarningSuppressed((int)id, origin))
return null;
+ if (context.IsWarningSubcategorySuppressed(subcategory))
+ return null;
+
if (TryLogSingleWarning(context, (int)id, origin, subcategory))
return null;
diff --git a/src/coreclr/tools/aot/ILCompiler/Program.cs b/src/coreclr/tools/aot/ILCompiler/Program.cs
index f33053fc898f1..f3c064835d8bf 100644
--- a/src/coreclr/tools/aot/ILCompiler/Program.cs
+++ b/src/coreclr/tools/aot/ILCompiler/Program.cs
@@ -15,9 +15,11 @@
using Internal.CommandLine;
+using ILCompiler.Dataflow;
+using ILLink.Shared;
+
using Debug = System.Diagnostics.Debug;
using InstructionSet = Internal.JitInterface.InstructionSet;
-using ILCompiler.Dataflow;
namespace ILCompiler
{
@@ -103,6 +105,8 @@ internal class Program
private IReadOnlyList _singleWarnEnabledAssemblies = Array.Empty();
private IReadOnlyList _singleWarnDisabledAssemblies = Array.Empty();
private bool _singleWarn;
+ private bool _noTrimWarn;
+ private bool _noAotWarn;
private string _makeReproPath;
@@ -228,6 +232,8 @@ private ArgumentSyntax ParseCommandLine(string[] args)
syntax.DefineOption("nopreinitstatics", ref _noPreinitStatics, "Do not interpret static constructors at compile time");
syntax.DefineOptionList("nowarn", ref _suppressedWarnings, "Disable specific warning messages");
syntax.DefineOption("singlewarn", ref _singleWarn, "Generate single AOT/trimming warning per assembly");
+ syntax.DefineOption("notrimwarn", ref _noTrimWarn, "Disable warnings related to trimming");
+ syntax.DefineOption("noaotwarn", ref _noAotWarn, "Disable warnings related to AOT");
syntax.DefineOptionList("singlewarnassembly", ref _singleWarnEnabledAssemblies, "Generate single AOT/trimming warning for given assembly");
syntax.DefineOptionList("nosinglewarnassembly", ref _singleWarnDisabledAssemblies, "Expand AOT/trimming warnings for given assembly");
syntax.DefineOptionList("directpinvoke", ref _directPInvokes, "PInvoke to call directly");
@@ -768,7 +774,13 @@ static string ILLinkify(string rootedAssembly)
}
ilProvider = new FeatureSwitchManager(ilProvider, featureSwitches);
- var logger = new Logger(Console.Out, ilProvider, _isVerbose, ProcessWarningCodes(_suppressedWarnings), _singleWarn, _singleWarnEnabledAssemblies, _singleWarnDisabledAssemblies);
+ var suppressedWarningCategories = new List();
+ if (_noTrimWarn)
+ suppressedWarningCategories.Add(MessageSubCategory.TrimAnalysis);
+ if (_noAotWarn)
+ suppressedWarningCategories.Add(MessageSubCategory.AotAnalysis);
+
+ var logger = new Logger(Console.Out, ilProvider, _isVerbose, ProcessWarningCodes(_suppressedWarnings), _singleWarn, _singleWarnEnabledAssemblies, _singleWarnDisabledAssemblies, suppressedWarningCategories);
CompilerGeneratedState compilerGeneratedState = new CompilerGeneratedState(ilProvider, logger);
var stackTracePolicy = _emitStackTraceData ?