# HG changeset patch # User Ed Swartz # Date 1270649167 18000 # Node ID a4892a66eacf12602e148553b54c3da4077d119f # Parent f19aaf545805e1fb99067db58fd3e5f63e076118# Parent af25ad622fbfaedd036c3c49d0df2ab7ac310d5c Add checks for RVCT command line errors and warnings (bug 10045) diff -r f19aaf545805 -r a4892a66eacf builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/RVCTCompilerErrorParser.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/RVCTCompilerErrorParser.java Tue Apr 06 15:10:31 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/RVCTCompilerErrorParser.java Wed Apr 07 09:06:07 2010 -0500 @@ -16,12 +16,18 @@ */ package com.nokia.carbide.cdt.internal.builder.error.parsers; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + import org.eclipse.cdt.core.ErrorParserManager; import org.eclipse.cdt.core.IMarkerGenerator; import org.eclipse.core.runtime.Path; public class RVCTCompilerErrorParser extends CarbideBaseErrorParser { + private static final Pattern RVCT_ERROR_PATTERN = Pattern.compile("(?:Error|Fatal error): (C\\d\\d\\d\\d.: .*)"); + private static final Pattern RVCT_WARNING_PATTERN = Pattern.compile("Warning: (C\\d\\d\\d\\d.: .*)"); + /* (non-Javadoc) * @see org.eclipse.cdt.core.IErrorParser#processLine(java.lang.String, org.eclipse.cdt.core.ErrorParserManager) */ @@ -50,13 +56,22 @@ } // Check for license. - // TODO: This seems to follow a pattern of "Error: : :" So we might do a regexp check - // in the future. if (aLine.toLowerCase().contains("cannot obtain license for compiler")){ aErrorParserManager.generateMarker(aErrorParserManager.getProject(), 0, aLine, IMarkerGenerator.SEVERITY_ERROR_BUILD, null); return true; } - + + // Check general (command-line) errors and warnings + Matcher matcher = RVCT_ERROR_PATTERN.matcher(aLine); + if (matcher.matches()) { + aErrorParserManager.generateMarker(aErrorParserManager.getProject(), 0, matcher.group(1), IMarkerGenerator.SEVERITY_ERROR_BUILD, null); + return true; + } + matcher = RVCT_WARNING_PATTERN.matcher(aLine); + if (matcher.matches()) { + aErrorParserManager.generateMarker(aErrorParserManager.getProject(), 0, matcher.group(1), IMarkerGenerator.SEVERITY_WARNING, null); + return true; + } if (!setFirstColon(aLine)) { return false;