[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] GCC Warnings are marked as Errors
|
Folks,
I've attached a minor non-API changing patch which allows us to
properly propagate warnings rather than errors where appropriate.
This address PR 45320:
"In file included from ../globals.h:9,",
" from ../abmain.c:36:",
"../_combolist.h:34:24: warning: no newline at end of file",
With the current error parser this results in one warning and two
errors. Taking the discussion of whether there should even be
more than one marker offline until the new parser manager is ready,
there should be three warnings instead.
This patch can be applied to 1.2 and 2.0 as desired. I've attached
the patch as well as JUnit tests for it (one pass & 4 failures for
other GCC error parsing problems).
ChangeLog
- Fix to address PR 45320 where we would mark warnings with
errors rather than inheriting the warning condition.
Index: src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java,v
retrieving revision 1.9.2.1
diff -u -r1.9.2.1 GCCErrorParser.java
--- src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java 18 Nov 2003 17:16:39 -0000 1.9.2.1
+++ src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java 16 Mar 2004 19:27:31 -0000
@@ -11,8 +11,12 @@
import org.eclipse.core.resources.IFile;
public class GCCErrorParser implements IErrorParser {
-
+
public boolean processLine(String line, ErrorParserManager eoParser) {
+ return processLine(line, eoParser, IMarkerGenerator.SEVERITY_ERROR_RESOURCE);
+ }
+
+ public boolean processLine(String line, ErrorParserManager eoParser, int inheritedSeverity) {
// Known patterns.
// (a)
// filename:lineno: description
@@ -76,7 +80,6 @@
String fileName = line.substring(0, firstColon);
String varName = null;
String desc = line.substring(secondColon + 1).trim();
- int severity = IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
/* Then check for the column */
int thirdColon= line.indexOf(':', secondColon + 1);
if (thirdColon != -1) {
@@ -183,7 +186,7 @@
buf += " in inclusion " + inclusionError;
inclusionError = t;
// Call the parsing process again.
- processLine(buf, eoParser);
+ processLine(buf, eoParser, extractSeverity(desc, inheritedSeverity));
}
}
@@ -201,8 +204,9 @@
}
}
+ //If we have an inherited severity, then use that value
+ int severity = extractSeverity(desc, inheritedSeverity);
if (desc.startsWith("warning") || desc.startsWith("Warning")) {
- severity = IMarkerGenerator.SEVERITY_WARNING;
// Remove the warning.
String d = desc.substring("warning".length()).trim();
if (d.startsWith(":")) {
@@ -232,5 +236,13 @@
}
}
return false;
+ }
+
+ private int extractSeverity(String desc, int defaultSeverity) {
+ int severity = defaultSeverity;
+ if (desc.startsWith("warning") || desc.startsWith("Warning")) {
+ severity = IMarkerGenerator.SEVERITY_WARNING;
+ }
+ return severity;
}
}
Attachment:
errorparsertests.zip
Description: Binary data