The linker is adding options --nowarn, --warnaserror, and --warn to control warning behavior similar to the Roslyn. We need to pass appropriate MSBuild properties as inputs to these in the SDK.
NoWarn should simply be passed to the linker. It will ignore error codes that don't begin with IL.
WarningsAsErrors/WarningsNotAsErrors similarly should be passed directly to the linker.
TreatWarningsAsErrors should set another linker-specific property (tentatively ILLinkTreatWarningsAsErrors) with the same semantics, which gets passed to the linker. This is to allow the setting to be controlled independently for the linker and the compiler if desired.
AnalysisLevel should set a linker-specific property (tentatively ILLinkWarningVersion), which gets passed to the linker to control warning versions. The linker-specific property is similar to WarningLevel for the compiler (see https://github.com/dotnet/sdk/pull/12422/files). I'm suggesting Version instead of Level because this is more accurate, whereas Roslyn is repurposing an existing option whose meaning used to be different.
The reason I am suggesting ILLink as the prefix rather than Trimmer is that these options are conceptually not specific to trimming - we will use the same properties in the future if we introduce single-file-correctness analysis in the linker.
@samsp-msft again, would appreciate your feedback on the naming.
@vitek-karas @eerhardt
The linker is adding options
--nowarn,--warnaserror, and--warnto control warning behavior similar to the Roslyn. We need to pass appropriate MSBuild properties as inputs to these in the SDK.NoWarnshould simply be passed to the linker. It will ignore error codes that don't begin withIL.WarningsAsErrors/WarningsNotAsErrorssimilarly should be passed directly to the linker.TreatWarningsAsErrorsshould set another linker-specific property (tentativelyILLinkTreatWarningsAsErrors) with the same semantics, which gets passed to the linker. This is to allow the setting to be controlled independently for the linker and the compiler if desired.AnalysisLevelshould set a linker-specific property (tentativelyILLinkWarningVersion), which gets passed to the linker to control warning versions. The linker-specific property is similar toWarningLevelfor the compiler (see https://github.com/dotnet/sdk/pull/12422/files). I'm suggestingVersioninstead ofLevelbecause this is more accurate, whereas Roslyn is repurposing an existing option whose meaning used to be different.The reason I am suggesting
ILLinkas the prefix rather thanTrimmeris that these options are conceptually not specific to trimming - we will use the same properties in the future if we introduce single-file-correctness analysis in the linker.@samsp-msft again, would appreciate your feedback on the naming.
@vitek-karas @eerhardt