Author: mmarin
Date: 2007-12-31 15:20:18 -0500 (Mon, 31 Dec 2007)
New Revision: 92073
Modified:
trunk/monodevelop/main/src/addins/CBinding/ChangeLog
trunk/monodevelop/main/src/addins/CBinding/Compiler/GNUCompiler.cs
Log:
* Compiler/GNUCompiler.cs: Report errors in the same order as they were
outputted by the compiler and parse linker output to form better
linker error reports.
Modified: trunk/monodevelop/main/src/addins/CBinding/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/CBinding/ChangeLog 2007-12-31
19:41:26 UTC (rev 92072)
+++ trunk/monodevelop/main/src/addins/CBinding/ChangeLog 2007-12-31
20:20:18 UTC (rev 92073)
@@ -1,5 +1,11 @@
2007-12-31 Marcos David Marín Amador <[EMAIL PROTECTED]>
+ * Compiler/GNUCompiler.cs: Report errors in the same order as they were
+ outputted by the compiler and parse linker output to form better
linker
+ error reports.
+
+2007-12-31 Marcos David Marín Amador <[EMAIL PROTECTED]>
+
* Project/CProject.cs: Copy deployment files to output directory when
building the project.
Modified: trunk/monodevelop/main/src/addins/CBinding/Compiler/GNUCompiler.cs
===================================================================
--- trunk/monodevelop/main/src/addins/CBinding/Compiler/GNUCompiler.cs
2007-12-31 19:41:26 UTC (rev 92072)
+++ trunk/monodevelop/main/src/addins/CBinding/Compiler/GNUCompiler.cs
2007-12-31 20:20:18 UTC (rev 92073)
@@ -591,13 +591,17 @@
{
TextReader reader = new StringReader (errorString);
string next;
-
+ Queue<CompilerError> queue = new Queue<CompilerError>
();
+
while ((next = reader.ReadLine ()) != null) {
CompilerError error =
CreateErrorFromErrorString (next);
if (error != null)
- cr.Errors.Add (error);
+ queue.Enqueue (error);
}
+ while (queue.Count > 0)
+ cr.Errors.Add (queue.Dequeue ());
+
reader.Close ();
}
@@ -607,6 +611,9 @@
private static Regex noColRegex = new Regex (
@"^\s*(?<file>.*):(?<line>\d*):\s*(?<level>.*)\s*:\s(?<message>.*)",
RegexOptions.Compiled | RegexOptions.ExplicitCapture);
+ private static Regex linkerRegex = new Regex (
+ @"^\s*(?<file>[^:]*):(?<line>\d*):\s*(?<message>[^:]*)",
+ RegexOptions.Compiled | RegexOptions.ExplicitCapture);
private CompilerError CreateErrorFromErrorString (string
errorString)
{
@@ -644,24 +651,36 @@
{
TextReader reader = new StringReader (errorString);
string next;
+ Queue<CompilerError> queue = new Queue<CompilerError>
();
while ((next = reader.ReadLine ()) != null) {
CompilerError error =
CreateLinkerErrorFromErrorString (next);
if (error != null)
- cr.Errors.Add (error);
+ queue.Enqueue (error);
}
+ while (queue.Count > 0)
+ cr.Errors.Add (queue.Dequeue ());
+
reader.Close ();
}
- // FIXME: needs to be improved UPDATE: or does it...?
private CompilerError CreateLinkerErrorFromErrorString (string
errorString)
{
CompilerError error = new CompilerError ();
- error.ErrorText = errorString;
+ Match linkerMatch = linkerRegex.Match (errorString);
- return error;
+ if (linkerMatch.Success)
+ {
+ error.FileName =
linkerMatch.Groups["file"].Value;
+ error.Line = int.Parse
(linkerMatch.Groups["line"].Value);
+ error.ErrorText =
linkerMatch.Groups["message"].Value;
+
+ return error;
+ }
+
+ return null;
}
// expands backticked portions of the parameter-list using "sh"
and "echo"
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches