[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Patch for Bugzilla Bug 81588
|
Hi,
Please find the attached patch file for Bugzilla Bug 81588 . Please apply this patch on CDT HEAD.
Is it possible to apply these changes in CDT 2.0.2 ?
Problem:
-------------
Currently there are error parsers which parses output from GNU's compiler, make
file, assembler. There are no parsers with respect to HP's aCC, assembler , make & linker.
Solution:
------------
I have written parsers which "parses" output messages specific to HPUX acc 5.x or acc 6.x, linker, make
& assembler.
Warm Regards
Bala
Index: plugin.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/plugin.properties,v
retrieving revision 1.27
diff -u -r1.27 plugin.properties
--- plugin.properties 6 Oct 2004 01:39:00 -0000 1.27
+++ plugin.properties 18 Dec 2004 11:04:58 -0000
@@ -40,6 +40,10 @@
CDTGNULinkerErrorParser.name=CDT GNU Linker Error Parser
CDTGNUMakeErrorParser.name=CDT GNU Make Error Parser
CDTVisualCErrorParser.name=CDT Visual C Error Parser
+CDTHPaCCErrorParser.name=CDT HP aCC C/C++ Error Parser
+CDTHPMakeErrorParser.name=CDT HP Make Error Parser
+CDTHPLDErrorParser.name=CDT HP Linker Error Parser
+CDTHPASErrorParser.name=CDT HP Assembler Error Parser
PathEntryContainerInitializer=Path Entry Container Initializer
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/plugin.xml,v
retrieving revision 1.70
diff -u -r1.70 plugin.xml
--- plugin.xml 2 Nov 2004 03:28:10 -0000 1.70
+++ plugin.xml 18 Dec 2004 11:04:59 -0000
@@ -194,6 +194,40 @@
class="org.eclipse.cdt.internal.errorparsers.VCErrorParser">
</errorparser>
</extension>
+ <extension
+ id="HPaCCErrorParser"
+ name="%CDTHPaCCErrorParser.name"
+ point="org.eclipse.cdt.core.ErrorParser">
+ <errorparser
+ class="org.eclipse.cdt.internal.errorparsers.HPaCCErrorParser">
+ </errorparser>
+ </extension>
+ <extension
+ id="HPMakeErrorParser"
+ name="%CDTHPMakeErrorParser.name"
+ point="org.eclipse.cdt.core.ErrorParser">
+ <errorparser
+ class="org.eclipse.cdt.internal.errorparsers.HPMakeErrorParser">
+ </errorparser>
+ </extension>
+ <extension
+ id="HPLDErrorParser"
+ name="%CDTHPLDErrorParser.name"
+ point="org.eclipse.cdt.core.ErrorParser">
+ <errorparser
+ class="org.eclipse.cdt.internal.errorparsers.HPLDErrorParser">
+ </errorparser>
+ </extension>
+ <extension
+ id="HPASErrorParser"
+ name="%CDTHPASErrorParser.name"
+ point="org.eclipse.cdt.core.ErrorParser">
+ <errorparser
+ class="org.eclipse.cdt.internal.errorparsers.HPASErrorParser">
+ </errorparser>
+ </extension>
+
+
<!-- =================================================================================== -->
<!-- CDT customized problem markers: C Problem markers -->
<!-- =================================================================================== -->
Index: src/org/eclipse/cdt/internal/errorparsers/HPASErrorParser.java
===================================================================
RCS file: src/org/eclipse/cdt/internal/errorparsers/HPASErrorParser.java
diff -N src/org/eclipse/cdt/internal/errorparsers/HPASErrorParser.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/internal/errorparsers/HPASErrorParser.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,63 @@
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ *
+ * (C) Copyright 2004 Hewlett-Packard Development Company, L.P.
+ */
+
+package org.eclipse.cdt.internal.errorparsers;
+
+import org.eclipse.cdt.core.ErrorParserManager;
+import org.eclipse.cdt.core.IErrorParser;
+import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.core.resources.IFile;
+
+public class HPASErrorParser implements IErrorParser {
+
+ public boolean processLine(String line, ErrorParserManager eoParser) {
+
+ try {
+ String fileName = "";
+ IFile file = null;
+ int num = 0;
+ int severity = IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
+ String desc = line;
+ if (line.startsWith("FATAL")) {
+ return false;
+ }
+ int firstColon= line.indexOf(':');
+ if (firstColon != -1) {
+ fileName = line.substring(0, firstColon);
+ if (! fileName.endsWith(".s")) {
+ return false;
+ }
+ if(! line.startsWith(fileName)) {
+ return false;
+ }
+ desc = line.substring(firstColon + 1);
+ int secondColon= line.indexOf(':', firstColon + 1);
+ if (secondColon != -1) {
+ String lineNumber = line.substring(firstColon + 1, secondColon);
+ try {
+ num = Integer.parseInt(lineNumber);
+ } catch (NumberFormatException e) {
+ }
+ if (num != 0) {
+ desc = line.substring(secondColon + 2);
+ }
+ }
+ file = eoParser.findFilePath(fileName);
+ }
+ if (file == null) {
+ desc = fileName + " " + desc;
+ }
+
+ if (num >= 1) {
+ eoParser.generateMarker(file, num, desc, severity, null);
+ }
+
+ } catch (IndexOutOfBoundsException e) {
+ }
+ return false;
+ }
+}
Index: src/org/eclipse/cdt/internal/errorparsers/HPLDErrorParser.java
===================================================================
RCS file: src/org/eclipse/cdt/internal/errorparsers/HPLDErrorParser.java
diff -N src/org/eclipse/cdt/internal/errorparsers/HPLDErrorParser.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/internal/errorparsers/HPLDErrorParser.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,41 @@
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ *
+ * (C) Copyright 2004 Hewlett-Packard Development Company, L.P.
+ */
+
+package org.eclipse.cdt.internal.errorparsers;
+
+import org.eclipse.cdt.core.ErrorParserManager;
+import org.eclipse.cdt.core.IErrorParser;
+import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.core.resources.IFile;
+
+public class HPLDErrorParser implements IErrorParser {
+
+ public static final String fileName = "Makefile";
+
+ public boolean processLine(String line, ErrorParserManager eoParser) {
+ int firstColon= line.indexOf(':');
+ if (firstColon != -1) {
+ String buf= line.substring(0, firstColon);
+ String desc= line.substring(firstColon + 1);
+ if (buf.endsWith("ld")){
+ // By default treat the condition as fatal/error, unless marked as a warning
+ int errorType = IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
+ desc = desc.trim();
+ if(desc.startsWith("warning") || desc.startsWith("Warning")) {
+ errorType = IMarkerGenerator.SEVERITY_WARNING;
+ }
+
+ IFile file = eoParser.findFilePath(fileName);
+ if (file == null) {
+ desc = fileName + " " + desc;
+ }
+ eoParser.generateMarker(file, -1 , desc, errorType, null);
+ }
+ }
+ return false;
+ }
+}
Index: src/org/eclipse/cdt/internal/errorparsers/HPMakeErrorParser.java
===================================================================
RCS file: src/org/eclipse/cdt/internal/errorparsers/HPMakeErrorParser.java
diff -N src/org/eclipse/cdt/internal/errorparsers/HPMakeErrorParser.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/internal/errorparsers/HPMakeErrorParser.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,78 @@
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ *
+ * (C) Copyright 2004 Hewlett-Packard Development Company, L.P.
+ */
+
+package org.eclipse.cdt.internal.errorparsers;
+
+import org.eclipse.cdt.core.ErrorParserManager;
+import org.eclipse.cdt.core.IErrorParser;
+import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.core.resources.IFile;
+
+public class HPMakeErrorParser implements IErrorParser {
+
+ public static final String fileName ="Makefile";
+
+ public HPMakeErrorParser() {
+ }
+
+ static int getDirectoryLevel(String line) {
+ int s = line.indexOf('[');
+ int num = 0;
+ if (s != -1) {
+ int e = line.indexOf(']');
+ String number = line.substring(s + 1, e).trim();
+ try {
+ num = Integer.parseInt(number);
+ } catch (NumberFormatException exc) {
+ }
+ }
+
+ return num;
+ }
+
+ public boolean processLine(String line, ErrorParserManager eoParser) {
+
+ if (line.startsWith("Make") || line.startsWith("aCC:")) {
+
+ int firstColon = line.indexOf(":");
+ String msg = line.substring(firstColon + 1).trim();
+ boolean warning = false;
+ if (msg.length() > 4) {
+ String s = msg.substring(4).trim();
+ warning = s.startsWith("warning");
+ }
+
+ int lineNumber = getErrorLineNumber(msg);
+ IFile file = eoParser.findFileName(fileName);
+
+ if (warning) {
+ eoParser.generateMarker(file, lineNumber, msg, IMarkerGenerator.SEVERITY_WARNING, null);
+ } else {
+ eoParser.generateMarker(file, lineNumber, msg, IMarkerGenerator.SEVERITY_ERROR_BUILD, null);
+ }
+ }
+ return false;
+ }
+
+ private int getErrorLineNumber(String msg) {
+
+ int lineNumber = -1;
+ int lineIndex = msg.indexOf("line");
+ int periodIndex = msg.indexOf(".");
+
+ if (lineIndex != -1) {
+ String lineNoStr = msg.substring(lineIndex + 5, periodIndex);
+ try {
+ lineNumber = Integer.parseInt(lineNoStr);
+ } catch (NumberFormatException e) {
+ //Ignore the exception. lineNumber will be initialized to -1
+ }
+ }
+ return lineNumber;
+
+ }
+}
Index: src/org/eclipse/cdt/internal/errorparsers/HPaCCErrorParser.java
===================================================================
RCS file: src/org/eclipse/cdt/internal/errorparsers/HPaCCErrorParser.java
diff -N src/org/eclipse/cdt/internal/errorparsers/HPaCCErrorParser.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/internal/errorparsers/HPaCCErrorParser.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,188 @@
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ *
+ * (C) Copyright 2004 Hewlett-Packard Development Company, L.P.
+ */
+
+package org.eclipse.cdt.internal.errorparsers;
+
+import org.eclipse.cdt.core.ErrorParserManager;
+import org.eclipse.cdt.core.IErrorParser;
+import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.core.resources.IFile;
+
+public class HPaCCErrorParser implements IErrorParser {
+
+ public HPaCCErrorParser() {
+ }
+
+ public boolean processLine(String line, ErrorParserManager eoParser) {
+
+ /**
+ * If the message has Error or Warning as its text, then the message is
+ * generated from aCC 5.X.
+ *
+ * If the error message has error or warning or catastrophic error or
+ * command-line error or internal error or remark as its text,
+ * then the message is generated from aCC 6.X.
+ */
+ if (line.indexOf("Error") == -1 && line.indexOf("Warning") == -1 ) {
+ if (line.indexOf("error") == -1 ||
+ line.indexOf("warning")== -1 ||
+ line.indexOf("catastrophic error") == -1 ||
+ line.indexOf("command-line error") == -1 ||
+ line.indexOf("internal error") == -1 ||
+ line.indexOf("remark") == -1 ) {
+
+ processNewMessages(line, eoParser);
+ return false;
+
+ } else {
+ return false;
+ }
+ }
+
+ int firstColon= line.indexOf(':');
+ if (firstColon == -1) {
+ return false;
+ }
+
+ String msg = line.substring(firstColon + 1).trim();
+ int lineNumber = getErrorLineNumber(line);
+
+ String fileName = getFile(line);
+ if (fileName.equalsIgnoreCase("")) {
+ return false;
+ }
+
+ IFile file = null;
+ try {
+ file = eoParser.findFilePath(fileName);
+ } catch (Exception e) {
+ }
+
+ String description = null;
+ description = line.substring (0,firstColon);
+ description = description + ":" + msg.substring(msg.indexOf("#") + 1);
+
+ int severity = IMarkerGenerator.SEVERITY_ERROR_BUILD;
+ if (line.length() > 4) {
+ boolean warning = line.startsWith("warning") ||line.startsWith("Warning");
+
+ if (warning) {
+ severity = IMarkerGenerator.SEVERITY_WARNING;
+ }
+ }
+ if (lineNumber >= 1 ) {
+ eoParser.generateMarker(file,lineNumber,description,severity,null);
+ }
+ return false;
+ }
+
+ public int getErrorLineNumber(String line) {
+ int lineNumber = -1;
+ int lineIndex = line.indexOf("line");
+ int hashIndex = line.indexOf("#");
+ int brackIndex = line.indexOf("]");
+
+ if (lineIndex == -1) {
+ return lineNumber;
+ }
+ if ( hashIndex == -1 && brackIndex == -1 ) {
+ return lineNumber;
+ }
+
+
+ String lineNumberstr = null;
+ if (brackIndex != -1 && brackIndex < hashIndex) {
+ lineNumberstr = line.substring(lineIndex + 5, brackIndex);
+ } else {
+ lineNumberstr = line.substring(lineIndex + 5, hashIndex);
+ }
+ try {
+ lineNumber = Integer.parseInt(lineNumberstr.trim());
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ }
+
+ return lineNumber;
+ }
+
+ public String getFile(String line) {
+ //Get the Resource
+ int stQuotes = line.indexOf("\"");
+ String subLine = line.substring (stQuotes + 1);
+ int endQuotes = subLine.indexOf("\"");
+
+ String fileName = "";
+ if (stQuotes == -1 || endQuotes == -1) {
+ return fileName;
+ }
+ try {
+ fileName = line.substring(stQuotes + 1, endQuotes + stQuotes + 1);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return fileName;
+ }
+
+ public boolean processNewMessages(String line, ErrorParserManager eoParser) {
+
+ int lineIndex = line.indexOf("line");
+ if (lineIndex == -1) {
+ return false;
+ }
+ int firstColon= line.indexOf(':');
+ if (firstColon == -1) {
+ return false;
+ }
+
+ String lineNumberStr = line.substring(lineIndex + 4, firstColon);
+ int lineNumber = -1;
+ try {
+ lineNumber = Integer.parseInt(lineNumberStr.trim());
+ } catch (NumberFormatException e) {
+
+ }
+
+ String fileName = getFile(line);
+ if (fileName.equalsIgnoreCase("")) {
+ return false;
+ }
+
+ IFile file = null;
+ try {
+ file = eoParser.findFilePath(fileName);
+ } catch (Exception e) {
+ }
+
+ String description = line.substring(firstColon + 1).trim();
+ int secondColonIndex = description.indexOf(":");
+ description = description.substring(secondColonIndex + 1).trim();
+
+ String error = line.substring(firstColon + 1,
+ (firstColon + 1) + (secondColonIndex + 1));
+
+ description = error.trim() + ": " + description.trim();
+
+ int severity = IMarkerGenerator.SEVERITY_ERROR_BUILD;
+ if (line.length() > 4) {
+ boolean warning = description.startsWith("warning") ||
+ description.startsWith("Warning");
+
+ boolean info = description.startsWith("info") ||
+ description.startsWith("remark");
+ if (warning) {
+ severity = IMarkerGenerator.SEVERITY_WARNING;
+ } else if (info) {
+ severity = IMarkerGenerator.SEVERITY_INFO;
+ }
+ }
+
+ if (lineNumber >= 1 ) {
+ eoParser.generateMarker(file,lineNumber,description,severity,null);
+ }
+ return false;
+ }
+}