Added ikvmc -warnaserror option (which turns all warnings into errors, as opposed to the already existing option -warnaserror: to turn specific warnings into errors).

This commit is contained in:
jfrijters 2011-06-28 06:02:11 +00:00
Родитель 1e3a90329d
Коммит 07149f2daf
2 изменённых файлов: 13 добавлений и 3 удалений

Просмотреть файл

@ -330,8 +330,8 @@ class IkvmcCompiler
Console.Error.WriteLine(" -privatepackage:<prefix> Mark all classes with a package name starting");
Console.Error.WriteLine(" with <prefix> as internal to the assembly");
Console.Error.WriteLine(" -nowarn:<warning[:key]> Suppress specified warnings");
Console.Error.WriteLine(" -warnaserror:<warning[:key]>");
Console.Error.WriteLine(" Treat specified warnings as errors");
Console.Error.WriteLine(" -warnaserror[:<warning[:key]>]");
Console.Error.WriteLine(" Treat (specified) warnings as errors");
Console.Error.WriteLine(" -writeSuppressWarningsFile:<file>");
Console.Error.WriteLine(" Write response file with -nowarn:<warning[:key]>");
Console.Error.WriteLine(" options to suppress all encountered warnings");
@ -699,6 +699,10 @@ class IkvmcCompiler
options.suppressWarnings[ws] = ws;
}
}
else if(s == "-warnaserror")
{
options.warnaserror = true;
}
else if(s.StartsWith("-warnaserror:"))
{
foreach(string w in s.Substring(13).Split(','))

Просмотреть файл

@ -3318,7 +3318,8 @@ namespace IKVM.Internal
internal long baseAddress;
internal List<CompilerClassLoader> sharedclassloader; // should *not* be deep copied in Copy(), because we want the list of all compilers that share a class loader
internal Dictionary<string, string> suppressWarnings = new Dictionary<string, string>();
internal Dictionary<string, string> errorWarnings = new Dictionary<string, string>();
internal Dictionary<string, string> errorWarnings = new Dictionary<string, string>(); // treat specific warnings as errors
internal bool warnaserror; // treat all warnings as errors
internal string writeSuppressWarningsFile;
internal List<string> proxies = new List<string>();
@ -3624,9 +3625,14 @@ namespace IKVM.Internal
throw new InvalidProgramException();
}
bool error = msgId >= Message.StartErrors
|| options.warnaserror
|| options.errorWarnings.ContainsKey(key)
|| options.errorWarnings.ContainsKey(((int)msgId).ToString());
Console.Error.Write("{0} IKVMC{1:D4}: ", error ? "Error" : msgId < Message.StartWarnings ? "Note" : "Warning", (int)msgId);
if (error && msgId < Message.StartErrors)
{
Console.Error.Write("Warning as Error: ");
}
Console.Error.WriteLine(msg, values);
if(options != toplevel && options.path != null)
{