mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
bug 407781: Under some conditions builtin specs detector could keep running in infinite loop
This commit is contained in:
parent
93bdf7df2d
commit
c2ba71b046
1 changed files with 12 additions and 6 deletions
|
@ -129,7 +129,9 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
protected List<ICLanguageSettingEntry> detectedSettingEntries = null;
|
protected List<ICLanguageSettingEntry> detectedSettingEntries = null;
|
||||||
protected int collected = 0;
|
protected int collected = 0;
|
||||||
protected volatile boolean isExecuted = false;
|
protected volatile boolean isExecuted = false;
|
||||||
private int envPathHash = 0;
|
|
||||||
|
private static final int HASH_NOT_INITIALIZED = -1;
|
||||||
|
private int envPathHash = HASH_NOT_INITIALIZED;
|
||||||
|
|
||||||
private BuildRunnerHelper buildRunnerHelper;
|
private BuildRunnerHelper buildRunnerHelper;
|
||||||
private SDMarkerGenerator markerGenerator = new SDMarkerGenerator();
|
private SDMarkerGenerator markerGenerator = new SDMarkerGenerator();
|
||||||
|
@ -399,7 +401,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
protected boolean validateEnvironment() {
|
protected boolean validateEnvironment() {
|
||||||
String envPathValue = environmentMap.get(ENV_PATH);
|
String envPathValue = environmentMap.get(ENV_PATH);
|
||||||
int envPathValueHash = envPathValue != null ? envPathValue.hashCode() : 0;
|
int envPathValueHash = envPathValue != null ? envPathValue.hashCode() : 0;
|
||||||
if (envPathValueHash != envPathHash || envPathValueHash == 0) {
|
if (envPathValueHash != envPathHash) {
|
||||||
envPathHash = envPathValueHash;
|
envPathHash = envPathValueHash;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -669,7 +671,11 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
private Map<String, String> createEnvironmentMap(ICConfigurationDescription cfgDescription) {
|
private Map<String, String> createEnvironmentMap(ICConfigurationDescription cfgDescription) {
|
||||||
Map<String, String> envMap = new HashMap<String, String>();
|
Map<String, String> envMap = new HashMap<String, String>();
|
||||||
for (IEnvironmentVariable var : getEnvironmentVariables()) {
|
for (IEnvironmentVariable var : getEnvironmentVariables()) {
|
||||||
envMap.put(var.getName(), var.getValue());
|
String name = var.getName();
|
||||||
|
if (!envMngr.isVariableCaseSensitive()) {
|
||||||
|
name = name.toUpperCase();
|
||||||
|
}
|
||||||
|
envMap.put(name, var.getValue());
|
||||||
}
|
}
|
||||||
return envMap;
|
return envMap;
|
||||||
}
|
}
|
||||||
|
@ -799,7 +805,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
public Element serializeAttributes(Element parentElement) {
|
public Element serializeAttributes(Element parentElement) {
|
||||||
Element elementProvider = super.serializeAttributes(parentElement);
|
Element elementProvider = super.serializeAttributes(parentElement);
|
||||||
elementProvider.setAttribute(ATTR_CONSOLE, Boolean.toString(isConsoleEnabled));
|
elementProvider.setAttribute(ATTR_CONSOLE, Boolean.toString(isConsoleEnabled));
|
||||||
if (envPathHash != 0) {
|
if (envPathHash != HASH_NOT_INITIALIZED) {
|
||||||
elementProvider.setAttribute(ATTR_ENV_HASH, Integer.toString(envPathHash));
|
elementProvider.setAttribute(ATTR_ENV_HASH, Integer.toString(envPathHash));
|
||||||
}
|
}
|
||||||
return elementProvider;
|
return elementProvider;
|
||||||
|
@ -814,7 +820,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
isConsoleEnabled = Boolean.parseBoolean(consoleValue);
|
isConsoleEnabled = Boolean.parseBoolean(consoleValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
envPathHash = 0;
|
envPathHash = HASH_NOT_INITIALIZED;
|
||||||
String envPathHashStr = XmlUtil.determineAttributeValue(providerNode, ATTR_ENV_HASH);
|
String envPathHashStr = XmlUtil.determineAttributeValue(providerNode, ATTR_ENV_HASH);
|
||||||
if (envPathHashStr != null) {
|
if (envPathHashStr != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -852,7 +858,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
clone.isExecuted = false;
|
clone.isExecuted = false;
|
||||||
clone.envMngr = null;
|
clone.envMngr = null;
|
||||||
clone.environmentMap = null;
|
clone.environmentMap = null;
|
||||||
clone.envPathHash = 0;
|
clone.envPathHash = HASH_NOT_INITIALIZED;
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue