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 948a405944a..df4a98f6773 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 00000000000..134d4a51962 --- /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 916d7f31777..f2a22c4eb1b 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 3dd9c5aab8a..6fd505ab16f 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.xml +++ b/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.xml @@ -9,6 +9,7 @@ +