Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Patch for GCCErrorParser unrecognized pattern

Hi,

My first attempt at a patch, so be kind... ;-)

I found an error in the GCCErrorParser in which it was not recognizing a pattern:

// In file included from hello.c:3:
// c.h:2:15: missing ')' in macro parameter list

GCCErrorParser already recognized a similar but slightly different pattern:

// In file included from b.h:2,
//				 from a.h:3,
//				 from hello.c:3:
// c.h:2:15: missing ')' in macro parameter list

The patch was an easy fix to add an extra if statement to do a check for "In file included from", similar to the already recognized similar pattern.  This problem is present both in CDT 1.2.1 and CDT 2.0; the patch is for CDT 2.0.

The diff I've attached is generated from the command line and hope it's sufficient.  

Thanks,
Brad

 <<GCCErrorParser.diff.txt>> 

--- src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java	2004-07-06 17:02:32.939385800 -0700
+++ src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java	2004-07-06 16:48:25.663950200 -0700
@@ -24,13 +24,17 @@
 		// (b)
 		// filename:lineno:column: description
 		//
-		// (b)
+		// (c)
 		// In file included from b.h:2,
 		//				 from a.h:3,
 		//				 from hello.c:3:
 		// c.h:2:15: missing ')' in macro parameter list
 		//
-		// (c)
+		// (d)
+		// In file included from hello.c:3:
+		// c.h:2:15: missing ')' in macro parameter list
+		//
+		// (e)
 		// h.c: In function `main':
 		// h.c:41: `foo' undeclared (first use in this function)
 		// h.c:41: (Each undeclared identifier is reported only once
@@ -150,13 +154,28 @@
 					 }
 
 					/*
+					 *	In file included from hello.c:3:
+					 *	 c.h:2:15: missing ')' in macro parameter list
+					 *
+					 * We reconstruct the multiline gcc errors to multiple errors:
+					 *    c.h:2:15: missing ')' in macro parameter list
+					 *    hello.c:3:  in inclusion c.h:2:15
+					 *     
+					 */
+					if (line.startsWith("In file included from ")) { //$NON-NLS-1$
+						// We want the last error in the chain, so continue.
+						eoParser.appendToScratchBuffer(line);
+						return false;
+					}
+
+					/*
 					 *	In file included from b.h:2,
 					 *					 from a.h:3,
 					 *					 from hello.c:3:
 					 *	 c.h:2:15: missing ')' in macro parameter list
 					 *
 					 * We reconstruct the multiline gcc errors to multiple errors:
-					 *    c.h:3:15: missing ')' in macro parameter list
+					 *    c.h:2:15: missing ')' in macro parameter list
 					 *    b.h:2:  in inclusion c.h:3:15
 					 *    a.h:3:  in inclusion b.h:2
 					 *    hello.c:3:  in inclusion a.h:3

Back to the top