1
0
Fork 0
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

Option -dD is added to the default generate external scanner info command. GCCSpecsConsoleParser is updated to properly handle results of this option.
This commit is contained in:
Vladimir Hirsl 2004-12-24 05:58:47 +00:00
parent b8955a476e
commit 2eb2ae36d9
4 changed files with 39 additions and 21 deletions

View file

@ -119,7 +119,7 @@
</parameter>
<parameter
name="defaultAttributes"
value="-E -P -v ${plugin_state_location}/${specs_file}">
value="-E -P -v -dD ${plugin_state_location}/${specs_file}">
</parameter>
</run>
</externalScannerInfoProvider>

View file

@ -52,7 +52,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
scInfo.setESIProviderCommandEnabled(true);
scInfo.setUseDefaultESIProviderCmd(true);
scInfo.setESIProviderCommand(new Path("gcc")); //$NON-NLS-1$
scInfo.setESIProviderArguments("-E -P -v ${plugin_state_location}/${specs_file}"); //$NON-NLS-1$
scInfo.setESIProviderArguments("-E -P -v -dD ${plugin_state_location}/${specs_file}"); //$NON-NLS-1$
scInfo.setESIProviderConsoleParserId(MakeCorePlugin.GCC_SPECS_CONSOLE_PARSER_ID);
scInfo.setMakeBuilderConsoleParserId(MakeCorePlugin.GCC_SCANNER_INFO_CONSOLE_PARSER_ID);
scInfo.setSIProblemGenerationEnabled(true);

View file

@ -169,7 +169,7 @@ public class ScannerConfigInfoFactory {
if (isDefaultESIProviderCmd()) {
String attributes = getESIProviderParameter("defaultAttributes"); //$NON-NLS-1$
if (attributes == null) {
attributes = "-E -P -v ${plugin_state_location}/{specs_file}"; //$NON-NLS-1$
attributes = "-E -P -v -dD ${plugin_state_location}/{specs_file}"; //$NON-NLS-1$
}
return attributes;
}

View file

@ -13,7 +13,6 @@ package org.eclipse.cdt.make.internal.core.scannerconfig.gnu;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.StringTokenizer;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
@ -29,9 +28,13 @@ import org.eclipse.core.resources.IProject;
* @author vhirsl
*/
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;
@ -63,45 +66,57 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
if (line.startsWith("Reading specs from")) { //$NON-NLS-1$
state = STATE_SPECS_STARTED;
}
return rc;
break;
case STATE_SPECS_STARTED:
if (line.indexOf("-D") != -1) { //$NON-NLS-1$
// line contains -Ds, extract them
StringTokenizer scanner = new StringTokenizer(line);
if (scanner.countTokens() <= 1)
return rc;
for (String token = scanner.nextToken(); scanner.hasMoreTokens(); token = scanner.nextToken()) {
if (token.startsWith("-D")) { //$NON-NLS-1$
String symbol = token.substring(2);
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$ //$NON-NLS-2$
if (line.startsWith(INCLUDE) && line.endsWith("search starts here:")) { //$NON-NLS-1$
state = STATE_INCLUDES_STARTED;
}
return rc;
break;
case STATE_INCLUDES_STARTED:
if (line.startsWith("#include") && line.endsWith("search starts here:")) { //$NON-NLS-1$ //$NON-NLS-2$
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_BEGIN;
break;
state = STATE_ADDITIONAL_DEFINES_STARTED;
}
else {
if (!includes.contains(line))
includes.add(line);
}
return rc;
break;
case STATE_ADDITIONAL_DEFINES_STARTED:
if (line.startsWith(DEFINE)) {
String[] defineParts = line.split("\\s+", 3); //$NON-NLS-1$
if (defineParts[0].equals(DEFINE)) {
String symbol = null;
switch (defineParts.length) {
case 2:
symbol = defineParts[1];
break;
case 3:
symbol = defineParts[1] + "=" + defineParts[2];
break;
}
if (symbol != null && !symbols.contains(symbol)) { //$NON-NLS-1$
symbols.add(symbol);
}
}
}
break;
}
fCollector.contributeToScannerConfig(fProject, includes, symbols, new HashMap());
TraceUtil.outputTrace("Scanner info from \'specs\' file", //$NON-NLS-1$
"Include paths", includes, new ArrayList(), "Defined symbols", symbols); //$NON-NLS-1$ //$NON-NLS-2$);
return rc;
}
@ -109,6 +124,9 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
* @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#shutdown()
*/
public void shutdown() {
fCollector.contributeToScannerConfig(fProject, includes, symbols, new HashMap());
TraceUtil.outputTrace("Scanner info from \'specs\' file", //$NON-NLS-1$
"Include paths", includes, new ArrayList(), "Defined symbols", symbols); //$NON-NLS-1$ //$NON-NLS-2$);
if (fUtil != null) {
fUtil.reportProblems();
}