Skip to main content
summaryrefslogtreecommitdiffstats
path: root/xlc
diff options
context:
space:
mode:
authorAndrew Gvozdev2010-09-24 18:13:15 -0400
committerAndrew Gvozdev2010-09-24 18:13:15 -0400
commit8cdd50422c0f17797b02f93ff2fb238adac7a3b1 (patch)
treec28ca6d8582b8b1f18793148c2ba18f1f2f1cdc5 /xlc
parent4d3edd80a2216db9e44594bc2b001410392147f4 (diff)
downloadorg.eclipse.cdt-8cdd50422c0f17797b02f93ff2fb238adac7a3b1.tar.gz
org.eclipse.cdt-8cdd50422c0f17797b02f93ff2fb238adac7a3b1.tar.xz
org.eclipse.cdt-8cdd50422c0f17797b02f93ff2fb238adac7a3b1.zip
bug 323445: Generate cross linked message for redeclaration xlc error
Diffstat (limited to 'xlc')
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java1
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestRedeclaration.java46
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties3
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc/plugin.xml1
4 files changed, 51 insertions, 0 deletions
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java
index 948a405944..df4a98f677 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java
@@ -33,6 +33,7 @@ public class AllXlcErrorParserTests {
suite.addTestSuite(TestCompatibility.class);
suite.addTestSuite(TestUnrecoverableError.class);
suite.addTestSuite(TestMacroRedefinition.class);
+ suite.addTestSuite(TestRedeclaration.class);
suite.addTestSuite(TestLinkerUndefinedSymbol.class);
suite.addTestSuite(TestLinkerDuplicateSymbol.class);
suite.addTestSuite(TestLinkerSevereError.class);
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestRedeclaration.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestRedeclaration.java
new file mode 100644
index 0000000000..134d4a5196
--- /dev/null
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestRedeclaration.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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
+ *******************************************************************************/
+package org.eclipse.cdt.errorparsers.xlc.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.cdt.core.IMarkerGenerator;
+
+public class TestRedeclaration extends TestCase {
+ /**
+ * This function tests parseLine function of the
+ * XlcErrorParser class. The second message generated by
+ * xlc compiler for symbol redeclaration problem is given as
+ * input for testing.
+ */
+ public void testparseLine()
+ {
+ XlcErrorParserTester aix = new XlcErrorParserTester();
+ // Redeclaration warning generates 2 cross-referencing messages.
+ String err_msg = "\"src/temp1.c\", line 6.6: 1506-343 (S) Redeclaration of fun differs from previous declaration on line 334 of \"include/temp1.h\".";
+ aix.parseLine(err_msg);
+ assertEquals(2, aix.getNumberOfMarkers());
+
+ assertEquals("Redeclaration of fun differs from another declaration on line 6 of \"src/temp1.c\".", aix.getMessage(0));
+ assertEquals("temp1.h", aix.getFileName(0));
+ assertEquals(334, aix.getLineNumber(0));
+ assertEquals(IMarkerGenerator.SEVERITY_INFO, aix.getSeverity(0));
+
+ assertEquals("Redeclaration of fun differs from previous declaration on line 334 of \"include/temp1.h\".", aix.getMessage(1));
+ assertEquals("temp1.c", aix.getFileName(1));
+ assertEquals(6, aix.getLineNumber(1));
+ assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity(1));
+ }
+ public TestRedeclaration( String name)
+ {
+ super(name);
+ }
+} \ No newline at end of file
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties b/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties
index 916d7f3177..f2a22c4eb1 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties
@@ -28,6 +28,9 @@ CDTXLCErrorParser.pattern.macro=["]?(.*?)["]?, line ([0-9]+)\\.[0-9]+:( [0-9]*-[
CDTXLCErrorParser.pattern.macro.replacement=Macro name $4 has been redefined on line $2 of $1
CDTXLCErrorParser.pattern.macro.crossreference=Macro name $4 redefines macro originally defined on line $5 of $6
CDTXLCErrorParser.pattern.macro.ignore=["]?(.*?)["]?, line ([0-9]+)\\.[0-9]+:( [0-9]*-[0-9]*)? \\(W\\)\\s*Macro name .* has been redefined\\.
+# "src/temp1.c", line 6.6: 1506-343 (S) Redeclaration of fun differs from previous declaration on line 334 of "include/temp1.h".
+CDTXLCErrorParser.pattern.redeclaration=["]?(.*?)["]?, line ([0-9]+)\\.[0-9]+:( [0-9]*-[0-9]*)? \\(S\\)\\s*Redeclaration of (\\w+) differs from previous declaration on line (\\d+) of "(.*)"\\.
+CDTXLCErrorParser.pattern.redeclaration.crossreference=Redeclaration of $4 differs from another declaration on line $2 of "$1".
# "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*(.*)
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.xml b/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.xml
index 3dd9c5aab8..6fd505ab16 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.xml
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.xml
@@ -9,6 +9,7 @@
<pattern regex="%CDTXLCErrorParser.pattern.macro.ignore" severity="Ignore" file-expr="" line-expr="" description-expr="" eat-processed-line="true" />
<pattern regex="%CDTXLCErrorParser.pattern.macro" severity="Warning" file-expr="$6" line-expr="$5" description-expr="%CDTXLCErrorParser.pattern.macro.replacement" eat-processed-line="false" />
<pattern regex="%CDTXLCErrorParser.pattern.macro" severity="Warning" file-expr="$1" line-expr="$2" description-expr="%CDTXLCErrorParser.pattern.macro.crossreference" eat-processed-line="true" />
+ <pattern regex="%CDTXLCErrorParser.pattern.redeclaration" severity="Info" file-expr="$6" line-expr="$5" description-expr="%CDTXLCErrorParser.pattern.redeclaration.crossreference" eat-processed-line="false" />
<pattern regex="%CDTXLCErrorParser.pattern.error" severity="Error" file-expr="$1" line-expr="$2" description-expr="$4" eat-processed-line="true"/>
<pattern regex="%CDTXLCErrorParser.pattern.warning" severity="Warning" file-expr="$1" line-expr="$2" description-expr="$4" eat-processed-line="true"/>
<pattern regex="%CDTXLCErrorParser.pattern.info" severity="Info" file-expr="$1" line-expr="$2" description-expr="$4" eat-processed-line="true"/>

Back to the top