-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add nowarn option #1324
Add nowarn option #1324
Conversation
src/ILLink.Tasks/LinkTask.cs
Outdated
/// Turns off trim correctness analysis warnings. | ||
/// Maps to '--nowarn 2006;2026;2037;2043'. | ||
/// </summary> | ||
public bool TrimmerAnalysisWarnings { set => _trimmerAnalysisWarnings = value; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regardless of where this should live the name needs to change.
Currently we have "Trim correctness" analysis. In the future I anticipate "Single-file correctness", "AOT correctness" and potentially more. The name must reflect this.
I would probably call it EnableTrimCorrectnessAnalysis
or TrimCorrectnessAnalysis
(whichever fits the current style in SDK better). It would be "false" by default for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that this should live in the SDK only for now, not in the task. For naming, I personally find correctness
a little redundant. What do you think of TrimAnalysis
?
Maybe it would make sense to preemptively open an SDK PR that introduces the option to discuss naming there, and avoid getting caught up in it here? I'm happy to do that if you think it makes sense @vitek-karas @mateoatr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would make sense to preemptively open an SDK PR that introduces the option to discuss naming there, and avoid getting caught up in it here? I'm happy to do that if you think it makes sense @vitek-karas @mateoatr
This sounds good. I'm dropping this property from here then. I think EnableTrimAnalysis
would be a good name, but we can follow up on this conversation in the SDK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sbomer Please prepare the SDK change (you can do that fastest)... EnableTrimAnalysis
sounds good - please include Sam in the discussion on the SDK side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dotnet/sdk#12388 to get the discussion started. I will add tests and such as we go.
@@ -7,6 +7,7 @@ namespace Mono.Linker | |||
public static class MessageSubCategory | |||
{ | |||
public const string None = ""; | |||
public const string TrimCorrectness = "Trim correctness"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for? I don't think this term is broadly understandable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it might not be very informative to all users, but its main purpose is to group all warnings related to trimming analysis. Going forward, if we ever allow subcategory mapping in nowarn
(things like --nowarn trimcorrectness
= --nowarn IL2006;IL2026;IL2043
) it might come handy. What do you think could be a more informative/useful subcategory name/message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think something like "trimalert" for the flag and "Trim alert" for subcategory printing is more readable.
--nowarn trimalert
explains the purpose
Trim alert warning IL2006 : Mono.Linker.Tests....
No warn on correctness sounds like the program warns when is correct and we are disabling it. Also, since it's a broader term sounds like it should have a lot more warnings inside the subcategory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the discussion on the public property - maybe "TrimAnalysis" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think TrimAnalysis
is a good option given that we'll probably have an EnableTrimAnlaysis
property in the SDK. Correctness
is even broader than TrimCorrectness
.
Co-authored-by: Marek Safar <marek.safar@gmail.com>
@@ -7,6 +7,7 @@ namespace Mono.Linker | |||
public static class MessageSubCategory | |||
{ | |||
public const string None = ""; | |||
public const string TrimCorrectness = "Trim correctness"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the discussion on the public property - maybe "TrimAnalysis" ?
Fix NoWarn LinkTask property type
New versions of the linker will emit warnings for code that can be broken by trimming. dotnet/linker#1324 will add support for --nowarn, which we will use to leave them off by default in .NET5 to prevent noise. This change turns them off and adds a new property to let developers opt into the warnings.
New versions of the linker will emit warnings for code that can be broken by trimming. dotnet/linker#1324 will add support for --nowarn, which we will use to leave them off by default in .NET5 to prevent noise. This change turns them off and adds a new property to let developers opt into the warnings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We should update the category name once we agree on the public facing property name for it (so that they match), but that can be done in a separate PR.
New versions of the linker will emit warnings for code that can be broken by trimming. dotnet/linker#1324 will add support for --nowarn, which we will use to leave them off by default in .NET5 to prevent noise. This change turns them off and adds a new property to let developers opt into the warnings.
New versions of the linker will emit warnings for code that can be broken by trimming. dotnet/linker#1324 will add support for --nowarn, which we will use to leave them off by default in .NET5 to prevent noise. This change turns them off and adds a new property to let developers opt into the warnings.
New versions of the linker will emit warnings for code that can be broken by trimming. dotnet/linker#1324 will add support for --nowarn, which we will use to leave them off by default in .NET5 to prevent noise. This change turns them off and adds a new property to let developers opt into the warnings.
New versions of the linker will emit warnings for code that can be broken by trimming. dotnet/linker#1324 will add support for --nowarn, which we will use to leave them off by default in .NET5 to prevent noise. This change turns them off and adds a new property to let developers opt into the warnings.
New versions of the linker will emit warnings for code that can be broken by trimming. dotnet/linker#1324 will add support for --nowarn, which we will use to leave them off by default in .NET5 to prevent noise. This change turns them off and adds a new property to let developers opt into the warnings.
New versions of the linker will emit warnings for code that can be broken by trimming. dotnet/linker#1324 will add support for --nowarn, which we will use to leave them off by default in .NET5 to prevent noise. This change turns them off and adds a new property to let developers opt into the warnings.
* Introduce option to enable trim analysis warnings New versions of the linker will emit warnings for code that can be broken by trimming. dotnet/linker#1324 will add support for --nowarn, which we will use to leave them off by default in .NET5 to prevent noise. This change turns them off and adds a new property to let developers opt into the warnings. * Add tests * Also disable IL2046/IL2047 * Test no warnings for helloworld app * Print error based on exit code * Rename option to SuppressTrimAnalysisWarnings * Fix up tests * Require recent MSBuild in tests * Update warning suppressions * Check for more specific string in tests The full framework MSBuild verbosity was logging --nowarn arguments, causing some of the tests to fail. * Fix error message wording
* Add nowarn option * Allow multiple --nowarn * Add `--nowarn` to docs. * Add NoWarn test for ILLinkTask Commit migrated from dotnet/linker@73dd832
This PR adds the new
--nowarn
option that behaves similarly to the Roslyn option of the same name. The user can turn off warning messages by specifying an ILLinker warning code. Some examples:It also adds a new warning subcategory,
TrimCorrectness
, and a new ILLinkTask property,NoWarn
.This is the set of warnings that will be turned off whenever
TrimmerAnalysisWarnings
is set to true:/cc @agocke @eerhardt