1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 16:55:38 +02:00

Fix for PR 82354 [Scanner Config] incorrect discovered defines

- Corrected MACRO=MACRO=value pattern.
This commit is contained in:
Vladimir Hirsl 2005-01-06 21:46:32 +00:00
parent c44a67648d
commit 424182887a
2 changed files with 22 additions and 7 deletions

View file

@ -51,8 +51,8 @@ public final class ScannerConfigUtil {
String value = null;
int index = symbol.indexOf("="); //$NON-NLS-1$
if (index != -1) {
key = symbol.substring(0, index).trim();
value = symbol.substring(index + 1).trim();
key = getSymbolKey(symbol);
value = getSymbolValue(symbol);
} else {
key = symbol.trim();
}
@ -158,7 +158,7 @@ public final class ScannerConfigUtil {
String aValue = (String) j.next();
if (!activeValues.contains(aValue)) {
// result does not contain addend's value; add it
rSE.add(aValue, true);
rSE.add(getSymbolValue(aValue), true);
rc |= true;
}
}
@ -167,7 +167,7 @@ public final class ScannerConfigUtil {
String aValue = (String) j.next();
if (!removedValues.contains(aValue)) {
// result does not contain addend's value; add it
rSE.add(aValue, false);
rSE.add(getSymbolValue(aValue), false);
rc |= true;
}
}
@ -192,7 +192,7 @@ public final class ScannerConfigUtil {
public static String getSymbolKey(String symbol) {
int index = symbol.indexOf('=');
if (index != -1) {
return symbol.substring(0, index);
return symbol.substring(0, index).trim();
}
return symbol;
}
@ -206,7 +206,7 @@ public final class ScannerConfigUtil {
public static String getSymbolValue(String symbol) {
int index = symbol.indexOf('=');
if (index != -1) {
return symbol.substring(index+1);
return symbol.substring(index+1).trim();
}
return null;
}

View file

@ -41,7 +41,7 @@ public class SymbolEntry {
public SymbolEntry(String name, String value, boolean active) {
this.name = name;
if (values == null) {
values = new LinkedHashMap();
values = new LinkedHashMap(1);
}
values.put(value, Boolean.valueOf(active));
}
@ -143,4 +143,19 @@ public class SymbolEntry {
public int numberOfValues() {
return values.size();
}
public String toString() {
StringBuffer buffer = new StringBuffer(name);
buffer.append(':');
for (Iterator i = values.keySet().iterator(); i.hasNext(); ) {
String val = (String) i.next();
buffer.append('\t');
buffer.append((val == null) ? "null" : val);//$NON-NLS-1$
if (((Boolean) values.get(val)).booleanValue() == true) {
buffer.append("(active)");//$NON-NLS-1$
}
buffer.append('\n');
}
return buffer.toString();
}
}