mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
RESOLVED - bug 258385: xlC error parser should extend AbstractErrorParser (to disambiguate files with the same name)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=258385
This commit is contained in:
parent
61b9542da8
commit
5358c015a3
23 changed files with 683 additions and 240 deletions
|
@ -6,6 +6,8 @@ Bundle-Version: 1.0.0
|
||||||
Bundle-Activator: org.eclipse.cdt.errorparsers.xlc.tests.TestsPlugin
|
Bundle-Activator: org.eclipse.cdt.errorparsers.xlc.tests.TestsPlugin
|
||||||
Require-Bundle: org.eclipse.ui,
|
Require-Bundle: org.eclipse.ui,
|
||||||
org.eclipse.core.runtime,
|
org.eclipse.core.runtime,
|
||||||
|
org.eclipse.core.resources,
|
||||||
|
org.eclipse.cdt.core,
|
||||||
org.eclipse.cdt.errorparsers.xlc,
|
org.eclipse.cdt.errorparsers.xlc,
|
||||||
org.junit
|
org.junit
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
|
|
|
@ -30,6 +30,14 @@ public class AllXlcErrorParserTests {
|
||||||
suite.addTestSuite(TestConditional.class);
|
suite.addTestSuite(TestConditional.class);
|
||||||
suite.addTestSuite(TestSyntaxError.class);
|
suite.addTestSuite(TestSyntaxError.class);
|
||||||
suite.addTestSuite(TestNoFuncProto.class);
|
suite.addTestSuite(TestNoFuncProto.class);
|
||||||
|
suite.addTestSuite(TestCompatibility.class);
|
||||||
|
suite.addTestSuite(TestUnrecoverableError.class);
|
||||||
|
suite.addTestSuite(TestMacroRedefinition.class);
|
||||||
|
suite.addTestSuite(TestLinkerUndefinedSymbol.class);
|
||||||
|
suite.addTestSuite(TestLinkerDuplicateSymbol.class);
|
||||||
|
suite.addTestSuite(TestLinkerSevereError.class);
|
||||||
|
suite.addTestSuite(TestLinkerErrorWhileReading.class);
|
||||||
|
suite.addTestSuite(TestLinkerInfo.class);
|
||||||
//$JUnit-END$
|
//$JUnit-END$
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006 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 TestCompatibility extends TestCase {
|
||||||
|
String err_msg;
|
||||||
|
/**
|
||||||
|
* This function tests parseLine function of the
|
||||||
|
* XlcErrorParser class. Error message generated by
|
||||||
|
* xlC compiler without message number or quotes around file name
|
||||||
|
* which was OK in older version.
|
||||||
|
*/
|
||||||
|
public void testparseLine()
|
||||||
|
{
|
||||||
|
XlcErrorParserTester aix = new XlcErrorParserTester();
|
||||||
|
aix.parseLine(err_msg);
|
||||||
|
assertEquals("temp1.c", aix.getFileName());
|
||||||
|
assertEquals(5, aix.getLineNumber());
|
||||||
|
assertEquals(IMarkerGenerator.SEVERITY_INFO, aix.getSeverity());
|
||||||
|
assertEquals(" Compatibility test",aix.getMessage());
|
||||||
|
}
|
||||||
|
public TestCompatibility( String name)
|
||||||
|
{
|
||||||
|
super(name);
|
||||||
|
err_msg = "temp1.c, line 5.1: (I) Compatibility test";
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,10 +11,10 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.errorparsers.xlc.tests;
|
package org.eclipse.cdt.errorparsers.xlc.tests;
|
||||||
|
|
||||||
import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
|
|
||||||
|
|
||||||
public class TestConditional extends TestCase {
|
public class TestConditional extends TestCase {
|
||||||
String err_msg;
|
String err_msg;
|
||||||
|
@ -25,11 +25,11 @@ public class TestConditional extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testparseLine()
|
public void testparseLine()
|
||||||
{
|
{
|
||||||
XlcErrorParser aix = new XlcErrorParser();
|
XlcErrorParserTester aix = new XlcErrorParserTester();
|
||||||
aix.parseLine(err_msg);
|
aix.parseLine(err_msg);
|
||||||
assertEquals("temp8.c", aix.getFileName());
|
assertEquals("temp8.c", aix.getFileName());
|
||||||
assertEquals(12, aix.getLineNumber());
|
assertEquals(12, aix.getLineNumber());
|
||||||
assertEquals("I", aix.getSeverity());
|
assertEquals(IMarkerGenerator.SEVERITY_INFO, aix.getSeverity());
|
||||||
assertEquals(" The then branch of conditional is an empty statement.",aix.getMessage());
|
assertEquals(" The then branch of conditional is an empty statement.",aix.getMessage());
|
||||||
}
|
}
|
||||||
public TestConditional( String name)
|
public TestConditional( String name)
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.errorparsers.xlc.tests;
|
package org.eclipse.cdt.errorparsers.xlc.tests;
|
||||||
|
|
||||||
import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
|
|
||||||
|
|
||||||
public class TestFloatingPoint extends TestCase {
|
public class TestFloatingPoint extends TestCase {
|
||||||
String err_msg;
|
String err_msg;
|
||||||
|
@ -26,11 +26,11 @@ public class TestFloatingPoint extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testparseLine()
|
public void testparseLine()
|
||||||
{
|
{
|
||||||
XlcErrorParser aix = new XlcErrorParser();
|
XlcErrorParserTester aix = new XlcErrorParserTester();
|
||||||
aix.parseLine(err_msg);
|
aix.parseLine(err_msg);
|
||||||
assertEquals("temp9.c", aix.getFileName());
|
assertEquals("temp9.c", aix.getFileName());
|
||||||
assertEquals(11, aix.getLineNumber());
|
assertEquals(11, aix.getLineNumber());
|
||||||
assertEquals("S", aix.getSeverity());
|
assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
|
||||||
assertEquals(" Floating point constant 10.23.3 is not valid",
|
assertEquals(" Floating point constant 10.23.3 is not valid",
|
||||||
aix.getMessage());
|
aix.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.errorparsers.xlc.tests;
|
package org.eclipse.cdt.errorparsers.xlc.tests;
|
||||||
|
|
||||||
import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
|
|
||||||
public class TestFuncArg extends TestCase {
|
public class TestFuncArg extends TestCase {
|
||||||
String err_msg;
|
String err_msg;
|
||||||
/**
|
/**
|
||||||
|
@ -25,11 +25,11 @@ public class TestFuncArg extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testparseLine()
|
public void testparseLine()
|
||||||
{
|
{
|
||||||
XlcErrorParser aix = new XlcErrorParser();
|
XlcErrorParserTester aix = new XlcErrorParserTester();
|
||||||
aix.parseLine(err_msg);
|
aix.parseLine(err_msg);
|
||||||
assertEquals("temp9.c", aix.getFileName());
|
assertEquals("temp9.c", aix.getFileName());
|
||||||
assertEquals(12, aix.getLineNumber());
|
assertEquals(12, aix.getLineNumber());
|
||||||
assertEquals("S", aix.getSeverity());
|
assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
|
||||||
assertEquals(" Function argument assignment between types " +
|
assertEquals(" Function argument assignment between types " +
|
||||||
"\"int\" and \"char*\" is not allowed.",
|
"\"int\" and \"char*\" is not allowed.",
|
||||||
aix.getMessage());
|
aix.getMessage());
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006 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 TestLinkerDuplicateSymbol extends TestCase {
|
||||||
|
String err_msg;
|
||||||
|
/**
|
||||||
|
* This function tests parseLine function of the
|
||||||
|
* XlcErrorParser class. Error message generated by
|
||||||
|
* xlc linker with "WARNING" level is given as
|
||||||
|
* input for testing.
|
||||||
|
*/
|
||||||
|
public void testparseLine()
|
||||||
|
{
|
||||||
|
XlcErrorParserTester aix = new XlcErrorParserTester();
|
||||||
|
aix.parseLine(err_msg);
|
||||||
|
assertEquals("", aix.getFileName());
|
||||||
|
assertEquals(0, aix.getLineNumber());
|
||||||
|
assertEquals(IMarkerGenerator.SEVERITY_WARNING, aix.getSeverity());
|
||||||
|
assertEquals("Duplicate symbol: dupefun",aix.getMessage());
|
||||||
|
}
|
||||||
|
public TestLinkerDuplicateSymbol( String name)
|
||||||
|
{
|
||||||
|
super(name);
|
||||||
|
err_msg = "ld: 0711-224 WARNING: Duplicate symbol: dupefun";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006 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 TestLinkerErrorWhileReading extends TestCase {
|
||||||
|
String err_msg;
|
||||||
|
/**
|
||||||
|
* This function tests parseLine function of the
|
||||||
|
* XlcErrorParser class. Error message generated by
|
||||||
|
* xlc linker with "ERROR" level is given as
|
||||||
|
* input for testing.
|
||||||
|
*/
|
||||||
|
public void testparseLine()
|
||||||
|
{
|
||||||
|
XlcErrorParserTester aix = new XlcErrorParserTester();
|
||||||
|
aix.parseLine(err_msg);
|
||||||
|
assertEquals("", aix.getFileName());
|
||||||
|
assertEquals(0, aix.getLineNumber());
|
||||||
|
assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
|
||||||
|
assertEquals("Error occurred while reading file",aix.getMessage());
|
||||||
|
}
|
||||||
|
public TestLinkerErrorWhileReading( String name)
|
||||||
|
{
|
||||||
|
super(name);
|
||||||
|
err_msg = "ld: 0711-987 Error occurred while reading file";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006 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 TestLinkerInfo extends TestCase {
|
||||||
|
String err_msg;
|
||||||
|
/**
|
||||||
|
* This function tests parseLine function of the
|
||||||
|
* XlcErrorParser class. Informational message generated by
|
||||||
|
* xlc linker is given as
|
||||||
|
* input for testing.
|
||||||
|
*/
|
||||||
|
public void testparseLine()
|
||||||
|
{
|
||||||
|
XlcErrorParserTester aix = new XlcErrorParserTester();
|
||||||
|
aix.parseLine(err_msg);
|
||||||
|
assertEquals("", aix.getFileName());
|
||||||
|
assertEquals(0, aix.getLineNumber());
|
||||||
|
assertEquals(IMarkerGenerator.SEVERITY_INFO, aix.getSeverity());
|
||||||
|
assertEquals("Use the -bloadmap or -bnoquiet option to obtain more information.",aix.getMessage());
|
||||||
|
}
|
||||||
|
public TestLinkerInfo( String name)
|
||||||
|
{
|
||||||
|
super(name);
|
||||||
|
err_msg = "ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006 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 TestLinkerSevereError extends TestCase {
|
||||||
|
String err_msg;
|
||||||
|
/**
|
||||||
|
* This function tests parseLine function of the
|
||||||
|
* XlcErrorParser class. Error message generated by
|
||||||
|
* xlc linker with "SEVERE ERROR" level is given as
|
||||||
|
* input for testing.
|
||||||
|
*/
|
||||||
|
public void testparseLine()
|
||||||
|
{
|
||||||
|
XlcErrorParserTester aix = new XlcErrorParserTester();
|
||||||
|
aix.parseLine(err_msg);
|
||||||
|
assertEquals("", aix.getFileName());
|
||||||
|
assertEquals(0, aix.getLineNumber());
|
||||||
|
assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
|
||||||
|
assertEquals("EXEC binder commands nested too deeply.",aix.getMessage());
|
||||||
|
}
|
||||||
|
public TestLinkerSevereError( String name)
|
||||||
|
{
|
||||||
|
super(name);
|
||||||
|
err_msg = "ld: 0711-634 SEVERE ERROR: EXEC binder commands nested too deeply.";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006 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 TestLinkerUndefinedSymbol extends TestCase {
|
||||||
|
String err_msg;
|
||||||
|
/**
|
||||||
|
* This function tests parseLine function of the
|
||||||
|
* XlcErrorParser class. Error message generated by
|
||||||
|
* xlc linker with "ERROR" level is given as
|
||||||
|
* input for testing.
|
||||||
|
*/
|
||||||
|
public void testparseLine()
|
||||||
|
{
|
||||||
|
XlcErrorParserTester aix = new XlcErrorParserTester();
|
||||||
|
aix.parseLine(err_msg);
|
||||||
|
assertEquals("", aix.getFileName());
|
||||||
|
assertEquals(0, aix.getLineNumber());
|
||||||
|
assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
|
||||||
|
assertEquals("Undefined symbol: nofun()",aix.getMessage());
|
||||||
|
}
|
||||||
|
public TestLinkerUndefinedSymbol( String name)
|
||||||
|
{
|
||||||
|
super(name);
|
||||||
|
err_msg = "ld: 0711-317 ERROR: Undefined symbol: nofun()";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006 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 TestMacroRedefinition extends TestCase {
|
||||||
|
String err_msg;
|
||||||
|
/**
|
||||||
|
* This function tests parseLine function of the
|
||||||
|
* XlcErrorParser class. The second message generated by
|
||||||
|
* xlc compiler for macro redefinition problem is given as
|
||||||
|
* input for testing.
|
||||||
|
*/
|
||||||
|
public void testparseLine()
|
||||||
|
{
|
||||||
|
XlcErrorParserTester aix = new XlcErrorParserTester();
|
||||||
|
aix.parseLine(err_msg);
|
||||||
|
assertEquals("temp1.h", aix.getFileName());
|
||||||
|
assertEquals(3, aix.getLineNumber());
|
||||||
|
assertEquals(IMarkerGenerator.SEVERITY_WARNING, aix.getSeverity());
|
||||||
|
assertEquals(" Macro name TEMP_1 originally defined in file temp1.h",aix.getMessage());
|
||||||
|
}
|
||||||
|
public TestMacroRedefinition( String name)
|
||||||
|
{
|
||||||
|
super(name);
|
||||||
|
// Macro redefinition warning provides 2 lines. First line is captured as regular warning message.
|
||||||
|
// "temp1.c", line 5.9: 1506-236 (W) Macro name TEMP_1 has been redefined.
|
||||||
|
// Second line is re-parsed to stay close to the first one and point to file with original definition
|
||||||
|
err_msg = "\"temp1.c\", line 5.9: 1506-358 (I) \"TEMP_1\" is defined on line 3 of temp1.h.";
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,10 +11,10 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.errorparsers.xlc.tests;
|
package org.eclipse.cdt.errorparsers.xlc.tests;
|
||||||
|
|
||||||
import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
|
|
||||||
|
|
||||||
public class TestMissingArg extends TestCase {
|
public class TestMissingArg extends TestCase {
|
||||||
String err_msg;
|
String err_msg;
|
||||||
|
@ -26,11 +26,11 @@ public class TestMissingArg extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testparseLine()
|
public void testparseLine()
|
||||||
{
|
{
|
||||||
XlcErrorParser aix = new XlcErrorParser();
|
XlcErrorParserTester aix = new XlcErrorParserTester();
|
||||||
aix.parseLine(err_msg);
|
aix.parseLine(err_msg);
|
||||||
assertEquals("temp8.c", aix.getFileName());
|
assertEquals("temp8.c", aix.getFileName());
|
||||||
assertEquals(9, aix.getLineNumber());
|
assertEquals(9, aix.getLineNumber());
|
||||||
assertEquals("E", aix.getSeverity());
|
assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
|
||||||
assertEquals(" Missing argument(s).",aix.getMessage());
|
assertEquals(" Missing argument(s).",aix.getMessage());
|
||||||
}
|
}
|
||||||
public TestMissingArg( String name)
|
public TestMissingArg( String name)
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.errorparsers.xlc.tests;
|
package org.eclipse.cdt.errorparsers.xlc.tests;
|
||||||
|
|
||||||
import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
|
|
||||||
public class TestNoFuncProto extends TestCase {
|
public class TestNoFuncProto extends TestCase {
|
||||||
String err_msg;
|
String err_msg;
|
||||||
/**
|
/**
|
||||||
|
@ -23,11 +23,11 @@ public class TestNoFuncProto extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testparseLine()
|
public void testparseLine()
|
||||||
{
|
{
|
||||||
XlcErrorParser aix = new XlcErrorParser();
|
XlcErrorParserTester aix = new XlcErrorParserTester();
|
||||||
aix.parseLine(err_msg);
|
aix.parseLine(err_msg);
|
||||||
assertEquals("temp1.c", aix.getFileName());
|
assertEquals("temp1.c", aix.getFileName());
|
||||||
assertEquals(5, aix.getLineNumber());
|
assertEquals(5, aix.getLineNumber());
|
||||||
assertEquals("W", aix.getSeverity());
|
assertEquals(IMarkerGenerator.SEVERITY_WARNING, aix.getSeverity());
|
||||||
assertEquals(" No function prototype given for \"printf\".",aix.getMessage());
|
assertEquals(" No function prototype given for \"printf\".",aix.getMessage());
|
||||||
}
|
}
|
||||||
public TestNoFuncProto( String name)
|
public TestNoFuncProto( String name)
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.errorparsers.xlc.tests;
|
package org.eclipse.cdt.errorparsers.xlc.tests;
|
||||||
|
|
||||||
import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
|
|
||||||
|
|
||||||
public class TestOperModi extends TestCase {
|
public class TestOperModi extends TestCase {
|
||||||
String err_msg;
|
String err_msg;
|
||||||
|
@ -25,11 +25,11 @@ public class TestOperModi extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testparseLine()
|
public void testparseLine()
|
||||||
{
|
{
|
||||||
XlcErrorParser aix = new XlcErrorParser();
|
XlcErrorParserTester aix = new XlcErrorParserTester();
|
||||||
aix.parseLine(err_msg);
|
aix.parseLine(err_msg);
|
||||||
assertEquals("temp9.c", aix.getFileName());
|
assertEquals("temp9.c", aix.getFileName());
|
||||||
assertEquals(13, aix.getLineNumber());
|
assertEquals(13, aix.getLineNumber());
|
||||||
assertEquals("S", aix.getSeverity());
|
assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
|
||||||
assertEquals(" Operand must be a modifiable lvalue.",aix.getMessage());
|
assertEquals(" Operand must be a modifiable lvalue.",aix.getMessage());
|
||||||
}
|
}
|
||||||
public TestOperModi( String name)
|
public TestOperModi( String name)
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.errorparsers.xlc.tests;
|
package org.eclipse.cdt.errorparsers.xlc.tests;
|
||||||
|
|
||||||
import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
|
|
||||||
public class TestSyntaxError extends TestCase {
|
public class TestSyntaxError extends TestCase {
|
||||||
String err_msg;
|
String err_msg;
|
||||||
/**
|
/**
|
||||||
|
@ -24,11 +24,11 @@ public class TestSyntaxError extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testparseLine()
|
public void testparseLine()
|
||||||
{
|
{
|
||||||
XlcErrorParser aix = new XlcErrorParser();
|
XlcErrorParserTester aix = new XlcErrorParserTester();
|
||||||
aix.parseLine(err_msg);
|
aix.parseLine(err_msg);
|
||||||
assertEquals("temp1.c", aix.getFileName());
|
assertEquals("temp1.c", aix.getFileName());
|
||||||
assertEquals(5, aix.getLineNumber());
|
assertEquals(5, aix.getLineNumber());
|
||||||
assertEquals("S", aix.getSeverity());
|
assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
|
||||||
assertEquals(" Syntax error: possible missing ')'?",aix.getMessage());
|
assertEquals(" Syntax error: possible missing ')'?",aix.getMessage());
|
||||||
}
|
}
|
||||||
public TestSyntaxError( String name)
|
public TestSyntaxError( String name)
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.errorparsers.xlc.tests;
|
package org.eclipse.cdt.errorparsers.xlc.tests;
|
||||||
|
|
||||||
import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
|
|
||||||
public class TestUndeclIdent extends TestCase {
|
public class TestUndeclIdent extends TestCase {
|
||||||
String err_msg;
|
String err_msg;
|
||||||
/**
|
/**
|
||||||
|
@ -25,11 +25,11 @@ public class TestUndeclIdent extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testparseLine()
|
public void testparseLine()
|
||||||
{
|
{
|
||||||
XlcErrorParser aix = new XlcErrorParser();
|
XlcErrorParserTester aix = new XlcErrorParserTester();
|
||||||
aix.parseLine(err_msg);
|
aix.parseLine(err_msg);
|
||||||
assertEquals("temp5.c", aix.getFileName());
|
assertEquals("temp5.c", aix.getFileName());
|
||||||
assertEquals(5, aix.getLineNumber());
|
assertEquals(5, aix.getLineNumber());
|
||||||
assertEquals("S", aix.getSeverity());
|
assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
|
||||||
assertEquals(" Undeclared identifier y.",aix.getMessage());
|
assertEquals(" Undeclared identifier y.",aix.getMessage());
|
||||||
}
|
}
|
||||||
public TestUndeclIdent( String name)
|
public TestUndeclIdent( String name)
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006 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 TestUnrecoverableError extends TestCase {
|
||||||
|
String err_msg;
|
||||||
|
/**
|
||||||
|
* This function tests parseLine function of the
|
||||||
|
* XlcErrorParser class. Error message generated by
|
||||||
|
* xlc compiler with unrecoverable severity (U) is given as
|
||||||
|
* input for testing.
|
||||||
|
*/
|
||||||
|
public void testparseLine()
|
||||||
|
{
|
||||||
|
XlcErrorParserTester aix = new XlcErrorParserTester();
|
||||||
|
aix.parseLine(err_msg);
|
||||||
|
assertEquals("temp1.c", aix.getFileName());
|
||||||
|
assertEquals(5, aix.getLineNumber());
|
||||||
|
assertEquals(IMarkerGenerator.SEVERITY_ERROR_BUILD, aix.getSeverity());
|
||||||
|
assertEquals(" INTERNAL COMPILER ERROR",aix.getMessage());
|
||||||
|
}
|
||||||
|
public TestUnrecoverableError( String name)
|
||||||
|
{
|
||||||
|
super(name);
|
||||||
|
err_msg = "\"temp1.c\", line 5.1: 1506-001 (U) "
|
||||||
|
+ "INTERNAL COMPILER ERROR";
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,10 +11,12 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.errorparsers.xlc.tests;
|
package org.eclipse.cdt.errorparsers.xlc.tests;
|
||||||
|
|
||||||
import org.eclipse.ui.plugin.*;
|
import java.util.MissingResourceException;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main plugin class to be used in the desktop.
|
* The main plugin class to be used in the desktop.
|
||||||
|
|
|
@ -0,0 +1,133 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
* Andrew Gvozdev
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.errorparsers.xlc.tests;
|
||||||
|
|
||||||
|
import junit.framework.Assert;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.ErrorParserManager;
|
||||||
|
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;
|
||||||
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Helper tester class to be able to test XlcErrorParser which extends AbstractErrorParser.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class XlcErrorParserTester {
|
||||||
|
static private int counter=0;
|
||||||
|
IProject fTempProject = ResourcesPlugin.getWorkspace().getRoot().getProject("XlcErrorParserTester.temp." + counter++);
|
||||||
|
|
||||||
|
XlcErrorParserTester() {
|
||||||
|
try {
|
||||||
|
fTempProject.create(null);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Assert.fail("Exception creating temporary project "+fTempProject.getName()+": "+e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String fileName;
|
||||||
|
private int lineNumber;
|
||||||
|
private int severity;
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Dummy class implementing IMarkerGenerator lets get through testing
|
||||||
|
* without NPE.
|
||||||
|
*/
|
||||||
|
private class MockMarkerGenerator implements IMarkerGenerator {
|
||||||
|
|
||||||
|
public void addMarker(IResource file, int lineNumber, String errorDesc,
|
||||||
|
int severity, String errorVar) {
|
||||||
|
// dummy
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMarker(ProblemMarkerInfo problemMarkerInfo) {
|
||||||
|
// dummy
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class MockErrorParserManager replaces ErrorParserManager
|
||||||
|
* with the purpose to be able to inquire how the line was parsed.
|
||||||
|
* fileName, lineNumber, message and severity are populated
|
||||||
|
* to be accessed from the test cases.
|
||||||
|
* Relying on internal implementation of ErrorPattern.RecordError()
|
||||||
|
* to provide necessary data via generateExternalMarker() call
|
||||||
|
*/
|
||||||
|
private class MockErrorParserManager extends ErrorParserManager {
|
||||||
|
|
||||||
|
private MockErrorParserManager() {
|
||||||
|
super(fTempProject, new MockMarkerGenerator());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A stub function just to return non-null IFile.
|
||||||
|
* Necessary to trick ErrorPattern.RecordError() to generate markers.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IFile findFileName(String fileName) {
|
||||||
|
return fTempProject.getFile(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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();
|
||||||
|
} else {
|
||||||
|
fileName="";
|
||||||
|
}
|
||||||
|
lineNumber = lineNumb;
|
||||||
|
message = desc;
|
||||||
|
severity = sev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main method called by individual error parser tests.
|
||||||
|
* @param line one xlC error message
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean parseLine(String line) {
|
||||||
|
XlcErrorParser errorParser = new XlcErrorParser();
|
||||||
|
|
||||||
|
MockErrorParserManager epManager = new MockErrorParserManager();
|
||||||
|
return errorParser.processLine(line, epManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getFileName() {
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getLineNumber() {
|
||||||
|
return lineNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getSeverity() {
|
||||||
|
return severity;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,225 +1,127 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2008 IBM Corporation and others.
|
* Copyright (c) 2006, 2008 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
|
* Andrew Gvozdev (Quoin Inc.)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package org.eclipse.cdt.errorparsers.xlc;
|
package org.eclipse.cdt.errorparsers.xlc;
|
||||||
|
|
||||||
import java.util.StringTokenizer;
|
|
||||||
import org.eclipse.cdt.core.ErrorParserManager;
|
|
||||||
import org.eclipse.cdt.core.IErrorParser;
|
|
||||||
import org.eclipse.cdt.core.IMarkerGenerator;
|
|
||||||
import org.eclipse.core.resources.IFile;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides methods for parsing the error messages
|
* This class provides for parsing the error messages generated by IBM AIX xlC compiler.
|
||||||
* generated by xlc compiler.
|
|
||||||
* @author ravisankar
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class XlcErrorParser implements IErrorParser
|
|
||||||
{
|
import java.util.regex.Matcher;
|
||||||
private String fileName;
|
|
||||||
private int lineNumber;
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
private String severity;
|
import org.eclipse.cdt.core.errorparsers.AbstractErrorParser;
|
||||||
private String message;
|
import org.eclipse.cdt.core.errorparsers.ErrorPattern;
|
||||||
private int severityNum;
|
|
||||||
public XlcErrorParser()
|
/**
|
||||||
{
|
* Class XlcErrorParser provides for parsing of error output messages
|
||||||
fileName = null;
|
* produced by AIX xlC compiler and linker.
|
||||||
lineNumber = -1;
|
*
|
||||||
severity = null;
|
* @see org.eclipse.cdt.core.errorparsers.AbstractErrorParser
|
||||||
message = null;
|
* @see org.eclipse.cdt.core.errorparsers.ErrorPattern
|
||||||
severityNum = -1;
|
*/
|
||||||
}
|
public class XlcErrorParser extends AbstractErrorParser {
|
||||||
/**
|
private static final ErrorPattern[] patterns = {
|
||||||
* This function returns the file name extracted from
|
/**
|
||||||
* the error message.
|
* xlC produces 2 warning messages in case of macro redefinition:
|
||||||
* @return The string value of the given file name.
|
* "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.
|
||||||
public String getFileName()
|
* Both can be captured by regular XlcErrorParser_CompilerErrorPattern. However
|
||||||
{
|
* different severity puts them apart in different groups. In addition
|
||||||
return fileName;
|
* the second entry in Problems view won't let you jump to the original definition.
|
||||||
}
|
* This ErrorPattern fixes those shortcomings.
|
||||||
/**
|
*/
|
||||||
* This function returns the line number of
|
new ErrorPattern(Messages.XlcErrorParser_MacroRedefinitionErrorPattern, 6, 5, -1, 0, -1) {
|
||||||
* the error.
|
/*
|
||||||
* @return The integer value of the line number.
|
* @see org.eclipse.cdt.core.errorparsers.ErrorPattern#getSeverity(java.util.regex.Matcher)
|
||||||
*/
|
|
||||||
public int getLineNumber()
|
|
||||||
{
|
|
||||||
return lineNumber;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This function returns the severity of the
|
|
||||||
* error that has occured.
|
|
||||||
* @return The string value of the severity.
|
|
||||||
*/
|
|
||||||
public String getSeverity()
|
|
||||||
{
|
|
||||||
return severity;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This function returns the descriptive string of the
|
|
||||||
* error that has occured.
|
|
||||||
* @return The string value of the message.
|
|
||||||
*/
|
|
||||||
public String getMessage()
|
|
||||||
{
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This function parses the error message occured and fills the
|
|
||||||
* class variables fileName, lineNumber, message, severity.
|
|
||||||
* @param line is the error message generated by the xlC compiler.
|
|
||||||
* @return a boolean value indicating the success/failure of
|
|
||||||
* extracting the values for fileName, lineNumber, message, severity.
|
|
||||||
*/
|
|
||||||
public boolean parseLine(String line)
|
|
||||||
{
|
|
||||||
String lineNum = null;
|
|
||||||
String secondPart = null;
|
|
||||||
StringTokenizer tok = null;
|
|
||||||
int firstComma = line.indexOf(','); //$NON-NLS-1$
|
|
||||||
// Check for the first occurance of comma.
|
|
||||||
if( firstComma != -1 )
|
|
||||||
{
|
|
||||||
String firstPart = line.substring(0,firstComma);
|
|
||||||
/* Check for double-quotes before the first occurance
|
|
||||||
of comma. */
|
|
||||||
tok = new StringTokenizer(firstPart,"\""); //$NON-NLS-1$
|
|
||||||
if(tok.hasMoreTokens())
|
|
||||||
{
|
|
||||||
fileName = tok.nextToken();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* If the file name doesnot exist return
|
|
||||||
false. */
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
secondPart = line.substring(firstComma + 1);
|
|
||||||
/* look for '.' character after the first occurance
|
|
||||||
of comma. */
|
|
||||||
tok = new StringTokenizer(secondPart,"."); //$NON-NLS-1$
|
|
||||||
if(tok.countTokens()>1)
|
|
||||||
{
|
|
||||||
String token = tok.nextToken();
|
|
||||||
/* look for the string "line " before the
|
|
||||||
the occurance of '.' operator. */
|
|
||||||
int index;
|
|
||||||
if( (index = token.indexOf("line ")) != -1) //$NON-NLS-1$
|
|
||||||
{
|
|
||||||
/* The string that begins after "line " and ends
|
|
||||||
before '.' operator is the line number. */
|
|
||||||
lineNum = token.substring(index + 5);
|
|
||||||
lineNumber = Integer.parseInt(lineNum);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int index = -1;
|
|
||||||
/* look for the first occurance of ")" after the
|
|
||||||
* first occurance of comma.
|
|
||||||
*/
|
*/
|
||||||
index = secondPart.indexOf(")"); //$NON-NLS-1$
|
@Override
|
||||||
if( -1 == index )
|
public int getSeverity(Matcher matcher) {
|
||||||
{
|
return IMarkerGenerator.SEVERITY_WARNING;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
/* The character that resides before the ")" operator
|
/*
|
||||||
* indicates the severity of the message. The part of the
|
* @see org.eclipse.cdt.core.errorparsers.ErrorPattern#getDesc(java.util.regex.Matcher)
|
||||||
* error message that follows ")" is the description of the
|
|
||||||
* error.
|
|
||||||
*/
|
*/
|
||||||
message = secondPart.substring(index + 1);
|
@Override
|
||||||
severity = secondPart.substring(index - 1, index);
|
public String getDesc(Matcher matcher) {
|
||||||
if( severity.equals("I") ) //$NON-NLS-1$
|
return " Macro name " + matcher.group(4) + " originally defined in file " + getFileName(matcher);
|
||||||
{
|
|
||||||
severityNum = IMarkerGenerator.SEVERITY_INFO;
|
|
||||||
}
|
}
|
||||||
else if( severity.equals("W") ) //$NON-NLS-1$
|
},
|
||||||
{
|
new ErrorPattern(Messages.XlcErrorParser_CompilerErrorPattern, 1, 2, 5, 0, -1) {
|
||||||
severityNum = IMarkerGenerator.SEVERITY_WARNING;
|
/*
|
||||||
}
|
* @see org.eclipse.cdt.core.errorparsers.ErrorPattern#getSeverity(java.util.regex.Matcher)
|
||||||
else if( severity.equals("E") || severity.equals("S") ) //$NON-NLS-1$ //$NON-NLS-2$
|
*/
|
||||||
{
|
@Override
|
||||||
severityNum = IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
|
public int getSeverity(Matcher matcher) {
|
||||||
}
|
String warningGroup = matcher.group(4);
|
||||||
else if( severity.equals("U") ) //$NON-NLS-1$
|
if (warningGroup != null) {
|
||||||
{
|
if (warningGroup.equals(Messages.XlcErrorParser_FlagUnrecoverable)) {
|
||||||
severityNum = IMarkerGenerator.SEVERITY_ERROR_BUILD;
|
return IMarkerGenerator.SEVERITY_ERROR_BUILD;
|
||||||
}
|
} else if (warningGroup.equals(Messages.XlcErrorParser_FlagSevere)
|
||||||
else
|
|| warningGroup.equals(Messages.XlcErrorParser_FlagError)) {
|
||||||
{
|
return IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
|
||||||
return false;
|
} else if (warningGroup.equals(Messages.XlcErrorParser_FlagWarning)) {
|
||||||
}
|
return IMarkerGenerator.SEVERITY_WARNING;
|
||||||
}
|
} else if (warningGroup.equals(Messages.XlcErrorParser_FlagInfo)) {
|
||||||
else
|
return IMarkerGenerator.SEVERITY_INFO;
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This function processes the error message and passed the information
|
|
||||||
* to the ErrorParserManager.
|
|
||||||
* @param line is the error message generated by the xlc compiler
|
|
||||||
* and eoParser is the ErrorParserManager object.
|
|
||||||
* @return a boolean value indicating the success/failure of
|
|
||||||
* extracing values from the error message.
|
|
||||||
*/
|
|
||||||
public boolean processLine(String line, ErrorParserManager eoParser)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if( parseLine(line) )
|
|
||||||
{
|
|
||||||
IFile file = null;
|
|
||||||
if (fileName != null)
|
|
||||||
{
|
|
||||||
file = eoParser.findFileName(fileName);
|
|
||||||
if (file != null)
|
|
||||||
{
|
|
||||||
/* Check if there are conflicting file
|
|
||||||
* names.
|
|
||||||
*/
|
|
||||||
if (eoParser.isConflictingName(fileName))
|
|
||||||
{
|
|
||||||
file = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Find the path of the file.
|
|
||||||
file = eoParser.findFilePath(fileName);
|
|
||||||
}
|
|
||||||
if (file == null)
|
|
||||||
{
|
|
||||||
message = fileName + " " + message; //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
eoParser.generateMarker(file, lineNumber, message, severityNum, null);
|
return IMarkerGenerator.SEVERITY_INFO;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else
|
},
|
||||||
{
|
new ErrorPattern(Messages.XlcErrorParser_LinkerErrorPattern, 0, 0, 3, 0, -1) {
|
||||||
return false;
|
/*
|
||||||
|
* @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;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
catch(NumberFormatException e )
|
new ErrorPattern(Messages.XlcErrorParser_LinkerErrorPattern2, 0, 0, 2, 0, -1) {
|
||||||
{
|
/*
|
||||||
return false;
|
* @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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
###############################################################################
|
||||||
|
# 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])\\)(.*)
|
||||||
|
# "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\\) [\"]?(\\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]+) (.*)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue