Skip to main content
summaryrefslogtreecommitdiffstats
path: root/xlc
diff options
context:
space:
mode:
authorAndrew Gvozdev2010-04-07 12:04:56 -0400
committerAndrew Gvozdev2010-04-07 12:04:56 -0400
commit2dc29833ffbddce7f25ea7d5e4d1654fa335426d (patch)
tree9237b92559deb738a005acb3742b5046680e2046 /xlc
parent857c5eae688574a290eeb7c1c4863efbef46a2ea (diff)
downloadorg.eclipse.cdt-2dc29833ffbddce7f25ea7d5e4d1654fa335426d.tar.gz
org.eclipse.cdt-2dc29833ffbddce7f25ea7d5e4d1654fa335426d.tar.xz
org.eclipse.cdt-2dc29833ffbddce7f25ea7d5e4d1654fa335426d.zip
bug 308322: Converted to RegexErrorParser
Diffstat (limited to 'xlc')
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError.java2
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/XlcErrorParserTester.java20
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties27
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc/plugin.xml76
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc/src/org/eclipse/cdt/errorparsers/xlc/Messages.java38
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc/src/org/eclipse/cdt/errorparsers/xlc/XlcErrorParser.java127
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc/src/org/eclipse/cdt/errorparsers/xlc/messages.properties37
7 files changed, 109 insertions, 218 deletions
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError.java
index 8ccbd80075..e94da5b1cf 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError.java
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError.java
@@ -28,7 +28,7 @@ public class TestUnrecoverableError extends TestCase {
aix.parseLine(err_msg);
assertEquals("temp1.c", aix.getFileName());
assertEquals(5, aix.getLineNumber());
- assertEquals(IMarkerGenerator.SEVERITY_ERROR_BUILD, aix.getSeverity());
+ assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
assertEquals("INTERNAL COMPILER ERROR",aix.getMessage());
}
public TestUnrecoverableError( String name)
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/XlcErrorParserTester.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/XlcErrorParserTester.java
index 3cc193b866..b565c593fb 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/XlcErrorParserTester.java
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/XlcErrorParserTester.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -15,9 +15,9 @@ package org.eclipse.cdt.errorparsers.xlc.tests;
import junit.framework.Assert;
import org.eclipse.cdt.core.ErrorParserManager;
+import org.eclipse.cdt.core.IErrorParserNamed;
import org.eclipse.cdt.core.IMarkerGenerator;
import org.eclipse.cdt.core.ProblemMarkerInfo;
-import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -30,6 +30,8 @@ import org.eclipse.core.runtime.IPath;
*/
public class XlcErrorParserTester {
+ public static final String XLC_ERROR_PARSER_ID = "org.eclipse.cdt.errorparsers.xlc.XlcErrorParser";
+
static private int counter=0;
IProject fTempProject = ResourcesPlugin.getWorkspace().getRoot().getProject("XlcErrorParserTester.temp." + counter++);
@@ -84,16 +86,19 @@ public class XlcErrorParserTester {
*/
@Override
public IFile findFileName(String fileName) {
- return fTempProject.getFile(fileName);
+ if (fileName!=null && fileName.trim().length()>0)
+ return fTempProject.getFile(fileName);
+ return null;
}
/**
* Called by ErrorPattern.RecordError() for external problem markers
*/
@Override
- public void generateExternalMarker(IResource file, int lineNumb, String desc, int sev, String varName, IPath externalPath) {
- if (file!=null) {
- fileName = file.getName();
+ public void generateExternalMarker(IResource rc, int lineNumb, String desc, int sev, String varName, IPath externalPath) {
+ // if rc is this project it means that file was not found
+ if (rc!=null && rc!=fTempProject) {
+ fileName = rc.getName();
} else {
fileName="";
}
@@ -109,7 +114,8 @@ public class XlcErrorParserTester {
* @return
*/
boolean parseLine(String line) {
- XlcErrorParser errorParser = new XlcErrorParser();
+ IErrorParserNamed errorParser = ErrorParserManager.getErrorParserCopy(XLC_ERROR_PARSER_ID);
+ Assert.assertNotNull(errorParser);
MockErrorParserManager epManager = new MockErrorParserManager();
return errorParser.processLine(line, epManager);
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties b/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties
index 306b7a7898..fd92395d42 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2006, 2009 IBM Corporation and others.
+# Copyright (c) 2006, 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
@@ -13,7 +13,28 @@
# "%foo" in feature.xml corresponds to the key "foo" in this file
# java.io.Properties file (ISO 8859-1 with "\" escapes)
# This file should be translated.
-pluginName=xlC Error Parser Plugin
+pluginName=xlC Error Parser Test Plugin
providerName=Eclipse CDT
-CDTXLCErrorParser.name=CDT xlC Error Parser \ No newline at end of file
+CDTXLCErrorParser.name=CDT xlC Error Parser
+
+# Translators: do not translate patterns below. We currently do not support NL versions of the XL C/C++ compilers.
+# Following are patterns of xlC compiler messages. While translating the patterns should be replaced
+# with corresponding patterns matchind localized compiler messages
+
+# "hello.c", line 5.9: 1506-358 (I) "MACRO" is defined on line 3 of hello.h.
+CDTXLCErrorParser.pattern.macro=["]?(.*?)["]?, line ([0-9]+)\\.[0-9]+:( [0-9]*-[0-9]*)? \\(I\\)\\s*["]?(\\w*)["]? is defined on line ([0-9]+) of (.*)\\.
+CDTXLCErrorParser.pattern.macro.replacement=Macro name $4 originally defined in file $6
+# "main.cpp", line 10.6: 1540-0064 (S) Syntax error: "name" was expected but "char" was found.
+CDTXLCErrorParser.pattern.error=["]?(.*?)["]?, line ([0-9]+)\\.[0-9]+:( [0-9]*-[0-9]*)? \\([USE]\\)\\s*(.*)
+CDTXLCErrorParser.pattern.warning=["]?(.*?)["]?, line ([0-9]+)\\.[0-9]+:( [0-9]*-[0-9]*)? \\(W\\)\\s*(.*)
+CDTXLCErrorParser.pattern.info=["]?(.*?)["]?, line ([0-9]+)\\.[0-9]+:( [0-9]*-[0-9]*)? \\(I\\)\\s*(.*)
+# ld: 0711-224 WARNING: Duplicate symbol: symboldupe
+# WARNING, ERROR, SEVERE ERROR etc.
+CDTXLCErrorParser.pattern.ld.error=ld: ([0-9]+-[0-9]+).*ERROR:\\s*(.*)
+CDTXLCErrorParser.pattern.ld.warning=ld: ([0-9]+-[0-9]+)\\s*WARNING:\\s*(.*)
+# ld: 0711-987 Error occurred while reading file
+CDTXLCErrorParser.pattern.ld.error2=ld: ([0-9]+-[0-9]+)\\s*(Error .*)
+# ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
+CDTXLCErrorParser.pattern.ld.info=ld: ([0-9]+-[0-9]+)\\s*(.*)
+
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.xml b/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.xml
index f0cb8d78a4..8474f5dff9 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.xml
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.xml
@@ -1,9 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
-<extension id="XlcErrorParser"
- name="%CDTXLCErrorParser.name"
- point="org.eclipse.cdt.core.ErrorParser">
- <errorparser class="org.eclipse.cdt.errorparsers.xlc.XlcErrorParser" />
-</extension>
+ <extension id="XlcErrorParser" name="%CDTXLCErrorParser.name" point="org.eclipse.cdt.core.ErrorParser">
+ <errorparser
+ class="org.eclipse.cdt.core.errorparsers.RegexErrorParser"
+ id="org.eclipse.cdt.errorparsers.xlc.XlcErrorParser"
+ name="%CDTXLCErrorParser.name">
+ <pattern
+ regex="%CDTXLCErrorParser.pattern.error"
+ severity="Error"
+ file-expr="$1"
+ line-expr="$2"
+ description-expr="$4"
+ eat-processed-line="true">
+ </pattern>
+ <pattern
+ regex="%CDTXLCErrorParser.pattern.warning"
+ severity="Warning"
+ file-expr="$1"
+ line-expr="$2"
+ description-expr="$4"
+ eat-processed-line="true">
+ </pattern>
+ <pattern
+ regex="%CDTXLCErrorParser.pattern.macro"
+ severity="Warning"
+ file-expr="$6"
+ line-expr="$5"
+ description-expr="%CDTXLCErrorParser.pattern.macro.replacement"
+ eat-processed-line="true">
+ </pattern>
+ <pattern
+ regex="%CDTXLCErrorParser.pattern.info"
+ severity="Info"
+ description-expr="$4"
+ file-expr="$1"
+ line-expr="$2"
+ eat-processed-line="true">
+ </pattern>
+ <pattern
+ regex="%CDTXLCErrorParser.pattern.ld.error"
+ severity="Error"
+ file-expr=""
+ line-expr=""
+ description-expr="$2"
+ eat-processed-line="true">
+ </pattern>
+ <pattern
+ regex="%CDTXLCErrorParser.pattern.ld.error2"
+ severity="Error"
+ file-expr=""
+ line-expr=""
+ description-expr="$2"
+ eat-processed-line="true">
+ </pattern>
+ <pattern
+ regex="%CDTXLCErrorParser.pattern.ld.warning"
+ severity="Warning"
+ file-expr=""
+ line-expr=""
+ description-expr="$2"
+ eat-processed-line="true">
+ </pattern>
+ <pattern
+ regex="%CDTXLCErrorParser.pattern.ld.info"
+ severity="Info"
+ file-expr=""
+ line-expr=""
+ description-expr="$2"
+ eat-processed-line="true">
+ </pattern>
+ </errorparser>
+ </extension>
</plugin>
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc/src/org/eclipse/cdt/errorparsers/xlc/Messages.java b/xlc/org.eclipse.cdt.errorparsers.xlc/src/org/eclipse/cdt/errorparsers/xlc/Messages.java
deleted file mode 100644
index 24c533c5e6..0000000000
--- a/xlc/org.eclipse.cdt.errorparsers.xlc/src/org/eclipse/cdt/errorparsers/xlc/Messages.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation 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:
- * Andrew Gvozdev - Initial implementation
- *******************************************************************************/
-package org.eclipse.cdt.errorparsers.xlc;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.cdt.errorparsers.xlc.messages"; //$NON-NLS-1$
- public static String XlcErrorParser_MacroRedefinitionErrorPattern;
- public static String XlcErrorParser_CompilerErrorPattern;
- public static String XlcErrorParser_FlagUnrecoverable;
- public static String XlcErrorParser_FlagSevere;
- public static String XlcErrorParser_FlagError;
- public static String XlcErrorParser_FlagWarning;
- public static String XlcErrorParser_FlagInfo;
-
- public static String XlcErrorParser_LinkerErrorPattern;
- public static String XlcErrorParser_LinkerErrorPattern2;
- public static String XlcErrorParser_LinkerInfoPattern;
- public static String XlcErrorParser_LinkerWarning;
- public static String XlcErrorParser_LinkerError;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc/src/org/eclipse/cdt/errorparsers/xlc/XlcErrorParser.java b/xlc/org.eclipse.cdt.errorparsers.xlc/src/org/eclipse/cdt/errorparsers/xlc/XlcErrorParser.java
deleted file mode 100644
index 68d6a6cf3f..0000000000
--- a/xlc/org.eclipse.cdt.errorparsers.xlc/src/org/eclipse/cdt/errorparsers/xlc/XlcErrorParser.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Andrew Gvozdev (Quoin Inc.)
- *******************************************************************************/
-
-package org.eclipse.cdt.errorparsers.xlc;
-
-
-/**
- * This class provides for parsing the error messages generated by IBM AIX xlC compiler.
- *
- */
-
-import java.util.regex.Matcher;
-
-import org.eclipse.cdt.core.IMarkerGenerator;
-import org.eclipse.cdt.core.errorparsers.AbstractErrorParser;
-import org.eclipse.cdt.core.errorparsers.ErrorPattern;
-
-/**
- * Class XlcErrorParser provides for parsing of error output messages
- * produced by AIX xlC compiler and linker.
- *
- * @see org.eclipse.cdt.core.errorparsers.AbstractErrorParser
- * @see org.eclipse.cdt.core.errorparsers.ErrorPattern
-*/
-public class XlcErrorParser extends AbstractErrorParser {
- private static final ErrorPattern[] patterns = {
- /**
- * xlC produces 2 warning messages in case of macro redefinition:
- * "hello.c", line 3.9: 1506-236 (W) Macro name HELLO has been redefined.
- * "hello.c", line 3.9: 1506-358 (I) "HELLO" is defined on line 4 of hello.h.
- * Both can be captured by regular XlcErrorParser_CompilerErrorPattern. However
- * different severity puts them apart in different groups. In addition
- * the second entry in Problems view won't let you jump to the original definition.
- * This ErrorPattern fixes those shortcomings.
- */
- new ErrorPattern(Messages.XlcErrorParser_MacroRedefinitionErrorPattern, 6, 5, -1, 0, -1) {
- /*
- * @see org.eclipse.cdt.core.errorparsers.ErrorPattern#getSeverity(java.util.regex.Matcher)
- */
- @Override
- public int getSeverity(Matcher matcher) {
- return IMarkerGenerator.SEVERITY_WARNING;
- }
- /*
- * @see org.eclipse.cdt.core.errorparsers.ErrorPattern#getDesc(java.util.regex.Matcher)
- */
- @Override
- public String getDesc(Matcher matcher) {
- return "Macro name " + matcher.group(4) + " originally defined in file " + getFileName(matcher);
- }
- },
- new ErrorPattern(Messages.XlcErrorParser_CompilerErrorPattern, 1, 2, 5, 0, -1) {
- /*
- * @see org.eclipse.cdt.core.errorparsers.ErrorPattern#getSeverity(java.util.regex.Matcher)
- */
- @Override
- public int getSeverity(Matcher matcher) {
- String warningGroup = matcher.group(4);
- if (warningGroup != null) {
- if (warningGroup.equals(Messages.XlcErrorParser_FlagUnrecoverable)) {
- return IMarkerGenerator.SEVERITY_ERROR_BUILD;
- } else if (warningGroup.equals(Messages.XlcErrorParser_FlagSevere)
- || warningGroup.equals(Messages.XlcErrorParser_FlagError)) {
- return IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
- } else if (warningGroup.equals(Messages.XlcErrorParser_FlagWarning)) {
- return IMarkerGenerator.SEVERITY_WARNING;
- } else if (warningGroup.equals(Messages.XlcErrorParser_FlagInfo)) {
- return IMarkerGenerator.SEVERITY_INFO;
- }
- }
- return IMarkerGenerator.SEVERITY_INFO;
- }
- },
- new ErrorPattern(Messages.XlcErrorParser_LinkerErrorPattern, 0, 0, 3, 0, -1) {
- /*
- * @see org.eclipse.cdt.core.errorparsers.ErrorPattern#getSeverity(java.util.regex.Matcher)
- */
- @Override
- public int getSeverity(Matcher matcher) {
- String warningGroup = matcher.group(2);
- if (warningGroup != null) {
- if (warningGroup.indexOf(Messages.XlcErrorParser_LinkerWarning) >= 0) {
- return IMarkerGenerator.SEVERITY_WARNING;
- } else if (warningGroup.indexOf(Messages.XlcErrorParser_LinkerError) >= 0) {
- return IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
- }
- }
- return IMarkerGenerator.SEVERITY_INFO;
- }
- },
- new ErrorPattern(Messages.XlcErrorParser_LinkerErrorPattern2, 0, 0, 2, 0, -1) {
- /*
- * @see org.eclipse.cdt.core.errorparsers.ErrorPattern#getSeverity(java.util.regex.Matcher)
- */
- @Override
- public int getSeverity(Matcher matcher) {
- return IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
- }
- },
- new ErrorPattern(Messages.XlcErrorParser_LinkerInfoPattern, 0, 0, 2, 0, -1) {
- /*
- * @see org.eclipse.cdt.core.errorparsers.ErrorPattern#getSeverity(java.util.regex.Matcher)
- */
- @Override
- public int getSeverity(Matcher matcher) {
- return IMarkerGenerator.SEVERITY_INFO;
- }
- },
- };
-
- /**
- * The constructor.
- */
- public XlcErrorParser() {
- super(patterns);
- }
-
-}
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc/src/org/eclipse/cdt/errorparsers/xlc/messages.properties b/xlc/org.eclipse.cdt.errorparsers.xlc/src/org/eclipse/cdt/errorparsers/xlc/messages.properties
deleted file mode 100644
index e991d4f09d..0000000000
--- a/xlc/org.eclipse.cdt.errorparsers.xlc/src/org/eclipse/cdt/errorparsers/xlc/messages.properties
+++ /dev/null
@@ -1,37 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2008 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:
-# Andrew Gvozdev - Initial implementation
-###############################################################################
-
-# Translators: do not translate this file. We currently do not support NL versions of the XL C/C++ compilers.
-
-# "main.cpp", line 10.6: 1540-0064 (S) Syntax error: "name" was expected but "char" was found.
-XlcErrorParser_CompilerErrorPattern=[\"]?(.*?)[\"]?, line ([0-9]+)\\.[0-9]+:( [0-9]*-[0-9]*)? \\(([USEWI])\\)\\s*(.*)
-# "hello.c", line 5.9: 1506-358 (I) "MACRO" is defined on line 3 of hello.h.
-XlcErrorParser_MacroRedefinitionErrorPattern=[\"]?(.*?)[\"]?, line ([0-9]+)\\.[0-9]+:( [0-9]*-[0-9]*)? \\(I\\)\\s*[\"]?(\\w*)[\"]? is defined on line ([0-9]+) of (.*)\\.
-
-XlcErrorParser_FlagUnrecoverable=U
-XlcErrorParser_FlagSevere=S
-XlcErrorParser_FlagError=E
-XlcErrorParser_FlagWarning=W
-XlcErrorParser_FlagInfo=I
-
-# ld: 0711-224 WARNING: Duplicate symbol: symboldupe
-# WARNING, ERROR, SEVERE ERROR etc.
-XlcErrorParser_LinkerErrorPattern=ld: ([0-9]+-[0-9]+) (.*[(WARNING)(ERROR)]:)? (.*)
-XlcErrorParser_LinkerWarning=WARNING
-XlcErrorParser_LinkerError=ERROR
-
-# ld: 0711-987 Error occurred while reading file
-XlcErrorParser_LinkerErrorPattern2=ld: ([0-9]+-[0-9]+) (Error .*)
-
-# ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
-XlcErrorParser_LinkerInfoPattern=ld: ([0-9]+-[0-9]+) (.*)
-
-

Back to the top