Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/error-codes.md4
-rw-r--r--src/linker/Linker/Driver.cs9
-rw-r--r--test/Mono.Linker.Tests.Cases/CommandLine/InvalidArguments.cs15
3 files changed, 21 insertions, 7 deletions
diff --git a/docs/error-codes.md b/docs/error-codes.md
index 5c4a02211..373489d44 100644
--- a/docs/error-codes.md
+++ b/docs/error-codes.md
@@ -55,6 +55,10 @@ error and warning codes.
- Element in 'XML document location' contains a 'featuredefault' attribute with an invalid value. This attribute only supports the true value, to indicate that this is the default behavior for a feature when a value is not given.
+#### `IL1015`: Unrecognized command-line option: 'option'
+
+- The linker was passed a string that was not a linker option.
+
----
## Warning Codes
diff --git a/src/linker/Linker/Driver.cs b/src/linker/Linker/Driver.cs
index b72250775..1a47d1443 100644
--- a/src/linker/Linker/Driver.cs
+++ b/src/linker/Linker/Driver.cs
@@ -145,11 +145,6 @@ namespace Mono.Linker
}
}
- static void ErrorUnrecognizedOption (string optionName)
- {
- Console.WriteLine ($"Unrecognized command-line option: '{optionName}'");
- }
-
static void ErrorMissingArgument (string optionName)
{
Console.WriteLine ($"Missing argument for '{optionName}' option");
@@ -189,7 +184,7 @@ namespace Mono.Linker
while (arguments.Count > 0) {
string token = arguments.Dequeue ();
if (token.Length < 2) {
- ErrorUnrecognizedOption (token);
+ context.LogError ($"Unrecognized command-line option: '{token}'", 1015);
return -1;
}
@@ -563,7 +558,7 @@ namespace Mono.Linker
}
}
- ErrorUnrecognizedOption (token);
+ context.LogError ($"Unrecognized command-line option: '{token}'", 1015);
return -1;
}
diff --git a/test/Mono.Linker.Tests.Cases/CommandLine/InvalidArguments.cs b/test/Mono.Linker.Tests.Cases/CommandLine/InvalidArguments.cs
new file mode 100644
index 000000000..22f21400a
--- /dev/null
+++ b/test/Mono.Linker.Tests.Cases/CommandLine/InvalidArguments.cs
@@ -0,0 +1,15 @@
+using Mono.Linker.Tests.Cases.Expectations.Assertions;
+using Mono.Linker.Tests.Cases.Expectations.Metadata;
+
+namespace Mono.Linker.Tests.Cases.CommandLine
+{
+ [SetupLinkerArgument ("--verbose", "--invalidArgument")]
+ [LogContains ("Unrecognized command-line option")]
+ [NoLinkedOutput]
+ public class InvalidArguments
+ {
+ public static void Main ()
+ {
+ }
+ }
+}