1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Thomas fixes for PR 45320

This commit is contained in:
Alain Magloire 2004-03-16 21:12:57 +00:00
parent 7d48a4fcc6
commit 0f9ea21c67
2 changed files with 23 additions and 5 deletions

View file

@ -1,3 +1,10 @@
2004-03-16 Thomas Fletcher
- Fix to address PR 45320 where we would mark warnings with
errors rather than inheriting the warning condition.
* src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java
2004-03-12 David Inglis 2004-03-12 David Inglis
Improved IConsole API to support multiple streams. Improved IConsole API to support multiple streams.

View file

@ -11,8 +11,12 @@ import org.eclipse.cdt.core.IMarkerGenerator;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
public class GCCErrorParser implements IErrorParser { public class GCCErrorParser implements IErrorParser {
public boolean processLine(String line, ErrorParserManager eoParser) { 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. // Known patterns.
// (a) // (a)
// filename:lineno: description // filename:lineno: description
@ -76,7 +80,6 @@ public class GCCErrorParser implements IErrorParser {
String fileName = line.substring(0, firstColon); String fileName = line.substring(0, firstColon);
String varName = null; String varName = null;
String desc = line.substring(secondColon + 1).trim(); String desc = line.substring(secondColon + 1).trim();
int severity = IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
/* Then check for the column */ /* Then check for the column */
int thirdColon= line.indexOf(':', secondColon + 1); int thirdColon= line.indexOf(':', secondColon + 1);
if (thirdColon != -1) { if (thirdColon != -1) {
@ -183,7 +186,7 @@ public class GCCErrorParser implements IErrorParser {
buf += " in inclusion " + inclusionError; //$NON-NLS-1$ buf += " in inclusion " + inclusionError; //$NON-NLS-1$
inclusionError = t; inclusionError = t;
// Call the parsing process again. // Call the parsing process again.
processLine(buf, eoParser); processLine(buf, eoParser, extractSeverity(desc, inheritedSeverity));
} }
} }
@ -200,9 +203,9 @@ public class GCCErrorParser implements IErrorParser {
} }
} }
} }
int severity = extractSeverity(desc, inheritedSeverity);
if (desc.startsWith("warning") || desc.startsWith("Warning")) { //$NON-NLS-1$ //$NON-NLS-2$ if (desc.startsWith("warning") || desc.startsWith("Warning")) { //$NON-NLS-1$ //$NON-NLS-2$
severity = IMarkerGenerator.SEVERITY_WARNING;
// Remove the warning. // Remove the warning.
String d = desc.substring("warning".length()).trim(); //$NON-NLS-1$ String d = desc.substring("warning".length()).trim(); //$NON-NLS-1$
if (d.startsWith(":")) { //$NON-NLS-1$ if (d.startsWith(":")) { //$NON-NLS-1$
@ -233,4 +236,12 @@ public class GCCErrorParser implements IErrorParser {
} }
return false; return false;
} }
private int extractSeverity(String desc, int defaultSeverity) {
int severity = defaultSeverity;
if (desc.startsWith("warning") || desc.startsWith("Warning")) { //$NON-NLS-1$ //$NON-NLS-2$
severity = IMarkerGenerator.SEVERITY_WARNING;
}
return severity;
}
} }