mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for PR 77940: Missing built-ins for mingw
Addendum: Symbol definitions as a result of -dD option are written to the standard error stream since gcc version 3.4.x. This is now proprly handled.
This commit is contained in:
parent
8fc3226f2d
commit
2f8b9abb4b
1 changed files with 29 additions and 61 deletions
|
@ -31,16 +31,11 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
|||
private final String INCLUDE = "#include"; //$NON-NLS-1$
|
||||
private final String DEFINE = "#define"; //$NON-NLS-1$
|
||||
|
||||
private final int STATE_BEGIN = 0;
|
||||
private final int STATE_SPECS_STARTED = 1;
|
||||
private final int STATE_INCLUDES_STARTED = 2;
|
||||
private final int STATE_ADDITIONAL_DEFINES_STARTED = 3;
|
||||
|
||||
private IProject fProject = null;
|
||||
private IScannerInfoConsoleParserUtility fUtil = null;
|
||||
private IScannerInfoCollector fCollector = null;
|
||||
|
||||
private int state = STATE_BEGIN;
|
||||
private boolean expectingIncludes = false;
|
||||
private List symbols = new ArrayList();
|
||||
private List includes = new ArrayList();
|
||||
|
||||
|
@ -59,44 +54,8 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
|||
public boolean processLine(String line) {
|
||||
boolean rc = false;
|
||||
TraceUtil.outputTrace("GCCSpecsConsoleParser parsing line:", TraceUtil.EOL, line); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
// Known patterns:
|
||||
// (a) gcc|g++ ... -Dxxx -Iyyy ...
|
||||
switch (state) {
|
||||
case STATE_BEGIN:
|
||||
if (line.startsWith("Reading specs from")) { //$NON-NLS-1$
|
||||
state = STATE_SPECS_STARTED;
|
||||
}
|
||||
break;
|
||||
case STATE_SPECS_STARTED:
|
||||
if (line.indexOf("-D") != -1) { //$NON-NLS-1$
|
||||
// line contains -Ds, extract them
|
||||
String[] tokens = line.split("\\s+");//$NON-NLS-1$
|
||||
for (int i = 0; i < tokens.length; ++i) {
|
||||
if (tokens[i].startsWith("-D")) { //$NON-NLS-1$
|
||||
String symbol = tokens[i].substring(2);
|
||||
if (!symbols.contains(symbol))
|
||||
symbols.add(symbol);
|
||||
}
|
||||
}
|
||||
}
|
||||
// now get all the includes
|
||||
if (line.startsWith(INCLUDE) && line.endsWith("search starts here:")) { //$NON-NLS-1$
|
||||
state = STATE_INCLUDES_STARTED;
|
||||
}
|
||||
break;
|
||||
case STATE_INCLUDES_STARTED:
|
||||
if (line.startsWith(INCLUDE) && line.endsWith("search starts here:")) { //$NON-NLS-1$
|
||||
state = STATE_INCLUDES_STARTED;
|
||||
}
|
||||
else if (line.startsWith("End of search list.")) { //$NON-NLS-1$
|
||||
state = STATE_ADDITIONAL_DEFINES_STARTED;
|
||||
}
|
||||
else {
|
||||
if (!includes.contains(line))
|
||||
includes.add(line);
|
||||
}
|
||||
break;
|
||||
case STATE_ADDITIONAL_DEFINES_STARTED:
|
||||
|
||||
// contribution of -dD option
|
||||
if (line.startsWith(DEFINE)) {
|
||||
String[] defineParts = line.split("\\s+", 3); //$NON-NLS-1$
|
||||
if (defineParts[0].equals(DEFINE)) {
|
||||
|
@ -114,7 +73,16 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
|||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
// now get all the includes
|
||||
else if (line.startsWith(INCLUDE) && line.endsWith("search starts here:")) { //$NON-NLS-1$
|
||||
expectingIncludes = true;
|
||||
}
|
||||
else if (line.startsWith("End of search list.")) { //$NON-NLS-1$
|
||||
expectingIncludes = false;
|
||||
}
|
||||
else if (expectingIncludes) {
|
||||
if (!includes.contains(line))
|
||||
includes.add(line);
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
|
Loading…
Add table
Reference in a new issue