1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
/*******************************************************************************
* 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
* Andrew Gvozdev (Quoin Inc.)
*******************************************************************************/
package org.eclipse.cdt.errorparsers.xlc;
/**
* This class provides for parsing the error messages generated by IBM AIX xlC compiler.
*
*/
import java.util.regex.Matcher;
import org.eclipse.cdt.core.IMarkerGenerator;
import org.eclipse.cdt.core.errorparsers.AbstractErrorParser;
import org.eclipse.cdt.core.errorparsers.ErrorPattern;
/**
* Class XlcErrorParser provides for parsing of error output messages
* produced by AIX xlC compiler and linker.
*
* @see org.eclipse.cdt.core.errorparsers.AbstractErrorParser
* @see org.eclipse.cdt.core.errorparsers.ErrorPattern
*/
public class XlcErrorParser extends AbstractErrorParser {
private static final ErrorPattern[] patterns = {
/**
* xlC produces 2 warning messages in case of macro redefinition:
* "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.
* Both can be captured by regular XlcErrorParser_CompilerErrorPattern. However
* different severity puts them apart in different groups. In addition
* the second entry in Problems view won't let you jump to the original definition.
* This ErrorPattern fixes those shortcomings.
*/
new ErrorPattern(Messages.XlcErrorParser_MacroRedefinitionErrorPattern, 6, 5, -1, 0, -1) {
/*
* @see org.eclipse.cdt.core.errorparsers.ErrorPattern#getSeverity(java.util.regex.Matcher)
*/
@Override
public int getSeverity(Matcher matcher) {
return IMarkerGenerator.SEVERITY_WARNING;
}
/*
* @see org.eclipse.cdt.core.errorparsers.ErrorPattern#getDesc(java.util.regex.Matcher)
*/
@Override
public String getDesc(Matcher matcher) {
return "Macro name " + matcher.group(4) + " originally defined in file " + getFileName(matcher);
}
},
new ErrorPattern(Messages.XlcErrorParser_CompilerErrorPattern, 1, 2, 5, 0, -1) {
/*
* @see org.eclipse.cdt.core.errorparsers.ErrorPattern#getSeverity(java.util.regex.Matcher)
*/
@Override
public int getSeverity(Matcher matcher) {
String warningGroup = matcher.group(4);
if (warningGroup != null) {
if (warningGroup.equals(Messages.XlcErrorParser_FlagUnrecoverable)) {
return IMarkerGenerator.SEVERITY_ERROR_BUILD;
} else if (warningGroup.equals(Messages.XlcErrorParser_FlagSevere)
|| warningGroup.equals(Messages.XlcErrorParser_FlagError)) {
return IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
} else if (warningGroup.equals(Messages.XlcErrorParser_FlagWarning)) {
return IMarkerGenerator.SEVERITY_WARNING;
} else if (warningGroup.equals(Messages.XlcErrorParser_FlagInfo)) {
return IMarkerGenerator.SEVERITY_INFO;
}
}
return IMarkerGenerator.SEVERITY_INFO;
}
},
new ErrorPattern(Messages.XlcErrorParser_LinkerErrorPattern, 0, 0, 3, 0, -1) {
/*
* @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;
}
},
new ErrorPattern(Messages.XlcErrorParser_LinkerErrorPattern2, 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_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);
}
}
|