mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Bug 378270 - xlc macro supplier doesn't overwrite old values for
compiler root location
This commit is contained in:
parent
fcaa09aaf8
commit
53306d93e9
1 changed files with 25 additions and 5 deletions
|
@ -101,14 +101,34 @@ public class XLCProjectMacroSupplier implements IProjectBuildMacroSupplier {
|
||||||
// our array consists of our macro, plus all the macros from our parent
|
// our array consists of our macro, plus all the macros from our parent
|
||||||
IBuildMacro[] parentMacros = provider.getMacros(IBuildMacroProvider.CONTEXT_PROJECT, project, true);
|
IBuildMacro[] parentMacros = provider.getMacros(IBuildMacroProvider.CONTEXT_PROJECT, project, true);
|
||||||
|
|
||||||
int numMacros = parentMacros.length + 1; // +1 for our macro
|
|
||||||
|
// look for an existing macro definition
|
||||||
|
int foundIndex = -1;
|
||||||
|
for(int k = 0; k < parentMacros.length; k++) {
|
||||||
|
|
||||||
|
if(parentMacros[k].getName().equals(macro.getName())) {
|
||||||
|
foundIndex = k;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int numMacros = (foundIndex == -1) ? parentMacros.length + 1 : parentMacros.length;
|
||||||
|
|
||||||
IBuildMacro[] macros = new IBuildMacro[numMacros];
|
IBuildMacro[] macros = new IBuildMacro[numMacros];
|
||||||
|
|
||||||
macros[0] = macro;
|
// if there was no existing value then add it to the front
|
||||||
|
if(foundIndex == -1) {
|
||||||
|
macros[0] = macro;
|
||||||
|
for(int k = 1; k < macros.length; k++) {
|
||||||
|
macros[k] = parentMacros[k-1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(int k = 1; k < macros.length; k++) {
|
else { // replace the old value
|
||||||
macros[k] = parentMacros[k-1];
|
for(int k = 0; k < macros.length; k++) {
|
||||||
|
macros[k] = parentMacros[k];
|
||||||
|
}
|
||||||
|
macros[foundIndex] = macro;
|
||||||
}
|
}
|
||||||
|
|
||||||
return macros;
|
return macros;
|
||||||
|
|
Loading…
Add table
Reference in a new issue