Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] GCCErrorParser.java fix

2002-11-13 Alain Magloire

        * src/.../internal/errorparsers/GCCErrorParser.java (processLine):
        The full semantics seems to be:
                filename:lineno:column:error_description
        we did not take to account that the preprocessor
        was putting the column also.


Index: GCCErrorParser.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java,v
retrieving revision 1.4
diff -u -r1.4 GCCErrorParser.java
--- GCCErrorParser.java	6 Nov 2002 16:28:19 -0000	1.4
+++ GCCErrorParser.java	13 Nov 2002 22:02:00 -0000
@@ -13,7 +13,7 @@
 public class GCCErrorParser implements IErrorParser {
 
 	public boolean processLine(String line, ErrorParserManager eoParser) {
-		// gcc: "filename:linenumber: error_desc"
+		// gcc: "filename:linenumber:column: error_desc"
 		int firstColon = line.indexOf(':');
 
 		/* Guard against drive in Windows platform.  */
@@ -41,14 +41,15 @@
 					String varName = null;
 					String desc = line.substring(secondColon + 1).trim();
 					int severity = IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
-					int	num  = 0;
+					int	num  = -1;
+					int col = -1;
 
 					try {
 						num = Integer.parseInt(lineNumber);
 					} catch (NumberFormatException e) {
 					}
 
-					if (num == 0) {
+					if (num == -1) {
 						// Maybe a bad option error or cc1(plus) error
 						if (fileName.startsWith("cc") || fileName.startsWith("gcc")
 							|| fileName.startsWith("qcc") || fileName.startsWith("QCC")) {
@@ -58,6 +59,18 @@
 							}
 						} else {
 							return false;
+						}
+					} else {
+						/* Then check for the column  */
+						int thirdColon= line.indexOf(':', secondColon + 1);
+						if (thirdColon != -1) {
+							try {
+								col = Integer.parseInt(lineNumber);
+							} catch (NumberFormatException e) {
+							}
+						}
+						if (col != -1) {
+							desc = line.substring(thirdColon + 1).trim();
 						}
 					}
 



Back to the top