Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Partial fix for PR 25756

2002-11-06 Alain Magloire

        Deal with some issues of PR 25756.
        
        * src/.../internal.errorparsers.java (processLine):
        When the file is not found append not prepend the name
        of the file in the description.
        The check for "(Each undeclared ...)" was done at the
        wrong place.
        
        * src/.../ErrorParserManager.java (findFileName):
        Check if the file is absolute or relative.


Index: GCCErrorParser.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java,v
retrieving revision 1.3
diff -u -r1.3 GCCErrorParser.java
--- GCCErrorParser.java	23 Oct 2002 18:22:10 -0000	1.3
+++ GCCErrorParser.java	6 Nov 2002 16:05:15 -0000
@@ -60,56 +60,58 @@
 							return false;
 						}
 					}
-					IFile file = eoParser.findFilePath(fileName);
 
-					if (file != null) {
-						// gnu c: filename:no: (Each undeclared identifier is reported
-						// only once. filename:no: for each function it appears in.)
-						if (desc.startsWith ("(Each undeclared")) {
+					// gnu c: filename:no: (Each undeclared identifier is reported
+					// only once. filename:no: for each function it appears in.)
+					if (desc.startsWith ("(Each undeclared")) {
+						// Do nothing.
+						return false;
+					} else  {
+						String previous = eoParser.getPreviousLine();
+						if (desc.endsWith(")")
+							&& previous.indexOf("(Each undeclared") >= 0 ) {
 							// Do nothing.
 							return false;
-						} else  {
-							String previous = eoParser.getPreviousLine();
-							if (desc.endsWith(")")
-								&& previous.indexOf("(Each undeclared") >= 0 ) {
-								// Do nothing.
-								return false;
-							}
 						}
-						/* See if we can get a var name
-						 * Look for:
-						 * 'foo' undeclared
-						 * 'foo' defined but not used
-						 * conflicting types for 'foo'
-						 *
-						 */ 
-						 int s;
-						 if((s = desc.indexOf("\' undeclared")) != -1) {
-						 	int p = desc.indexOf("`");
-						 	if(p != -1) {
-						 		varName = desc.substring(p+1, s);
-						 		System.out.println("undex varName "+ varName);
-						 	}
-						 } else if((s = desc.indexOf("\' defined but not used")) != -1) {
-						 	int p = desc.indexOf("`");
-						 	if(p != -1) {
-						 		varName = desc.substring(p+1, s);
-						 		System.out.println("unused varName "+ varName);
-						 	}
-						 } else if((s = desc.indexOf("conflicting types for `")) != -1) {
-						 	int p = desc.indexOf("\'", s);
-						 	if(p != -1) {
-						 		varName = desc.substring(desc.indexOf("`") + 1, p);
-						 		System.out.println("confl varName "+ varName);
-						 	}
-						 } else if((s = desc.indexOf("previous declaration of `")) != -1) {
-						 	int p = desc.indexOf("\'", s);
-						 	if(p != -1) {
-						 		varName = desc.substring(desc.indexOf("`") + 1, p);
-						 		System.out.println("prev varName "+ varName);
-						 	}
-						 }
-		    		} else {
+					}
+
+					/* See if we can get a var name
+					 * Look for:
+					 * 'foo' undeclared
+					 * 'foo' defined but not used
+					 * conflicting types for 'foo'
+					 *
+					 */ 
+					 int s;
+					 if((s = desc.indexOf("\' undeclared")) != -1) {
+					 	int p = desc.indexOf("`");
+					 	if (p != -1) {
+					 		varName = desc.substring(p+1, s);
+					 		System.out.println("undex varName "+ varName);
+					 	}
+					 } else if((s = desc.indexOf("\' defined but not used")) != -1) {
+					 	int p = desc.indexOf("`");
+					 	if (p != -1) {
+					 		varName = desc.substring(p+1, s);
+					 		System.out.println("unused varName "+ varName);
+					 	}
+					 } else if((s = desc.indexOf("conflicting types for `")) != -1) {
+					 	int p = desc.indexOf("\'", s);
+					 	if (p != -1) {
+					 		varName = desc.substring(desc.indexOf("`") + 1, p);
+					 		System.out.println("confl varName "+ varName);
+					 	}
+					 } else if((s = desc.indexOf("previous declaration of `")) != -1) {
+					 	int p = desc.indexOf("\'", s);
+					 	if (p != -1) {
+					 		varName = desc.substring(desc.indexOf("`") + 1, p);
+					 		System.out.println("prev varName "+ varName);
+					 	}
+					 }
+
+					IFile file = eoParser.findFilePath(fileName);
+
+					if (file == null) {
 						// Parse the entire project.
 						file = eoParser.findFileName(fileName);
 						if (file != null) {
@@ -119,14 +121,15 @@
 								file = null;
 							}
 						}
-
-						// Display the fileName.
-						if (file == null) {
-							desc = fileName + ": " + desc;
-						}
 					}
+					
 					if (desc.startsWith("warning") || desc.startsWith("Warning")) {
 						severity = IMarkerGenerator.SEVERITY_WARNING;
+					}
+					
+					// Display the fileName.
+					if (file == null) {
+						desc = desc +"[" + fileName + "]";
 					}
 					eoParser.generateMarker(file, num, desc, severity, varName);
 				}



Back to the top