mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
bug 263987: GCCErrorParser converted to RegexErrorParser style
This commit is contained in:
parent
04c34c4b98
commit
1f8978eea3
6 changed files with 75 additions and 172 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Andrew Gvozdev and others.
|
||||
* Copyright (c) 2009, 2010 Andrew Gvozdev and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -26,7 +26,7 @@ import org.eclipse.cdt.core.errorparsers.ErrorParserNamedWrapper;
|
|||
import org.eclipse.cdt.core.errorparsers.RegexErrorParser;
|
||||
import org.eclipse.cdt.core.errorparsers.RegexErrorPattern;
|
||||
import org.eclipse.cdt.internal.errorparsers.ErrorParserExtensionManager;
|
||||
import org.eclipse.cdt.internal.errorparsers.GCCErrorParser;
|
||||
import org.eclipse.cdt.internal.errorparsers.GASErrorParser;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
@ -38,7 +38,7 @@ public class RegexErrorParserTests extends TestCase {
|
|||
// These should match id and name of extension point defined in plugin.xml
|
||||
private static final String REGEX_ERRORPARSER_ID = "org.eclipse.cdt.core.tests.RegexErrorParserId";
|
||||
private static final String REGEX_ERRORPARSER_NAME = "Test Plugin RegexErrorParser";
|
||||
private static final String GCC_ERRORPARSER_ID = "org.eclipse.cdt.core.GCCErrorParser";
|
||||
private static final String NOTREGEX_ERRORPARSER_ID = "org.eclipse.cdt.core.GASErrorParser";
|
||||
|
||||
private static final String TEST_PROJECT_NAME = "RegexErrorParserTests";
|
||||
|
||||
|
@ -258,13 +258,13 @@ public class RegexErrorParserTests extends TestCase {
|
|||
|
||||
// CCorePlugin.getAllErrorParsersIDs()
|
||||
String all = ErrorParserManager.toDelimitedString(cCorePlugin.getAllErrorParsersIDs());
|
||||
assertTrue(all.contains(GCC_ERRORPARSER_ID));
|
||||
assertTrue(all.contains(NOTREGEX_ERRORPARSER_ID));
|
||||
|
||||
// CCorePlugin.getErrorParser(id)
|
||||
IErrorParser[] gccErrorParserArray = cCorePlugin.getErrorParser(GCC_ERRORPARSER_ID);
|
||||
IErrorParser[] gccErrorParserArray = cCorePlugin.getErrorParser(NOTREGEX_ERRORPARSER_ID);
|
||||
assertNotNull(gccErrorParserArray);
|
||||
assertEquals(1, gccErrorParserArray.length);
|
||||
assertTrue(gccErrorParserArray[0] instanceof GCCErrorParser);
|
||||
assertTrue(gccErrorParserArray[0] instanceof GASErrorParser);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -475,7 +475,7 @@ public class RegexErrorParserTests extends TestCase {
|
|||
|
||||
{
|
||||
// Create error parser
|
||||
IErrorParser errorParser = new GCCErrorParser();
|
||||
IErrorParser errorParser = new GASErrorParser();
|
||||
// Add to available parsers
|
||||
ErrorParserExtensionManager.setUserDefinedErrorParsersInternal(new IErrorParserNamed[] {new ErrorParserNamedWrapper(TESTING_ID, TESTING_NAME, errorParser)});
|
||||
assertNotNull(ErrorParserManager.getErrorParserCopy(TESTING_ID));
|
||||
|
@ -496,7 +496,7 @@ public class RegexErrorParserTests extends TestCase {
|
|||
assertNotNull(errorParser);
|
||||
assertEquals(TESTING_NAME, errorParser.getName());
|
||||
assertTrue(errorParser instanceof ErrorParserNamedWrapper);
|
||||
assertTrue(((ErrorParserNamedWrapper)errorParser).getErrorParser() instanceof GCCErrorParser);
|
||||
assertTrue(((ErrorParserNamedWrapper)errorParser).getErrorParser() instanceof GASErrorParser);
|
||||
}
|
||||
{
|
||||
// Remove from available parsers as clean-up
|
||||
|
@ -674,8 +674,8 @@ public class RegexErrorParserTests extends TestCase {
|
|||
assertNotSame(clone1, clone2);
|
||||
}
|
||||
{
|
||||
IErrorParserNamed clone1 = ErrorParserManager.getErrorParserCopy(GCC_ERRORPARSER_ID);
|
||||
IErrorParserNamed clone2 = ErrorParserManager.getErrorParserCopy(GCC_ERRORPARSER_ID);
|
||||
IErrorParserNamed clone1 = ErrorParserManager.getErrorParserCopy(NOTREGEX_ERRORPARSER_ID);
|
||||
IErrorParserNamed clone2 = ErrorParserManager.getErrorParserCopy(NOTREGEX_ERRORPARSER_ID);
|
||||
assertEquals(clone1, clone2);
|
||||
assertNotSame(clone1, clone2);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2003, 2009 IBM Corporation and others.
|
||||
# Copyright (c) 2003, 2010 IBM Corporation and others.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
|
@ -53,6 +53,18 @@ CDTVisualCErrorParser.name=CDT Visual C Error Parser
|
|||
CDTGNUMakeErrorParser.name.deprecated=CDT GNU Make Error Parser 6.0 (Deprecated)
|
||||
CDTRegexErrorParser.name=CDT Regular Expression Error Parser
|
||||
|
||||
CDTGNUMakeErrorParser.regex.ReportedOnlyOnce=.*\\(Each undeclared identifier is reported only once.*
|
||||
CDTGNUMakeErrorParser.regex.ForEachFunctionItAppearsIn=.*for each function it appears in.\\).*
|
||||
CDTGNUMakeErrorParser.regex.InstantiatedFrom=.*instantiated from .*
|
||||
CDTGNUMakeErrorParser.regex.GenericNote=.* note:.*
|
||||
CDTGNUMakeErrorParser.regex.ParseErrorBefore=(.*?):([0-9]+):([0-9]+:)? (parse error before.*[`'"](.*)'"].*)
|
||||
CDTGNUMakeErrorParser.regex.ErrorUndeclared=(.*?):([0-9]+):([0-9]+:)? [Ee]rror: ([`'"](.*)['"] undeclared .*)
|
||||
CDTGNUMakeErrorParser.regex.GenericError=(.*?):([0-9]+):([0-9]+:)?\\s*(([Ee]rror)|(ERROR)): (.*)
|
||||
CDTGNUMakeErrorParser.regex.DefinedButNotUsed=(.*?):([0-9]+):([0-9]+:)? [Ww]arning: ([`'"](.*)['"] defined but not used.*)
|
||||
CDTGNUMakeErrorParser.regex.ConflictingTypesFor=(.*?):([0-9]+):([0-9]+:)? [Ww]arning: (conflicting types for .*[`'"](.*)['"].*)
|
||||
CDTGNUMakeErrorParser.regex.GenericWarning=(.*?):([0-9]+):([0-9]+:)?\\s*(([Ww]arning)|(WARNING)): (.*)
|
||||
CDTGNUMakeErrorParser.regex.OtherError=(.*?):([0-9]+):([0-9]+:)? (.*)
|
||||
|
||||
PathEntryContainerInitializer=Path Entry Container Initializer
|
||||
|
||||
fileTypeMapping.AssemblyLanguage=Assembly
|
||||
|
|
|
@ -149,53 +149,25 @@
|
|||
<!-- =================================================================================== -->
|
||||
<!-- Define the list of Error Parser provided by the CDT -->
|
||||
<!-- =================================================================================== -->
|
||||
<!-- MakeErrorParser is deprecated as of CDT 7.0 (replaced with WorkingDirLocator and GmakeErrorParser) -->
|
||||
<extension
|
||||
id="MakeErrorParser"
|
||||
name="%CDTGNUMakeErrorParser.name.deprecated"
|
||||
point="org.eclipse.cdt.core.ErrorParser">
|
||||
<errorparser
|
||||
id="org.eclipse.cdt.core.MakeErrorParser"
|
||||
name="%CDTGNUMakeErrorParser.name.deprecated"
|
||||
class="org.eclipse.cdt.internal.errorparsers.MakeErrorParser">
|
||||
</errorparser>
|
||||
</extension>
|
||||
<extension
|
||||
id="WorkingDirLocator"
|
||||
name="%CDTWorkingDirLocator.name"
|
||||
point="org.eclipse.cdt.core.ErrorParser">
|
||||
<errorparser
|
||||
class="org.eclipse.cdt.internal.errorparsers.CWDLocator"
|
||||
id="org.eclipse.cdt.core.CWDLocator"
|
||||
name="%CDTWorkingDirLocator.name">
|
||||
</errorparser>
|
||||
</extension>
|
||||
<extension
|
||||
id="GmakeErrorParser"
|
||||
name="%CDTGNUMakeErrorParser.name"
|
||||
point="org.eclipse.cdt.core.ErrorParser">
|
||||
<errorparser
|
||||
class="org.eclipse.cdt.core.errorparsers.RegexErrorParser"
|
||||
id="org.eclipse.cdt.core.GmakeErrorParser"
|
||||
name="%CDTGNUMakeErrorParser.name">
|
||||
<pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex=".*make.*:.*Error.*\(ignored\)" severity="Info"/>
|
||||
<pattern description-expr="make: $3" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="(.*):(\d*): (\*\*\* .*)" severity="Error"/>
|
||||
<pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex=".*make.*: \*\*\* .*" severity="Error"/>
|
||||
<pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex=".*make.*: Target (.*) not remade because of errors." severity="Error"/>
|
||||
<pattern description-expr="make: $3" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="(.*):(\d*): warning: (.*)" severity="Warning"/>
|
||||
<pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex=".*make.*\[.*\] Error [-]{0,1}\d*.*" severity="Warning"/>
|
||||
<pattern description-expr="make: $3" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="(.*):(\d*): (.*No such file or directory)" severity="Warning"/>
|
||||
<pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex=".*make.*: Circular .* dependency dropped." severity="Warning"/>
|
||||
</errorparser>
|
||||
</extension>
|
||||
<extension
|
||||
id="GCCErrorParser"
|
||||
name="%CDTGNUCErrorParser.name"
|
||||
point="org.eclipse.cdt.core.ErrorParser">
|
||||
<errorparser
|
||||
class="org.eclipse.cdt.core.errorparsers.RegexErrorParser"
|
||||
id="org.eclipse.cdt.core.GCCErrorParser"
|
||||
name="%CDTGNUCErrorParser.name"
|
||||
class="org.eclipse.cdt.internal.errorparsers.GCCErrorParser">
|
||||
name="%CDTGNUCErrorParser.name">
|
||||
<pattern description-expr="" eat-processed-line="true" file-expr="" line-expr="" regex="%CDTGNUMakeErrorParser.regex.ReportedOnlyOnce" severity="Ignore"/>
|
||||
<pattern description-expr="" eat-processed-line="true" file-expr="" line-expr="" regex="%CDTGNUMakeErrorParser.regex.ForEachFunctionItAppearsIn" severity="Ignore"/>
|
||||
<pattern description-expr="" eat-processed-line="true" file-expr="" line-expr="" regex="%CDTGNUMakeErrorParser.regex.InstantiatedFrom" severity="Ignore"/>
|
||||
<pattern description-expr="" eat-processed-line="true" file-expr="" line-expr="" regex="%CDTGNUMakeErrorParser.regex.GenericNote" severity="Ignore"/>
|
||||
<pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUMakeErrorParser.regex.ParseErrorBefore" severity="Error" variable-expr="$5"/>
|
||||
<pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUMakeErrorParser.regex.ErrorUndeclared" severity="Error" variable-expr="$5"/>
|
||||
<pattern description-expr="$7" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUMakeErrorParser.regex.GenericError" severity="Error"/>
|
||||
<pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUMakeErrorParser.regex.DefinedButNotUsed" severity="Warning" variable-expr="$5"/>
|
||||
<pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUMakeErrorParser.regex.ConflictingTypesFor" severity="Warning" variable-expr="$5"/>
|
||||
<pattern description-expr="$7" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUMakeErrorParser.regex.GenericWarning" severity="Warning"/>
|
||||
<pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUMakeErrorParser.regex.OtherError" severity="Error"/>
|
||||
</errorparser>
|
||||
</extension>
|
||||
<extension
|
||||
|
@ -246,6 +218,45 @@
|
|||
severity="Error"/>
|
||||
</errorparser>
|
||||
</extension>
|
||||
<!-- MakeErrorParser is deprecated as of CDT 7.0 (replaced with WorkingDirLocator and GmakeErrorParser) -->
|
||||
<extension
|
||||
id="MakeErrorParser"
|
||||
name="%CDTGNUMakeErrorParser.name.deprecated"
|
||||
point="org.eclipse.cdt.core.ErrorParser">
|
||||
<errorparser
|
||||
id="org.eclipse.cdt.core.MakeErrorParser"
|
||||
name="%CDTGNUMakeErrorParser.name.deprecated"
|
||||
class="org.eclipse.cdt.internal.errorparsers.MakeErrorParser">
|
||||
</errorparser>
|
||||
</extension>
|
||||
<extension
|
||||
id="WorkingDirLocator"
|
||||
name="%CDTWorkingDirLocator.name"
|
||||
point="org.eclipse.cdt.core.ErrorParser">
|
||||
<errorparser
|
||||
class="org.eclipse.cdt.internal.errorparsers.CWDLocator"
|
||||
id="org.eclipse.cdt.core.CWDLocator"
|
||||
name="%CDTWorkingDirLocator.name">
|
||||
</errorparser>
|
||||
</extension>
|
||||
<extension
|
||||
id="GmakeErrorParser"
|
||||
name="%CDTGNUMakeErrorParser.name"
|
||||
point="org.eclipse.cdt.core.ErrorParser">
|
||||
<errorparser
|
||||
class="org.eclipse.cdt.core.errorparsers.RegexErrorParser"
|
||||
id="org.eclipse.cdt.core.GmakeErrorParser"
|
||||
name="%CDTGNUMakeErrorParser.name">
|
||||
<pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex=".*make.*:.*Error.*\(ignored\)" severity="Info"/>
|
||||
<pattern description-expr="make: $3" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="(.*):(\d*): (\*\*\* .*)" severity="Error"/>
|
||||
<pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex=".*make.*: \*\*\* .*" severity="Error"/>
|
||||
<pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex=".*make.*: Target (.*) not remade because of errors." severity="Error"/>
|
||||
<pattern description-expr="make: $3" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="(.*):(\d*): warning: (.*)" severity="Warning"/>
|
||||
<pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex=".*make.*\[.*\] Error [-]{0,1}\d*.*" severity="Warning"/>
|
||||
<pattern description-expr="make: $3" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="(.*):(\d*): (.*No such file or directory)" severity="Warning"/>
|
||||
<pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex=".*make.*: Circular .* dependency dropped." severity="Warning"/>
|
||||
</errorparser>
|
||||
</extension>
|
||||
<extension
|
||||
id="VCErrorParser"
|
||||
name="%CDTVisualCErrorParser.name"
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* James Blackburn - Patch for PR 85264
|
||||
* Norbert Ploett (Siemens AG) - externalized strings
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.errorparsers;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||
import org.eclipse.cdt.core.errorparsers.AbstractErrorParser;
|
||||
import org.eclipse.cdt.core.errorparsers.ErrorPattern;
|
||||
|
||||
public class GCCErrorParser extends AbstractErrorParser {
|
||||
|
||||
private static final Pattern[] varPatterns = {
|
||||
Pattern.compile(Messages.GCCErrorParser_varPattern_undeclared),
|
||||
Pattern.compile(Messages.GCCErrorParser_varPattern_defdNotUsed),
|
||||
Pattern.compile(Messages.GCCErrorParser_varPattern_conflictTypes),
|
||||
Pattern.compile(Messages.GCCErrorParser_varPattern_parseError)
|
||||
};
|
||||
|
||||
private static final ErrorPattern[] patterns = {
|
||||
// The following are skipped
|
||||
new ErrorPattern(Messages.GCCErrorParser_skip_UndeclaredOnlyOnce),
|
||||
new ErrorPattern(Messages.GCCErrorParser_skip_forEachFunction),
|
||||
new ErrorPattern(Messages.GCCErrorParser_skip_note),
|
||||
new ErrorPattern(Messages.GCCErrorParser_sikp_instantiatedFromHere),
|
||||
// The following are not...
|
||||
new ErrorPattern(Messages.GCCErrorParser_Warnings, 1, 2, 5, 0, 0) {
|
||||
@Override
|
||||
public String getVarName(Matcher matcher) {
|
||||
String desc = getDesc(matcher);
|
||||
if (desc == null)
|
||||
return null;
|
||||
|
||||
for (int i = 0; i < varPatterns.length; ++i) {
|
||||
Matcher varMatcher = varPatterns[i].matcher(desc);
|
||||
if (varMatcher.find())
|
||||
return varMatcher.group(1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public int getSeverity(Matcher matcher) {
|
||||
String warningGroup = matcher.group(4);
|
||||
if (warningGroup != null && warningGroup.toLowerCase().endsWith("warning:")) //$NON-NLS-1$
|
||||
return IMarkerGenerator.SEVERITY_WARNING;
|
||||
|
||||
return IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public GCCErrorParser() {
|
||||
super(patterns);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2009 Siemens AG and others.
|
||||
* All rights reserved. This content and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Norbert Ploett - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.errorparsers;
|
||||
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
|
||||
public class Messages extends NLS {
|
||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.errorparsers.messages"; //$NON-NLS-1$
|
||||
public static String GCCErrorParser_sikp_instantiatedFromHere;
|
||||
public static String GCCErrorParser_skip_forEachFunction;
|
||||
public static String GCCErrorParser_skip_note;
|
||||
public static String GCCErrorParser_skip_UndeclaredOnlyOnce;
|
||||
public static String GCCErrorParser_varPattern_conflictTypes;
|
||||
public static String GCCErrorParser_varPattern_defdNotUsed;
|
||||
public static String GCCErrorParser_varPattern_parseError;
|
||||
public static String GCCErrorParser_varPattern_undeclared;
|
||||
public static String GCCErrorParser_Warnings;
|
||||
static {
|
||||
// initialize resource bundle
|
||||
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
||||
}
|
||||
|
||||
private Messages() {
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2006, 2009 Siemens AG and others.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# Norbert Ploett - Initial implementation
|
||||
###############################################################################
|
||||
GCCErrorParser_varPattern_undeclared='(.*)' undeclared
|
||||
GCCErrorParser_varPattern_defdNotUsed='(.*)' defined but not used
|
||||
GCCErrorParser_varPattern_conflictTypes=conflicting types for '(.*)'
|
||||
GCCErrorParser_varPattern_parseError=parse error before '(.*)'
|
||||
GCCErrorParser_skip_UndeclaredOnlyOnce=\\(Each undeclared identifier is reported only once
|
||||
GCCErrorParser_skip_forEachFunction=for each function it appears in.\\)
|
||||
GCCErrorParser_skip_note=: note:
|
||||
GCCErrorParser_sikp_instantiatedFromHere=instantiated from
|
||||
GCCErrorParser_Warnings=(.*?):([0-9]+):([0-9]+:)?(.*?[([Ww]arning)(WARNING)([Ee]rror)(ERROR)]:)? (.*)
|
Loading…
Add table
Reference in a new issue