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 df4a98f6773..f8973e86fb7 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 @@ -32,7 +32,7 @@ public class AllXlcErrorParserTests { suite.addTestSuite(TestNoFuncProto.class); suite.addTestSuite(TestCompatibility.class); suite.addTestSuite(TestUnrecoverableError.class); - suite.addTestSuite(TestMacroRedefinition.class); + suite.addTestSuite(TestRedefinition.class); suite.addTestSuite(TestRedeclaration.class); suite.addTestSuite(TestLinkerUndefinedSymbol.class); suite.addTestSuite(TestLinkerDuplicateSymbol.class); diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestMacroRedefinition.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestMacroRedefinition.java index c890612a916..82b20113bcd 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestMacroRedefinition.java +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestMacroRedefinition.java @@ -18,7 +18,7 @@ public class TestMacroRedefinition extends TestCase { /** * This function tests parseLine function of the * XlcErrorParser class. The second message generated by - * xlc compiler for macro redefinition problem is given as + * xlc compiler for macro/variable redefinition problem is given as * input for testing. */ public void testparseLine() @@ -28,19 +28,32 @@ public class TestMacroRedefinition extends TestCase { // Second line is re-parsed to 2 warnings to cross-reference both. String err_msg1 = "\"temp1.c\", line 5.9: 1506-236 (W) Macro name TEMP_1 has been redefined."; String err_msg2 = "\"temp1.c\", line 5.9: 1506-358 (I) \"TEMP_1\" is defined on line 3 of temp1.h."; + // variation of the message + String err_msg3 = "\"temp2.c\", line 17.9: 1506-358 (I) \"MACRO_2\" is defined on line 10 of \"temp2.c\"."; aix.parseLine(err_msg1); aix.parseLine(err_msg2); - assertEquals(2, aix.getNumberOfMarkers()); + aix.parseLine(err_msg3); + assertEquals(4, aix.getNumberOfMarkers()); - assertEquals("Macro name TEMP_1 has been redefined on line 5 of temp1.c", aix.getMessage(0)); + assertEquals("\"TEMP_1\" has been redefined on line 5 of temp1.c", aix.getMessage(0)); assertEquals("temp1.h", aix.getFileName(0)); assertEquals(3, aix.getLineNumber(0)); assertEquals(IMarkerGenerator.SEVERITY_WARNING, aix.getSeverity(0)); - assertEquals("Macro name TEMP_1 redefines macro originally defined on line 3 of temp1.h", aix.getMessage(1)); + assertEquals("\"TEMP_1\" redefines original definition on line 3 of temp1.h", aix.getMessage(1)); assertEquals("temp1.c", aix.getFileName(1)); assertEquals(5, aix.getLineNumber(1)); assertEquals(IMarkerGenerator.SEVERITY_WARNING, aix.getSeverity(1)); + + assertEquals("\"MACRO_2\" has been redefined on line 17 of temp2.c", aix.getMessage(2)); + assertEquals("temp2.c", aix.getFileName(2)); + assertEquals(10, aix.getLineNumber(2)); + assertEquals(IMarkerGenerator.SEVERITY_WARNING, aix.getSeverity(2)); + + assertEquals("\"MACRO_2\" redefines original definition on line 10 of temp2.c", aix.getMessage(3)); + assertEquals("temp2.c", aix.getFileName(3)); + assertEquals(17, aix.getLineNumber(3)); + assertEquals(IMarkerGenerator.SEVERITY_WARNING, aix.getSeverity(3)); } public TestMacroRedefinition( String name) { diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties b/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties index f2a22c4eb1b..405a9e7419a 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties +++ b/xlc/org.eclipse.cdt.errorparsers.xlc/plugin.properties @@ -24,17 +24,17 @@ CDTXLCErrorParser.name=CDT xlC Error Parser # START NON-TRANSLATABLE # "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 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\\. +CDTXLCErrorParser.pattern.macro="?([^"]*)"?, line ([0-9]+)\\.[0-9]+:( [0-9]*-[0-9]*)? \\(I\\)\\s*(.*) is defined on line ([0-9]+) of "?([^"]*)"?\\. +CDTXLCErrorParser.pattern.macro.replacement=$4 has been redefined on line $2 of $1 +CDTXLCErrorParser.pattern.macro.crossreference=$4 redefines original definition 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="?([^"]*)"?, 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*(.*) -CDTXLCErrorParser.pattern.info=["]?(.*?)["]?, line ([0-9]+)\\.[0-9]+:( [0-9]*-[0-9]*)? \\(I\\)\\s*(.*) +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*(.*)