-
-
Notifications
You must be signed in to change notification settings - Fork 91
Fix warnings in src package #488
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -550,5 +550,3 @@ protected internal virtual Expression VisitRuntimeVariables(RuntimeVariablesExpr | |
|
|
||
| protected internal virtual Expression VisitDebugInfo(DebugInfoExpression node) => node; | ||
| } | ||
|
|
||
| #nullable restore | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not necessary at the end of files, these directives are per-file. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| #nullable disable | ||
|
|
||
| #if DEBUG | ||
| // #define DEBUG_INTERNALS | ||
| #endif | ||
|
|
@@ -7,6 +9,7 @@ | |
| using System.Collections; | ||
| using System.Collections.Generic; | ||
| using System.Diagnostics; | ||
| using System.Globalization; | ||
| using System.Reflection; | ||
| using System.Reflection.Emit; | ||
| using System.Text; | ||
|
|
@@ -613,21 +616,21 @@ public DynamicMethodILProvider(DynamicMethod method) | |
|
|
||
| public static class ILFormatter | ||
| { | ||
| public static StringBuilder Int32ToHex(StringBuilder sb, int int32) => sb.Append(int32.ToString("X8")); | ||
| public static StringBuilder Int16ToHex(StringBuilder sb, int int16) => sb.Append(int16.ToString("X4")); | ||
| public static StringBuilder Int8ToHex(StringBuilder sb, int int8) => sb.Append(int8.ToString("X2")); | ||
| public static StringBuilder Argument(StringBuilder sb, int ordinal) => sb.Append($"V_{ordinal}"); | ||
| public static StringBuilder Label(StringBuilder sb, int offset) => sb.Append($"IL_{offset:D4}"); | ||
| public static StringBuilder Int32ToHex(StringBuilder sb, int int32) => sb.Append(int32.ToString("X8", CultureInfo.InvariantCulture)); | ||
| public static StringBuilder Int16ToHex(StringBuilder sb, int int16) => sb.Append(int16.ToString("X4", CultureInfo.InvariantCulture)); | ||
| public static StringBuilder Int8ToHex(StringBuilder sb, int int8) => sb.Append(int8.ToString("X2", CultureInfo.InvariantCulture)); | ||
| public static StringBuilder Argument(StringBuilder sb, int ordinal) => sb.AppendFormat(CultureInfo.InvariantCulture, "V_{0}", ordinal); | ||
| public static StringBuilder Label(StringBuilder sb, int offset) => sb.AppendFormat(CultureInfo.InvariantCulture, "IL_{0:D4}", offset); | ||
|
|
||
| public static StringBuilder MultipleLabels(StringBuilder sb, int[] offsets) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Warnings could be ignored, but I think it's good to set the culture in case there is a side effect when rendered "technical" values like these. |
||
| { | ||
| var length = offsets.Length; | ||
| for (var i = 0; i < length; i++) | ||
| { | ||
| sb.AppendFormat(i == 0 ? "(" : ", "); | ||
| sb.Append(i == 0 ? "(" : ", "); | ||
| sb.Append(Label(sb, offsets[i])); | ||
| } | ||
| sb.AppendFormat(")"); | ||
| sb.Append(')'); | ||
| return sb; | ||
| } | ||
|
|
||
|
|
@@ -648,9 +651,9 @@ public static StringBuilder EscapedString(StringBuilder sb, string str) | |
| else if (ch == '\"') | ||
| sb.Append("\\\""); | ||
| else if (ch == '\\') | ||
| sb.Append("\\"); | ||
| sb.Append('\\'); | ||
| else if (ch < 0x20 || ch >= 0x7f) | ||
| sb.AppendFormat("\\u{0:x4}", (int)ch); | ||
| sb.AppendFormat(CultureInfo.InvariantCulture, "\\u{0:x4}", (int)ch); | ||
| else | ||
| sb.Append(ch); | ||
| } | ||
|
|
@@ -663,10 +666,10 @@ public static StringBuilder SigByteArrayToString(StringBuilder sb, byte[] sig) | |
| var length = sig.Length; | ||
| for (var i = 0; i < length; i++) | ||
| { | ||
| sb.AppendFormat(i == 0 ? "SIG [" : " "); | ||
| sb.Append(i == 0 ? "SIG [" : " "); | ||
| sb.Append(Int8ToHex(sb, sig[i])); | ||
| } | ||
| sb.AppendFormat("]"); | ||
| sb.Append(']'); | ||
| return sb; | ||
| } | ||
| } | ||
|
|
@@ -820,5 +823,3 @@ public MemberInfo AsMember(int token) | |
|
|
||
| public byte[] AsSignature(int token) => this[token] as byte[]; | ||
| } | ||
|
|
||
| #pragma warning restore CS1591 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| using System; | ||
| #nullable disable | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
|
|
||
| using System; | ||
| using System.Linq; | ||
| using System.Text; | ||
| using System.Reflection; | ||
|
|
@@ -19,6 +21,7 @@ namespace FastExpressionCompiler; | |
|
|
||
| using FastExpressionCompiler.ILDecoder; | ||
| using FastExpressionCompiler.ImTools; | ||
| using System.Globalization; | ||
| using System.Linq.Expressions; | ||
| #endif | ||
|
|
||
|
|
@@ -27,10 +30,10 @@ namespace FastExpressionCompiler; | |
| [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This is used for the testing purposes only.")] | ||
| public static class TestTools | ||
| { | ||
| public static bool AllowPrintIL = false; | ||
| public static bool AllowPrintCS = false; | ||
| public static bool AllowPrintExpression = false; | ||
| public static bool DisableAssertOpCodes = false; | ||
| public static bool AllowPrintIL; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These were valid warnings appearing in my build. Though doesn't matter much in this case. |
||
| public static bool AllowPrintCS; | ||
| public static bool AllowPrintExpression; | ||
| public static bool DisableAssertOpCodes; | ||
|
|
||
| static TestTools() | ||
| { | ||
|
|
@@ -628,9 +631,9 @@ class CallerMemberNameAttribute : Attribute { } | |
| class CallerLineNumberAttribute : Attribute { } | ||
|
|
||
| [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] | ||
| class CallerArgumentExpression : Attribute | ||
| class CallerArgumentExpressionAttribute : Attribute | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There would be a conflict otherwise in internal files in some fwks, it would be conflicted between this and the real ones when it's used later in the code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Funny, that missed it. |
||
| { | ||
| public CallerArgumentExpression(string parameterName) { } | ||
| public CallerArgumentExpressionAttribute(string parameterName) { } | ||
| } | ||
| #endif | ||
|
|
||
|
|
@@ -1060,5 +1063,3 @@ public void Run<T>(T test, TestFlags flags = TestFlags.Default) where T : ITestX | |
| } | ||
| } | ||
| } | ||
|
|
||
| #pragma warning restore CS1591 | ||
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.
This generates the
#pragma warning disablefor each internal files.This way the warnings are not ignored in your standard code, in case you want to see and handle them individually